Navigation: Enable new navigation by default (#48447)

This commit is contained in:
Josh Hunt 2022-05-03 15:28:40 +01:00 committed by GitHub
parent e1a15bab21
commit 5dabb55b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 29 deletions

View File

@ -1152,6 +1152,9 @@ commandPalette = true
# Use dynamic labels in CloudWatch datasource # Use dynamic labels in CloudWatch datasource
cloudWatchDynamicLabels = false cloudWatchDynamicLabels = false
# New expandable navigation
newNavigation = true
# feature1 = true # feature1 = true
# feature2 = false # feature2 = false

View File

@ -26,7 +26,7 @@ describe('Trace view', () => {
e2e.components.TraceViewer.spanBar() e2e.components.TraceViewer.spanBar()
.its('length') .its('length')
.then((oldLength) => { .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 // After scrolling we should load more spans
e2e.components.TraceViewer.spanBar().its('length').should('be.gt', oldLength); e2e.components.TraceViewer.spanBar().its('length').should('be.gt', oldLength);

View File

@ -183,7 +183,7 @@ export const Pages = {
container: 'data-testid Explore', container: 'data-testid Explore',
graph: 'Explore Graph', graph: 'Explore Graph',
table: 'Explore Table', table: 'Explore Table',
scrollBar: () => '.scrollbar-view', scrollView: 'data-testid explorer scroll view',
}, },
}, },
SoloPanel: { SoloPanel: {

View File

@ -12,6 +12,7 @@ export type ScrollbarPosition = positionValues;
interface Props { interface Props {
className?: string; className?: string;
testId?: string;
autoHide?: boolean; autoHide?: boolean;
autoHideTimeout?: number; autoHideTimeout?: number;
autoHeightMax?: string; autoHeightMax?: string;
@ -33,6 +34,7 @@ export const CustomScrollbar: FC<Props> = ({
autoHideTimeout = 200, autoHideTimeout = 200,
setScrollTop, setScrollTop,
className, className,
testId,
autoHeightMin = '0', autoHeightMin = '0',
autoHeightMax = '100%', autoHeightMax = '100%',
hideTracksWhenNotNeeded = false, hideTracksWhenNotNeeded = false,
@ -118,6 +120,7 @@ export const CustomScrollbar: FC<Props> = ({
return ( return (
<Scrollbars <Scrollbars
data-testid={testId}
ref={ref} ref={ref}
className={classNames(styles.customScrollbar, className)} className={classNames(styles.customScrollbar, className)}
onScrollStop={onScrollStop} onScrollStop={onScrollStop}

View File

@ -93,17 +93,17 @@ export const NavBarNext = React.memo(() => {
<NavBarMenuPortalContainer /> <NavBarMenuPortalContainer />
<ul className={styles.itemList}> <NavBarItemWithoutMenu
<NavBarItemWithoutMenu elClassName={styles.grafanaLogoInner}
elClassName={styles.grafanaLogoInner} label="Home"
label="Home" className={styles.grafanaLogo}
className={styles.grafanaLogo} url={homeItem.url}
url={homeItem.url} >
> <Branding.MenuLogo />
<Branding.MenuLogo /> </NavBarItemWithoutMenu>
</NavBarItemWithoutMenu>
<NavBarScrollContainer> <NavBarScrollContainer>
<ul className={styles.itemList}>
<NavBarItem className={styles.search} isActive={activeItem === searchItem} link={searchItem}> <NavBarItem className={styles.search} isActive={activeItem === searchItem} link={searchItem}>
<Icon name="search" size="xl" /> <Icon name="search" size="xl" />
</NavBarItem> </NavBarItem>
@ -130,21 +130,21 @@ export const NavBarNext = React.memo(() => {
{link.img && <img src={link.img} alt={`${link.text} logo`} />} {link.img && <img src={link.img} alt={`${link.text} logo`} />}
</NavBarItem> </NavBarItem>
))} ))}
</NavBarScrollContainer>
{configItems.map((link, index) => ( {configItems.map((link, index) => (
<NavBarItem <NavBarItem
key={`${link.id}-${index}`} key={`${link.id}-${index}`}
isActive={isMatchOrChildMatch(link, activeItem)} isActive={isMatchOrChildMatch(link, activeItem)}
reverseMenuDirection reverseMenuDirection
link={link} link={link}
className={cx({ [styles.verticalSpacer]: index === 0 })} className={cx({ [styles.verticalSpacer]: index === 0 })}
> >
{link.icon && <Icon name={link.icon as IconName} size="xl" />} {link.icon && <Icon name={link.icon as IconName} size="xl" />}
{link.img && <img src={link.img} alt={`${link.text} logo`} />} {link.img && <img src={link.img} alt={`${link.text} logo`} />}
</NavBarItem> </NavBarItem>
))} ))}
</ul> </ul>
</NavBarScrollContainer>
</FocusScope> </FocusScope>
</NavBarContext.Provider> </NavBarContext.Provider>
</nav> </nav>
@ -210,9 +210,6 @@ const getStyles = (theme: GrafanaTheme2) => ({
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
height: '100%', height: '100%',
'> *': {
height: theme.spacing(6),
},
[theme.breakpoints.down('md')]: { [theme.breakpoints.down('md')]: {
visibility: 'hidden', visibility: 'hidden',
@ -222,7 +219,12 @@ const getStyles = (theme: GrafanaTheme2) => ({
alignItems: 'stretch', alignItems: 'stretch',
display: 'flex', display: 'flex',
flexShrink: 0, flexShrink: 0,
height: theme.spacing(6),
justifyContent: 'stretch', justifyContent: 'stretch',
[theme.breakpoints.down('md')]: {
visibility: 'hidden',
},
}), }),
grafanaLogoInner: css({ grafanaLogoInner: css({
alignItems: 'center', alignItems: 'center',

View File

@ -77,6 +77,7 @@ const getStyles = (theme: GrafanaTheme2) => ({
bottom: 0, bottom: 0,
}), }),
scrollContent: css({ scrollContent: css({
flex: 1,
position: 'relative', position: 'relative',
}), }),
// override the scroll container position so that the scroll indicators // override the scroll container position so that the scroll indicators

View File

@ -353,6 +353,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> {
return ( return (
<CustomScrollbar <CustomScrollbar
testId={selectors.pages.Explore.General.scrollView}
autoHeightMin={'100%'} autoHeightMin={'100%'}
scrollRefCallback={(scrollElement) => (this.scrollElement = scrollElement || undefined)} scrollRefCallback={(scrollElement) => (this.scrollElement = scrollElement || undefined)}
> >