mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Case-sensitive routes for standalone pages (#62779)
* feat: extend the RouteDescription witha `sensitive` property * feat: use case-sensitive routes for custom plugin standalone pages * fix: hcheck for `/a/` instead of `/a`
This commit is contained in:
@@ -18,10 +18,12 @@ export function getAppPluginRoutes(): RouteDescriptor[] {
|
||||
const pluginNavSection = getRootSectionForNode(navItem);
|
||||
const appPluginUrl = `/a/${navItem.pluginId}`;
|
||||
const path = isStandalonePluginPage(navItem.id) ? navItem.url || appPluginUrl : appPluginUrl; // Only standalone pages can use core URLs, otherwise we fall back to "/a/:pluginId"
|
||||
const isSensitive = isStandalonePluginPage(navItem.id) && !navItem.url?.startsWith('/a/'); // Have case-sensitive URLs only for standalone pages that have custom URLs
|
||||
|
||||
return {
|
||||
path,
|
||||
exact: false, // route everything under this path to the plugin, so it can define more routes under this path
|
||||
sensitive: isSensitive,
|
||||
component: () => <AppRootPage pluginId={navItem.pluginId} pluginNavSection={pluginNavSection} />,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user