From 2458329f4faf4372aacfae17189a5168e0a12a48 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 8 Nov 2024 16:46:07 +0000 Subject: [PATCH] ScrollContainer: use in Explore pages (#95830) use ScrollContainer in explore pages --- .../trace-view-scrolling.spec.ts | 2 +- .../trace-view-scrolling.spec.ts | 2 +- .../explore/ContentOutline/ContentOutline.tsx | 7 +++-- public/app/features/explore/Explore.tsx | 19 ++++-------- .../features/explore/ExplorePaneContainer.tsx | 29 +++++++++---------- .../explore/Logs/LogsNavigationPages.tsx | 8 ++--- 6 files changed, 29 insertions(+), 38 deletions(-) diff --git a/e2e/old-arch/various-suite/trace-view-scrolling.spec.ts b/e2e/old-arch/various-suite/trace-view-scrolling.spec.ts index be24aa79e20..a713ddd2230 100644 --- a/e2e/old-arch/various-suite/trace-view-scrolling.spec.ts +++ b/e2e/old-arch/various-suite/trace-view-scrolling.spec.ts @@ -32,7 +32,7 @@ describe('Trace view', () => { e2e.components.TraceViewer.spanBar() .its('length') .then((oldLength) => { - e2e.pages.Explore.General.scrollView().children('.scrollbar-view').scrollTo('center'); + e2e.pages.Explore.General.scrollView().children().first().scrollTo('center'); // After scrolling we should load more spans e2e.components.TraceViewer.spanBar().should(($span) => { diff --git a/e2e/various-suite/trace-view-scrolling.spec.ts b/e2e/various-suite/trace-view-scrolling.spec.ts index be24aa79e20..a713ddd2230 100644 --- a/e2e/various-suite/trace-view-scrolling.spec.ts +++ b/e2e/various-suite/trace-view-scrolling.spec.ts @@ -32,7 +32,7 @@ describe('Trace view', () => { e2e.components.TraceViewer.spanBar() .its('length') .then((oldLength) => { - e2e.pages.Explore.General.scrollView().children('.scrollbar-view').scrollTo('center'); + e2e.pages.Explore.General.scrollView().children().first().scrollTo('center'); // After scrolling we should load more spans e2e.components.TraceViewer.spanBar().should(($span) => { diff --git a/public/app/features/explore/ContentOutline/ContentOutline.tsx b/public/app/features/explore/ContentOutline/ContentOutline.tsx index ddd82ce01a3..a87e9321ee5 100644 --- a/public/app/features/explore/ContentOutline/ContentOutline.tsx +++ b/public/app/features/explore/ContentOutline/ContentOutline.tsx @@ -4,7 +4,8 @@ import { useToggle, useScroll } from 'react-use'; import { GrafanaTheme2, store } from '@grafana/data'; import { reportInteraction } from '@grafana/runtime'; -import { useStyles2, PanelContainer, CustomScrollbar } from '@grafana/ui'; +import { useStyles2, PanelContainer } from '@grafana/ui'; +import { ScrollContainer } from '@grafana/ui/src/unstable'; import { ContentOutlineItemContextProps, useContentOutlineContext } from './ContentOutlineContext'; import { ContentOutlineItemButton } from './ContentOutlineItemButton'; @@ -154,7 +155,7 @@ export function ContentOutline({ scroller, panelId }: { scroller: HTMLElement | return ( - +
- + ); } diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index 8345f679d69..9c070f832d0 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -20,15 +20,9 @@ import { import { selectors } from '@grafana/e2e-selectors'; import { getDataSourceSrv, reportInteraction } from '@grafana/runtime'; import { DataQuery } from '@grafana/schema'; -import { - AdHocFilterItem, - CustomScrollbar, - ErrorBoundaryAlert, - PanelContainer, - Themeable2, - withTheme2, -} from '@grafana/ui'; +import { AdHocFilterItem, ErrorBoundaryAlert, PanelContainer, Themeable2, withTheme2 } from '@grafana/ui'; import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR } from '@grafana/ui/src/components/Table/types'; +import { ScrollContainer } from '@grafana/ui/src/unstable'; import { supportedFeatures } from 'app/core/history/richHistoryStorageProvider'; import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource'; import { StoreState } from 'app/types'; @@ -578,10 +572,9 @@ export class Explore extends PureComponent { {contentOutlineVisible && ( )} - (this.scrollElement = scrollElement || undefined)} - hideHorizontalTrack + (this.scrollElement = scrollElement || undefined)} >
{datasourceInstance ? ( @@ -649,7 +642,7 @@ export class Explore extends PureComponent { this.renderEmptyState(styles.exploreContainer) )}
-
+
diff --git a/public/app/features/explore/ExplorePaneContainer.tsx b/public/app/features/explore/ExplorePaneContainer.tsx index 9a43fed4656..07aba1a5a41 100644 --- a/public/app/features/explore/ExplorePaneContainer.tsx +++ b/public/app/features/explore/ExplorePaneContainer.tsx @@ -4,7 +4,6 @@ import { connect } from 'react-redux'; import { EventBusSrv, getTimeZone } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; -import { CustomScrollbar } from '@grafana/ui'; import { stopQueryState } from 'app/core/utils/explore'; import { StoreState, useSelector } from 'app/types'; @@ -45,23 +44,21 @@ function ExplorePaneContainerUnconnected({ exploreId }: Props) { }, []); return ( - -
- + + {showQueryInspector && ( + setShowQueryInspector(false)} + timeZone={getTimeZone()} /> - {showQueryInspector && ( - setShowQueryInspector(false)} - timeZone={getTimeZone()} - /> - )} -
-
+ )} + ); } diff --git a/public/app/features/explore/Logs/LogsNavigationPages.tsx b/public/app/features/explore/Logs/LogsNavigationPages.tsx index 05f0f022e1c..7961de204e9 100644 --- a/public/app/features/explore/Logs/LogsNavigationPages.tsx +++ b/public/app/features/explore/Logs/LogsNavigationPages.tsx @@ -2,7 +2,8 @@ import { css, cx } from '@emotion/css'; import { dateTimeFormat, systemDateFormats, GrafanaTheme2 } from '@grafana/data'; import { TimeZone } from '@grafana/schema'; -import { CustomScrollbar, Spinner, useTheme2, clearButtonStyles } from '@grafana/ui'; +import { Spinner, useTheme2, clearButtonStyles } from '@grafana/ui'; +import { ScrollContainer } from '@grafana/ui/src/unstable'; import { LogsPage } from './LogsNavigation'; @@ -36,7 +37,7 @@ export function LogsNavigationPages({ pages, currentPageIndex, oldestLogsFirst, const styles = getStyles(theme, loading); return ( - +
{pages.map((page: LogsPage, index: number) => ( @@ -58,7 +59,7 @@ export function LogsNavigationPages({ pages, currentPageIndex, oldestLogsFirst, ))}
-
+
); } @@ -69,7 +70,6 @@ const getStyles = (theme: GrafanaTheme2, loading: boolean) => { paddingLeft: theme.spacing(0.5), display: 'flex', flexDirection: 'column', - overflowY: 'scroll', '&::after': { content: "''", display: 'block',