mirror of
https://github.com/grafana/grafana.git
synced 2025-01-15 19:22:34 -06:00
8d489dfd9b
* 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
15 lines
475 B
TypeScript
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}`))
|
|
);
|
|
}
|