mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AppRootPage: Render app plugins without pages (#58776)
fix: render app plugins that don't have a page in includes
This commit is contained in:
parent
8c585a4ebf
commit
4ee83a5f2b
@ -12,8 +12,7 @@ export function getAppPluginRoutes(): RouteDescriptor[] {
|
||||
const isStandalonePluginPage = (id: string) => id.startsWith('standalone-plugin-page-/');
|
||||
const isPluginNavModelItem = (model: NavModelItem): model is PluginNavModelItem =>
|
||||
'pluginId' in model && 'id' in model;
|
||||
|
||||
return Object.values(navIndex)
|
||||
const explicitAppPluginRoutes = Object.values(navIndex)
|
||||
.filter<PluginNavModelItem>(isPluginNavModelItem)
|
||||
.map((navItem) => {
|
||||
const pluginNavSection = getRootSectionForNode(navItem);
|
||||
@ -26,6 +25,17 @@ export function getAppPluginRoutes(): RouteDescriptor[] {
|
||||
component: () => <AppRootPage pluginId={navItem.pluginId} pluginNavSection={pluginNavSection} />,
|
||||
};
|
||||
});
|
||||
|
||||
return [
|
||||
...explicitAppPluginRoutes,
|
||||
|
||||
// Fallback route for plugins that don't have any pages under includes
|
||||
{
|
||||
path: '/a/:pluginId',
|
||||
exact: false, // route everything under this path to the plugin, so it can define more routes under this path
|
||||
component: ({ match }) => <AppRootPage pluginId={match.params.pluginId} pluginNavSection={navIndex.home} />,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
interface PluginNavModelItem extends Omit<NavModelItem, 'pluginId' | 'id'> {
|
||||
|
Loading…
Reference in New Issue
Block a user