2022-10-05 02:56:58 -05:00
|
|
|
// The ID of the main nav-tree item (the main item in the NavIndex)
|
|
|
|
export const ROUTE_BASE_ID = 'connections';
|
|
|
|
|
|
|
|
export const ROUTES = {
|
2022-11-10 04:14:23 -06:00
|
|
|
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`,
|
2022-10-05 02:56:58 -05:00
|
|
|
DataSourcesDashboards: `/${ROUTE_BASE_ID}/datasources/edit/:uid/dashboards`,
|
2022-11-10 04:14:23 -06:00
|
|
|
|
|
|
|
// Connect Data
|
2022-10-20 08:53:10 -05:00
|
|
|
ConnectData: `/${ROUTE_BASE_ID}/connect-data`,
|
Connections: Update datasource details url (#60521)
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 :)
2023-01-03 06:57:16 -06:00
|
|
|
DataSourcesDetails: `/${ROUTE_BASE_ID}/datasources/:id`,
|
2022-10-05 02:56:58 -05:00
|
|
|
} as const;
|