DashboardPage.tsx 1.92 KB
Newer Older
Maxym Borodenko's avatar
Maxym Borodenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
import * as React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { parse } from 'query-string';

import { filterCodeToUrl } from 'actions/filterCode';
import { setPageTitle } from 'actions/pageTitle';

import ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';

import { BaseMyDataPage } from './MyDataPage';

interface IAdminDashProps extends React.ClassAttributes<any> {
    createDataset: any;
    createPartner: any;
    createDescriptor: any;
    createDescriptorList: any;
    setPageTitle: (title: string) => void;
    title: string;
    history: any;
}

class AdministrationDashboard extends BaseMyDataPage<IAdminDashProps> {
    constructor(props) {
        super(props);
        const { setPageTitle, title } = this.props;
        setPageTitle(title);
    }


    public render() {
        return (
            <div>
                <ContentHeaderWithButton title="What do you want to do?"/>
            </div>
        );
    }
}

const mapStateToProps = (state, ownProps) => ({
    title: ownProps.route.extraProps.title, // route-configured
    tab: ownProps.match.params.tab || 'datasets', // current tab, or ownProps.location.pathname
    pageCurrent: +parse(ownProps.location.search).p || 0, // current page
    pageSize: +parse(ownProps.location.search).l || 20, // page size
    pageSort: parse(ownProps.location.search).s || 'lastModifiedDate', // page sort
    pageDir: parse(ownProps.location.search).d || 'DESC', // page sort direction
    filterCode: parse(ownProps.location.search).filter, // filter code
    filter: state.filterCode.filters && parse(ownProps.location.search).filter && state.filterCode.filters[parse(ownProps.location.search).filter] || null,
});

const mapDispatchToProps = (dispatch) => bindActionCreators({
    setPageTitle,
    filterCodeToUrl,
}, dispatch);

export default connect(mapStateToProps, mapDispatchToProps)(AdministrationDashboard);