fix: only redirect when app is installed

pull/101838/head
Nick Richmond 4 months ago
parent 8cdc687abf
commit 44a5846dd2
  1. 7
      public/app/routes/routes.tsx

@ -27,10 +27,12 @@ const isDevEnv = config.buildInfo.env === 'development';
export const extraRoutes: RouteDescriptor[] = []; export const extraRoutes: RouteDescriptor[] = [];
export function getAppRoutes(): RouteDescriptor[] { export function getAppRoutes(): RouteDescriptor[] {
const appPluginRoutes = getAppPluginRoutes();
return [ return [
// Based on the Grafana configuration standalone plugin pages can even override and extend existing core pages, or they can register new routes under existing ones. // Based on the Grafana configuration standalone plugin pages can even override and extend existing core pages, or they can register new routes under existing ones.
// In order to make it possible we need to register them first due to how `<Switch>` is evaluating routes. (This will be unnecessary once/when we upgrade to React Router v6 and start using `<Routes>` instead.) // In order to make it possible we need to register them first due to how `<Switch>` is evaluating routes. (This will be unnecessary once/when we upgrade to React Router v6 and start using `<Routes>` instead.)
...getAppPluginRoutes(), ...appPluginRoutes,
{ {
path: '/', path: '/',
pageClass: 'page-dashboard', pageClass: 'page-dashboard',
@ -522,7 +524,8 @@ export function getAppRoutes(): RouteDescriptor[] {
config.featureToggles.exploreMetrics && { config.featureToggles.exploreMetrics && {
path: '/explore/metrics/*', path: '/explore/metrics/*',
roles: () => contextSrv.evaluatePermission([AccessControlAction.DataSourcesExplore]), roles: () => contextSrv.evaluatePermission([AccessControlAction.DataSourcesExplore]),
...(config.featureToggles.exploreMetricsUseExternalAppPlugin ...(config.featureToggles.exploreMetricsUseExternalAppPlugin &&
Boolean(appPluginRoutes.find(({ path }) => path === '/a/grafana-metricsdrilldown-app/*'))
? { ? {
component: SafeDynamicImport( component: SafeDynamicImport(
() => () =>

Loading…
Cancel
Save