Connections: Fix minor issues around Your connections/Data sources page (#63801)

* Connections: redirects to data sources

If Data sources page is the only child of Your connections, then the
NavLandingPage doesn't really make sense.

* DataSourcesList: do not show add button twice

If there are no data sources configured, then the DataSourcesList page
shows a large CTA to add a data source. Therefore, the add new data
source button in the header is redundant, let's remove it from there
in this case.

* DataSources: redirect to Connections after delete

The primary place of the DataSourceList page is under Connections,
provided that the `dataConnectionsConsole` feature is turned on.
Therefore, let's redirect there after deleting a data source.
This commit is contained in:
mikkancso
2023-03-01 08:23:08 +01:00
committed by GitHub
parent e1350a905f
commit 913cb17eac
6 changed files with 58 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ import {
import { updateNavIndex } from 'app/core/actions';
import { contextSrv } from 'app/core/core';
import { getBackendSrv } from 'app/core/services/backend_srv';
import { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants';
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
import { getPluginSettings } from 'app/features/plugins/pluginSettings';
import { importDataSourcePlugin } from 'app/features/plugins/plugin_loader';
@@ -261,6 +262,10 @@ export function deleteLoadedDataSource(): ThunkResult<void> {
await api.deleteDataSource(uid);
await getDatasourceSrv().reload();
locationService.push('/datasources');
const datasourcesUrl = config.featureToggles.dataConnectionsConsole
? CONNECTIONS_ROUTES.DataSources
: '/datasources';
locationService.push(datasourcesUrl);
};
}