DashboardPage.tsx 1.85 KB
Newer Older
Maxym Borodenko's avatar
Maxym Borodenko committed
1 2 3 4 5 6 7 8
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 ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
9
import PageTitle from 'ui/common/PageTitle';
Maxym Borodenko's avatar
Maxym Borodenko committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

import { BaseMyDataPage } from './MyDataPage';

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

class AdministrationDashboard extends BaseMyDataPage<IAdminDashProps> {
    constructor(props) {
        super(props);
    }


    public render() {
        return (
            <div>
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
31
                <PageTitle title="What do you want to do?"/>
Maxym Borodenko's avatar
Maxym Borodenko committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45
                <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
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
46
    filter: state.filterCode.filters && parse(ownProps.location.search).filter && state.filterCode.filters[parse(ownProps.location.search).filter as string] || null,
Maxym Borodenko's avatar
Maxym Borodenko committed
47 48 49 50 51 52 53
});

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

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