mirror of https://github.com/grafana/grafana.git
				
				
				
			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:
		
							parent
							
								
									cf650c9349
								
							
						
					
					
						commit
						48e0ab2142
					
				|  | @ -58,6 +58,7 @@ export class AppWrapper extends React.Component<AppWrapperProps, AppWrapperState | |||
|     return ( | ||||
|       <Route | ||||
|         exact={route.exact === undefined ? true : route.exact} | ||||
|         sensitive={route.sensitive === undefined ? false : route.sensitive} | ||||
|         path={route.path} | ||||
|         key={route.path} | ||||
|         render={(props) => { | ||||
|  |  | |||
|  | @ -19,4 +19,5 @@ export interface RouteDescriptor { | |||
|   routeName?: string; | ||||
|   chromeless?: boolean; | ||||
|   exact?: boolean; | ||||
|   sensitive?: boolean; | ||||
| } | ||||
|  |  | |||
|  | @ -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} />, | ||||
|       }; | ||||
|     }); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue