mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TopNav: Adds new feature toggle for upcoming nav~ (#51115)
This commit is contained in:
@@ -62,4 +62,5 @@ export interface FeatureToggles {
|
|||||||
logRequestsInstrumentedAsUnknown?: boolean;
|
logRequestsInstrumentedAsUnknown?: boolean;
|
||||||
dataConnectionsConsole?: boolean;
|
dataConnectionsConsole?: boolean;
|
||||||
internationalization?: boolean;
|
internationalization?: boolean;
|
||||||
|
topnav?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,5 +258,10 @@ var (
|
|||||||
Description: "Enables work-in-progress internationalization",
|
Description: "Enables work-in-progress internationalization",
|
||||||
State: FeatureStateAlpha,
|
State: FeatureStateAlpha,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "topnav",
|
||||||
|
Description: "New top nav and page layouts",
|
||||||
|
State: FeatureStateAlpha,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -190,4 +190,8 @@ const (
|
|||||||
// FlagInternationalization
|
// FlagInternationalization
|
||||||
// Enables work-in-progress internationalization
|
// Enables work-in-progress internationalization
|
||||||
FlagInternationalization = "internationalization"
|
FlagInternationalization = "internationalization"
|
||||||
|
|
||||||
|
// FlagTopnav
|
||||||
|
// New top nav and page layouts
|
||||||
|
FlagTopnav = "topnav"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -81,6 +81,22 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
|
|||||||
return <Switch>{getAppRoutes().map((r) => this.renderRoute(r))}</Switch>;
|
return <Switch>{getAppRoutes().map((r) => this.renderRoute(r))}</Switch>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderNavBar() {
|
||||||
|
if (config.isPublicDashboardView || !this.state.ready || config.featureToggles.topnav) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <NavBar />;
|
||||||
|
}
|
||||||
|
|
||||||
|
commandPaletteEnabled() {
|
||||||
|
return config.featureToggles.commandPalette && !config.isPublicDashboardView;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchBarEnabled() {
|
||||||
|
return !config.isPublicDashboardView;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { ready } = this.state;
|
const { ready } = this.state;
|
||||||
|
|
||||||
@@ -92,14 +108,6 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const commandPaletteEnabled = () => !config.isPublicDashboardView && config.featureToggles.commandPalette;
|
|
||||||
|
|
||||||
const renderNavBar = () => {
|
|
||||||
return !config.isPublicDashboardView && ready && <NavBar />;
|
|
||||||
};
|
|
||||||
|
|
||||||
const searchBarEnabled = () => !config.isPublicDashboardView;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
@@ -112,10 +120,10 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
|
|||||||
>
|
>
|
||||||
<ModalsProvider>
|
<ModalsProvider>
|
||||||
<GlobalStyles />
|
<GlobalStyles />
|
||||||
{commandPaletteEnabled() && <CommandPalette />}
|
{this.commandPaletteEnabled() && <CommandPalette />}
|
||||||
<div className="grafana-app">
|
<div className="grafana-app">
|
||||||
<Router history={locationService.getHistory()}>
|
<Router history={locationService.getHistory()}>
|
||||||
{renderNavBar()}
|
{this.renderNavBar()}
|
||||||
<main className="main-view">
|
<main className="main-view">
|
||||||
{pageBanners.map((Banner, index) => (
|
{pageBanners.map((Banner, index) => (
|
||||||
<Banner key={index.toString()} />
|
<Banner key={index.toString()} />
|
||||||
@@ -123,7 +131,7 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
|
|||||||
|
|
||||||
<AngularRoot />
|
<AngularRoot />
|
||||||
<AppNotificationList />
|
<AppNotificationList />
|
||||||
{searchBarEnabled() && <SearchWrapper />}
|
{this.searchBarEnabled() && <SearchWrapper />}
|
||||||
{ready && this.renderRoutes()}
|
{ready && this.renderRoutes()}
|
||||||
{bodyRenderHooks.map((Hook, index) => (
|
{bodyRenderHooks.map((Hook, index) => (
|
||||||
<Hook key={index.toString()} />
|
<Hook key={index.toString()} />
|
||||||
|
|||||||
Reference in New Issue
Block a user