Files
grafana/public/app/features/datasources/pages/DataSourcesListPage.tsx
T
mikkancso 913cb17eac 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.
2023-03-01 08:23:08 +01:00

32 lines
1.1 KiB
TypeScript

import React from 'react';
import { config } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page';
import {
ConnectionsRedirectNotice,
DestinationPage,
} from 'app/features/connections/components/ConnectionsRedirectNotice';
import { StoreState, useSelector } from 'app/types';
import { DataSourceAddButton } from '../components/DataSourceAddButton';
import { DataSourcesList } from '../components/DataSourcesList';
import { getDataSourcesCount } from '../state';
export function DataSourcesListPage() {
const dataSourcesCount = useSelector(({ dataSources }: StoreState) => getDataSourcesCount(dataSources));
const actions = config.featureToggles.topnav && dataSourcesCount > 0 ? <DataSourceAddButton /> : undefined;
return (
<Page navId="datasources" actions={actions}>
<Page.Contents>
{config.featureToggles.dataConnectionsConsole && (
<ConnectionsRedirectNotice destinationPage={DestinationPage.dataSources} />
)}
<DataSourcesList />
</Page.Contents>
</Page>
);
}
export default DataSourcesListPage;