mirror of https://github.com/grafana/grafana
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
parent
f51571db5d
commit
39a6d2e586
@ -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; |
Loading…
Reference in new issue