From 5dabb55b3955e0335740ac920b71ad987979c5ec Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Tue, 3 May 2022 15:28:40 +0100 Subject: [PATCH] Navigation: Enable new navigation by default (#48447) --- conf/defaults.ini | 3 + .../trace-view-scrolling.spec.ts | 2 +- .../src/selectors/pages.ts | 2 +- .../CustomScrollbar/CustomScrollbar.tsx | 3 + .../components/NavBar/Next/NavBarNext.tsx | 56 ++++++++++--------- .../NavBar/Next/NavBarScrollContainer.tsx | 1 + public/app/features/explore/Explore.tsx | 1 + 7 files changed, 39 insertions(+), 29 deletions(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index ff30a4d640a..a36fdede73c 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -1152,6 +1152,9 @@ commandPalette = true # Use dynamic labels in CloudWatch datasource cloudWatchDynamicLabels = false +# New expandable navigation +newNavigation = true + # feature1 = true # feature2 = false diff --git a/e2e/various-suite/trace-view-scrolling.spec.ts b/e2e/various-suite/trace-view-scrolling.spec.ts index 69a8bb191f8..3342281afe5 100644 --- a/e2e/various-suite/trace-view-scrolling.spec.ts +++ b/e2e/various-suite/trace-view-scrolling.spec.ts @@ -26,7 +26,7 @@ describe('Trace view', () => { e2e.components.TraceViewer.spanBar() .its('length') .then((oldLength) => { - e2e.pages.Explore.General.scrollBar().scrollTo('center'); + e2e.pages.Explore.General.scrollView().children('.scrollbar-view').scrollTo('center'); // After scrolling we should load more spans e2e.components.TraceViewer.spanBar().its('length').should('be.gt', oldLength); diff --git a/packages/grafana-e2e-selectors/src/selectors/pages.ts b/packages/grafana-e2e-selectors/src/selectors/pages.ts index 6ac5d7fbe6e..6dff1d14cac 100644 --- a/packages/grafana-e2e-selectors/src/selectors/pages.ts +++ b/packages/grafana-e2e-selectors/src/selectors/pages.ts @@ -183,7 +183,7 @@ export const Pages = { container: 'data-testid Explore', graph: 'Explore Graph', table: 'Explore Table', - scrollBar: () => '.scrollbar-view', + scrollView: 'data-testid explorer scroll view', }, }, SoloPanel: { diff --git a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx index a5091495894..f860dccebd0 100644 --- a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx +++ b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx @@ -12,6 +12,7 @@ export type ScrollbarPosition = positionValues; interface Props { className?: string; + testId?: string; autoHide?: boolean; autoHideTimeout?: number; autoHeightMax?: string; @@ -33,6 +34,7 @@ export const CustomScrollbar: FC = ({ autoHideTimeout = 200, setScrollTop, className, + testId, autoHeightMin = '0', autoHeightMax = '100%', hideTracksWhenNotNeeded = false, @@ -118,6 +120,7 @@ export const CustomScrollbar: FC = ({ return ( { -
    - - - + + + - + +
      @@ -130,21 +130,21 @@ export const NavBarNext = React.memo(() => { {link.img && {`${link.text}} ))} - - {configItems.map((link, index) => ( - - {link.icon && } - {link.img && {`${link.text}} - - ))} -
    + {configItems.map((link, index) => ( + + {link.icon && } + {link.img && {`${link.text}} + + ))} +
+ @@ -210,9 +210,6 @@ const getStyles = (theme: GrafanaTheme2) => ({ display: 'flex', flexDirection: 'column', height: '100%', - '> *': { - height: theme.spacing(6), - }, [theme.breakpoints.down('md')]: { visibility: 'hidden', @@ -222,7 +219,12 @@ const getStyles = (theme: GrafanaTheme2) => ({ alignItems: 'stretch', display: 'flex', flexShrink: 0, + height: theme.spacing(6), justifyContent: 'stretch', + + [theme.breakpoints.down('md')]: { + visibility: 'hidden', + }, }), grafanaLogoInner: css({ alignItems: 'center', diff --git a/public/app/core/components/NavBar/Next/NavBarScrollContainer.tsx b/public/app/core/components/NavBar/Next/NavBarScrollContainer.tsx index 91cc70fb680..a1d14bb2c9b 100644 --- a/public/app/core/components/NavBar/Next/NavBarScrollContainer.tsx +++ b/public/app/core/components/NavBar/Next/NavBarScrollContainer.tsx @@ -77,6 +77,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ bottom: 0, }), scrollContent: css({ + flex: 1, position: 'relative', }), // override the scroll container position so that the scroll indicators diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index 319d3801189..26f65b7eaf8 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -353,6 +353,7 @@ export class Explore extends React.PureComponent { return ( (this.scrollElement = scrollElement || undefined)} >