ExploreMetrics: Use redirect to route traffic to metrics drilldown app (#100098)

* fix: drilldown app redirect

* chore: make copilot review happy, I guess 🤷
pull/100168/head
Nick Richmond 6 months ago committed by GitHub
parent f51571db5d
commit 39a6d2e586
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      public/app/features/trails/RedirectToDrilldownApp.tsx
  2. 7
      public/app/routes/routes.tsx

@ -0,0 +1,17 @@
import { Navigate, useLocation, useParams } from 'react-router-dom-v5-compat';
import { getRouteForAppPlugin } from 'app/features/plugins/routes';
/**
* Navigate to the drilldown app with the remaining path parameters and search params
*/
const RedirectToDrilldownApp = () => {
const { '*': remainingPath } = useParams();
const location = useLocation();
const appPath = getRouteForAppPlugin('grafana-metricsdrilldown-app').path.replaceAll('*', '');
const newPath = `${appPath}${remainingPath}${location.search}`;
return <Navigate replace to={newPath} />;
};
export default RedirectToDrilldownApp;

@ -15,7 +15,7 @@ import { getRoutes as getDataConnectionsRoutes } from 'app/features/connections/
import { DATASOURCES_ROUTES } from 'app/features/datasources/constants';
import { ConfigureIRM } from 'app/features/gops/configuration-tracker/components/ConfigureIRM';
import { getRoutes as getPluginCatalogRoutes } from 'app/features/plugins/admin/routes';
import { getAppPluginRoutes, getRouteForAppPlugin } from 'app/features/plugins/routes';
import { getAppPluginRoutes } from 'app/features/plugins/routes';
import { getProfileRoutes } from 'app/features/profile/routes';
import { AccessControlAction, DashboardRoutes } from 'app/types';
@ -518,7 +518,10 @@ export function getAppRoutes(): RouteDescriptor[] {
roles: () => contextSrv.evaluatePermission([AccessControlAction.DataSourcesExplore]),
...(config.featureToggles.exploreMetricsUseExternalAppPlugin
? {
component: getRouteForAppPlugin('grafana-metricsdrilldown-app').component,
component: SafeDynamicImport(
() =>
import(/* webpackChunkName: "MetricsDrilldownRedirect"*/ 'app/features/trails/RedirectToDrilldownApp')
),
}
: {
chromeless: false,

Loading…
Cancel
Save