Plugins: Move AppChrome extension point to top of stack (#109015)
* Plugins: Move AppChrome extension point to top of stack * Plugins: Switch AppChrome extension gating to chromeless flag
This commit is contained in:
@@ -1,25 +1,16 @@
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
import { PluginExtensionPoints } from '@grafana/data';
|
||||
import { config, renderLimitedComponents, usePluginComponents } from '@grafana/runtime';
|
||||
|
||||
const excludedRoutes: Record<string, boolean> = {
|
||||
'/login': true,
|
||||
'/signup': true,
|
||||
'/verify': true,
|
||||
'/user/password/send-reset-email': true,
|
||||
'/user/password/reset': true,
|
||||
'/sandbox/benchmarks': true,
|
||||
};
|
||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||
|
||||
export function AppChromeExtensionPoint(): JSX.Element | null {
|
||||
const location = useLocation();
|
||||
const { chrome } = useGrafana();
|
||||
const state = chrome.useState();
|
||||
|
||||
if (config.featureToggles.enableAppChromeExtensions !== true) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (excludedRoutes[location.pathname]) {
|
||||
if (state.chromeless) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ export function RouterWrapper(props: RouterWrapperProps) {
|
||||
<AppChrome>
|
||||
<AppNotificationList />
|
||||
<Stack gap={0} grow={1} direction="column">
|
||||
<AppChromeExtensionPoint />
|
||||
{props.pageBanners.map((Banner, index) => (
|
||||
<Banner key={index.toString()} />
|
||||
))}
|
||||
@@ -42,7 +43,6 @@ export function RouterWrapper(props: RouterWrapperProps) {
|
||||
{props.bodyRenderHooks.map((Hook, index) => (
|
||||
<Hook key={index.toString()} />
|
||||
))}
|
||||
<AppChromeExtensionPoint />
|
||||
</AppChrome>
|
||||
<ModalRoot />
|
||||
</ModalsContextProvider>
|
||||
|
||||
Reference in New Issue
Block a user