mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
update datasource details url My ultimate goal is to make the cloud-onboarding plugin link to datasource details page inside Connections. I tried to do that, so that it linked to `/connections/connect-data/datasources/:id`, but it didn't work. Details below: We have a problem with the datasources details page url: If the plugin is not present, then the `/connections/connect-data/datasources/:id` url is finely served by Grafana. However, when the plugin is present, we register a Route entry like this: `<Route exact=false path='/connections/connect-data' component={AppPlugin} />` And this entry will be higher in the routes list than the datasources Route. This means that every path under `/connections/connect-data` will be served by the plugin. That's why exact is false. Otherwise the plugin couldn't serve integrations details at `connect-data/infrastructure/:id`. So `exact=false` is needed. What can we do? 1. Put Grafana's Connection routes higher in the list of routes. 2. Find a different URL for datasources details page Unfortunately, we can't do 1., because: Routes roughly look like this (in this order): - exact: false, path: connections/connect-data, component: AppPlugin - exact: false, path: connections/your-connections/infrastructure, component: AppPlugin - exact: false, path: connections, component: Connections So if a request comes for `/connections` or `/connections/your-connections` or `/connections/your-connections/datasources`, it will be served by Connections. Therefore, we can't really put the route for Connections higher in the list of routes, because then it will match all routes beginning with `/connections`, and the plugin's routes will have no effect. So the only alternative left is to find another path :/ Since we set the DataSourceDetailsPage's navId explicitly to `connections-connect-data`, the breadcrumbs will continue to show the data source page as a child item of the Connect Data page :)
20 lines
717 B
TypeScript
20 lines
717 B
TypeScript
// The ID of the main nav-tree item (the main item in the NavIndex)
|
|
export const ROUTE_BASE_ID = 'connections';
|
|
|
|
export const ROUTES = {
|
|
Base: `/${ROUTE_BASE_ID}`,
|
|
|
|
// Your Connections
|
|
YourConnections: `/${ROUTE_BASE_ID}/your-connections`,
|
|
|
|
// Your Connections / Datasources
|
|
DataSources: `/${ROUTE_BASE_ID}/your-connections/datasources`,
|
|
DataSourcesNew: `/${ROUTE_BASE_ID}/your-connections/datasources/new`,
|
|
DataSourcesEdit: `/${ROUTE_BASE_ID}/your-connections/datasources/edit/:uid`,
|
|
DataSourcesDashboards: `/${ROUTE_BASE_ID}/datasources/edit/:uid/dashboards`,
|
|
|
|
// Connect Data
|
|
ConnectData: `/${ROUTE_BASE_ID}/connect-data`,
|
|
DataSourcesDetails: `/${ROUTE_BASE_ID}/datasources/:id`,
|
|
} as const;
|