grafana/public/app/routes/utils.ts
Ashley Harrison 8d489dfd9b
Navigation: Landing pages behind feature toggles (#54576)
* super quick attempt

* feature toggle everything

* only construct alertNav if there are navChildren

* fix toggle name

* plugin landing pages poc

* add apps route + put behind feature toggle

* use toIconName

* rename to NavLandingPage

* feature toggle new routes

* don't modify GetServerAdminNode

* some fairly hacky code to check if the plugin has a root page

* remove trailing slash
2022-09-05 10:07:13 +01:00

15 lines
475 B
TypeScript

import { NavLinkDTO } from '@grafana/data';
export function isSoloRoute(path: string): boolean {
return /(d-solo|dashboard-solo)/.test(path?.toLowerCase());
}
export function pluginHasRootPage(pluginId: string, navTree: NavLinkDTO[]): boolean {
return Boolean(
navTree
.find((navLink) => navLink.id === 'apps')
?.children?.find((app) => app.id === `plugin-page-${pluginId}`)
?.children?.some((page) => page.url?.endsWith(`/a/${pluginId}`))
);
}