From 4ee83a5f2bf4e157a183c364ea0dbd06198b230e Mon Sep 17 00:00:00 2001 From: Levente Balogh Date: Wed, 16 Nov 2022 11:49:34 +0100 Subject: [PATCH] AppRootPage: Render app plugins without pages (#58776) fix: render app plugins that don't have a page in includes --- public/app/features/plugins/routes.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/public/app/features/plugins/routes.tsx b/public/app/features/plugins/routes.tsx index c05c0afe7da..6e26112cb68 100644 --- a/public/app/features/plugins/routes.tsx +++ b/public/app/features/plugins/routes.tsx @@ -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(isPluginNavModelItem) .map((navItem) => { const pluginNavSection = getRootSectionForNode(navItem); @@ -26,6 +25,17 @@ export function getAppPluginRoutes(): RouteDescriptor[] { component: () => , }; }); + + 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 }) => , + }, + ]; } interface PluginNavModelItem extends Omit {