|
@@ -2,21 +2,29 @@ import React, { PureComponent } from 'react';
|
|
|
import { connect } from 'react-redux';
|
|
import { connect } from 'react-redux';
|
|
|
import { hot } from 'react-hot-loader';
|
|
import { hot } from 'react-hot-loader';
|
|
|
import PageHeader from '../../core/components/PageHeader/PageHeader';
|
|
import PageHeader from '../../core/components/PageHeader/PageHeader';
|
|
|
-import DataSourcesActionBar from './DataSourcesActionBar';
|
|
|
|
|
|
|
+import OrgActionBar from '../../core/components/OrgActionBar/OrgActionBar';
|
|
|
|
|
+import EmptyListCTA from '../../core/components/EmptyListCTA/EmptyListCTA';
|
|
|
import DataSourcesList from './DataSourcesList';
|
|
import DataSourcesList from './DataSourcesList';
|
|
|
-import { loadDataSources } from './state/actions';
|
|
|
|
|
-import { getDataSources, getDataSourcesCount, getDataSourcesLayoutMode } from './state/selectors';
|
|
|
|
|
-import { getNavModel } from '../../core/selectors/navModel';
|
|
|
|
|
import { DataSource, NavModel } from 'app/types';
|
|
import { DataSource, NavModel } from 'app/types';
|
|
|
import { LayoutMode } from '../../core/components/LayoutSelector/LayoutSelector';
|
|
import { LayoutMode } from '../../core/components/LayoutSelector/LayoutSelector';
|
|
|
-import EmptyListCTA from '../../core/components/EmptyListCTA/EmptyListCTA';
|
|
|
|
|
|
|
+import { loadDataSources, setDataSourcesLayoutMode, setDataSourcesSearchQuery } from './state/actions';
|
|
|
|
|
+import { getNavModel } from '../../core/selectors/navModel';
|
|
|
|
|
+import {
|
|
|
|
|
+ getDataSources,
|
|
|
|
|
+ getDataSourcesCount,
|
|
|
|
|
+ getDataSourcesLayoutMode,
|
|
|
|
|
+ getDataSourcesSearchQuery,
|
|
|
|
|
+} from './state/selectors';
|
|
|
|
|
|
|
|
export interface Props {
|
|
export interface Props {
|
|
|
navModel: NavModel;
|
|
navModel: NavModel;
|
|
|
dataSources: DataSource[];
|
|
dataSources: DataSource[];
|
|
|
dataSourcesCount: number;
|
|
dataSourcesCount: number;
|
|
|
layoutMode: LayoutMode;
|
|
layoutMode: LayoutMode;
|
|
|
|
|
+ searchQuery: string;
|
|
|
loadDataSources: typeof loadDataSources;
|
|
loadDataSources: typeof loadDataSources;
|
|
|
|
|
+ setDataSourcesLayoutMode: typeof setDataSourcesLayoutMode;
|
|
|
|
|
+ setDataSourcesSearchQuery: typeof setDataSourcesSearchQuery;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const emptyListModel = {
|
|
const emptyListModel = {
|
|
@@ -40,7 +48,20 @@ export class DataSourcesListPage extends PureComponent<Props> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
- const { dataSources, dataSourcesCount, navModel, layoutMode } = this.props;
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ dataSources,
|
|
|
|
|
+ dataSourcesCount,
|
|
|
|
|
+ navModel,
|
|
|
|
|
+ layoutMode,
|
|
|
|
|
+ searchQuery,
|
|
|
|
|
+ setDataSourcesSearchQuery,
|
|
|
|
|
+ setDataSourcesLayoutMode,
|
|
|
|
|
+ } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ const linkButton = {
|
|
|
|
|
+ href: 'datasources/new',
|
|
|
|
|
+ title: 'Add data source',
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
@@ -50,7 +71,14 @@ export class DataSourcesListPage extends PureComponent<Props> {
|
|
|
<EmptyListCTA model={emptyListModel} />
|
|
<EmptyListCTA model={emptyListModel} />
|
|
|
) : (
|
|
) : (
|
|
|
[
|
|
[
|
|
|
- <DataSourcesActionBar key="action-bar" />,
|
|
|
|
|
|
|
+ <OrgActionBar
|
|
|
|
|
+ layoutMode={layoutMode}
|
|
|
|
|
+ searchQuery={searchQuery}
|
|
|
|
|
+ onSetLayoutMode={mode => setDataSourcesLayoutMode(mode)}
|
|
|
|
|
+ setSearchQuery={query => setDataSourcesSearchQuery(query)}
|
|
|
|
|
+ linkButton={linkButton}
|
|
|
|
|
+ key="action-bar"
|
|
|
|
|
+ />,
|
|
|
<DataSourcesList dataSources={dataSources} layoutMode={layoutMode} key="list" />,
|
|
<DataSourcesList dataSources={dataSources} layoutMode={layoutMode} key="list" />,
|
|
|
]
|
|
]
|
|
|
)}
|
|
)}
|
|
@@ -66,11 +94,14 @@ function mapStateToProps(state) {
|
|
|
dataSources: getDataSources(state.dataSources),
|
|
dataSources: getDataSources(state.dataSources),
|
|
|
layoutMode: getDataSourcesLayoutMode(state.dataSources),
|
|
layoutMode: getDataSourcesLayoutMode(state.dataSources),
|
|
|
dataSourcesCount: getDataSourcesCount(state.dataSources),
|
|
dataSourcesCount: getDataSourcesCount(state.dataSources),
|
|
|
|
|
+ searchQuery: getDataSourcesSearchQuery(state.dataSources),
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = {
|
|
const mapDispatchToProps = {
|
|
|
loadDataSources,
|
|
loadDataSources,
|
|
|
|
|
+ setDataSourcesSearchQuery,
|
|
|
|
|
+ setDataSourcesLayoutMode,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourcesListPage));
|
|
export default hot(module)(connect(mapStateToProps, mapDispatchToProps)(DataSourcesListPage));
|