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;
|
||||
dataConnectionsConsole?: boolean;
|
||||
internationalization?: boolean;
|
||||
topnav?: boolean;
|
||||
}
|
||||
|
||||
@@ -258,5 +258,10 @@ var (
|
||||
Description: "Enables work-in-progress internationalization",
|
||||
State: FeatureStateAlpha,
|
||||
},
|
||||
{
|
||||
Name: "topnav",
|
||||
Description: "New top nav and page layouts",
|
||||
State: FeatureStateAlpha,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -190,4 +190,8 @@ const (
|
||||
// FlagInternationalization
|
||||
// Enables work-in-progress 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>;
|
||||
}
|
||||
|
||||
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() {
|
||||
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 (
|
||||
<Provider store={store}>
|
||||
<I18nProvider>
|
||||
@@ -112,10 +120,10 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
|
||||
>
|
||||
<ModalsProvider>
|
||||
<GlobalStyles />
|
||||
{commandPaletteEnabled() && <CommandPalette />}
|
||||
{this.commandPaletteEnabled() && <CommandPalette />}
|
||||
<div className="grafana-app">
|
||||
<Router history={locationService.getHistory()}>
|
||||
{renderNavBar()}
|
||||
{this.renderNavBar()}
|
||||
<main className="main-view">
|
||||
{pageBanners.map((Banner, index) => (
|
||||
<Banner key={index.toString()} />
|
||||
@@ -123,7 +131,7 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState
|
||||
|
||||
<AngularRoot />
|
||||
<AppNotificationList />
|
||||
{searchBarEnabled() && <SearchWrapper />}
|
||||
{this.searchBarEnabled() && <SearchWrapper />}
|
||||
{ready && this.renderRoutes()}
|
||||
{bodyRenderHooks.map((Hook, index) => (
|
||||
<Hook key={index.toString()} />
|
||||
|
||||
Reference in New Issue
Block a user