chore: Reduce code duplication by letting the page component adding the header and taking care of the page title

This commit is contained in:
Johannes Schill
2019-01-17 09:01:17 +01:00
parent 234713466e
commit 00646b80c6
13 changed files with 159 additions and 188 deletions

View File

@@ -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} />}

View File

@@ -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}
/>