mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
chore: Reduce code duplication by letting the page component adding the header and taking care of the page title
This commit is contained in:
@@ -8,7 +8,7 @@ import DataSourcesList from './DataSourcesList';
|
||||
import { DataSource, NavModel, StoreState } from 'app/types';
|
||||
import { LayoutMode } from 'app/core/components/LayoutSelector/LayoutSelector';
|
||||
import { loadDataSources, setDataSourcesLayoutMode, setDataSourcesSearchQuery } from './state/actions';
|
||||
import { getNavModel, getTitleFromNavModel } from 'app/core/selectors/navModel';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
|
||||
import {
|
||||
getDataSources,
|
||||
@@ -67,8 +67,7 @@ export class DataSourcesListPage extends PureComponent<Props> {
|
||||
};
|
||||
|
||||
return (
|
||||
<Page title={getTitleFromNavModel(navModel)}>
|
||||
<Page.Header model={navModel} />
|
||||
<Page navModel={navModel}>
|
||||
<Page.Contents isLoading={!hasFetched}>
|
||||
<>
|
||||
{hasFetched && dataSourcesCount === 0 && <EmptyListCTA model={emptyListModel} />}
|
||||
|
||||
@@ -2,20 +2,17 @@
|
||||
|
||||
exports[`Render should render action bar and datasources 1`] = `
|
||||
<Page
|
||||
title="Configuration: Data Sources"
|
||||
>
|
||||
<PageHeader
|
||||
model={
|
||||
Object {
|
||||
"main": Object {
|
||||
"text": "Configuration",
|
||||
},
|
||||
"node": Object {
|
||||
"text": "Data Sources",
|
||||
},
|
||||
}
|
||||
navModel={
|
||||
Object {
|
||||
"main": Object {
|
||||
"text": "Configuration",
|
||||
},
|
||||
"node": Object {
|
||||
"text": "Data Sources",
|
||||
},
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PageContents
|
||||
isLoading={false}
|
||||
>
|
||||
@@ -160,20 +157,17 @@ exports[`Render should render action bar and datasources 1`] = `
|
||||
|
||||
exports[`Render should render component 1`] = `
|
||||
<Page
|
||||
title="Configuration: Data Sources"
|
||||
>
|
||||
<PageHeader
|
||||
model={
|
||||
Object {
|
||||
"main": Object {
|
||||
"text": "Configuration",
|
||||
},
|
||||
"node": Object {
|
||||
"text": "Data Sources",
|
||||
},
|
||||
}
|
||||
navModel={
|
||||
Object {
|
||||
"main": Object {
|
||||
"text": "Configuration",
|
||||
},
|
||||
"node": Object {
|
||||
"text": "Data Sources",
|
||||
},
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<PageContents
|
||||
isLoading={true}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user