mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* 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.
22 lines
877 B
TypeScript
22 lines
877 B
TypeScript
import * as React from 'react';
|
|
|
|
import { config } from '@grafana/runtime';
|
|
import { Page } from 'app/core/components/Page/Page';
|
|
import { DataSourceAddButton } from 'app/features/datasources/components/DataSourceAddButton';
|
|
import { DataSourcesList } from 'app/features/datasources/components/DataSourcesList';
|
|
import { getDataSourcesCount } from 'app/features/datasources/state';
|
|
import { StoreState, useSelector } from 'app/types';
|
|
|
|
export function DataSourcesListPage() {
|
|
const dataSourcesCount = useSelector(({ dataSources }: StoreState) => getDataSourcesCount(dataSources));
|
|
|
|
const actions = config.featureToggles.topnav && dataSourcesCount > 0 ? <DataSourceAddButton /> : undefined;
|
|
return (
|
|
<Page navId={'connections-your-connections-datasources'} actions={actions}>
|
|
<Page.Contents>
|
|
<DataSourcesList />
|
|
</Page.Contents>
|
|
</Page>
|
|
);
|
|
}
|