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
cloudWatchDynamicLabels = false
# New expandable navigation
newNavigation = true
# feature1 = true
# feature2 = false

View File

@ -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);

View File

@ -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: {

View File

@ -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<Props> = ({
autoHideTimeout = 200,
setScrollTop,
className,
testId,
autoHeightMin = '0',
autoHeightMax = '100%',
hideTracksWhenNotNeeded = false,
@ -118,6 +120,7 @@ export const CustomScrollbar: FC<Props> = ({
return (
<Scrollbars
data-testid={testId}
ref={ref}
className={classNames(styles.customScrollbar, className)}
onScrollStop={onScrollStop}

View File

@ -93,17 +93,17 @@ export const NavBarNext = React.memo(() => {
<NavBarMenuPortalContainer />
<ul className={styles.itemList}>
<NavBarItemWithoutMenu
elClassName={styles.grafanaLogoInner}
label="Home"
className={styles.grafanaLogo}
url={homeItem.url}
>
<Branding.MenuLogo />
</NavBarItemWithoutMenu>
<NavBarItemWithoutMenu
elClassName={styles.grafanaLogoInner}
label="Home"
className={styles.grafanaLogo}
url={homeItem.url}
>
<Branding.MenuLogo />
</NavBarItemWithoutMenu>
<NavBarScrollContainer>
<NavBarScrollContainer>
<ul className={styles.itemList}>
<NavBarItem className={styles.search} isActive={activeItem === searchItem} link={searchItem}>
<Icon name="search" size="xl" />
</NavBarItem>
@ -130,21 +130,21 @@ export const NavBarNext = React.memo(() => {
{link.img && <img src={link.img} alt={`${link.text} logo`} />}
</NavBarItem>
))}
</NavBarScrollContainer>
{configItems.map((link, index) => (
<NavBarItem
key={`${link.id}-${index}`}
isActive={isMatchOrChildMatch(link, activeItem)}
reverseMenuDirection
link={link}
className={cx({ [styles.verticalSpacer]: index === 0 })}
>
{link.icon && <Icon name={link.icon as IconName} size="xl" />}
{link.img && <img src={link.img} alt={`${link.text} logo`} />}
</NavBarItem>
))}
</ul>
{configItems.map((link, index) => (
<NavBarItem
key={`${link.id}-${index}`}
isActive={isMatchOrChildMatch(link, activeItem)}
reverseMenuDirection
link={link}
className={cx({ [styles.verticalSpacer]: index === 0 })}
>
{link.icon && <Icon name={link.icon as IconName} size="xl" />}
{link.img && <img src={link.img} alt={`${link.text} logo`} />}
</NavBarItem>
))}
</ul>
</NavBarScrollContainer>
</FocusScope>
</NavBarContext.Provider>
</nav>
@ -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',

View File

@ -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

View File

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