mailtrain/client/src/reports/List.js
Tomas Bures 3f7b428546 Reports halfway through
Datatable now correctly handles the situation when user is not logged in and access protected resources
2017-07-09 23:16:47 +02:00

40 lines
No EOL
1.2 KiB
JavaScript

'use strict';
import React, { Component } from 'react';
import { translate } from 'react-i18next';
import { Title, Toolbar, NavButton } from '../lib/page';
import { Table } from '../lib/table';
import moment from 'moment';
@translate()
export default class List extends Component {
render() {
const t = this.props.t;
const actionLinks = [{
label: 'Edit',
link: data => '/reports/edit/' + data[0]
}];
const columns = [
{ data: 0, title: "#" },
{ data: 1, title: t('Name') },
{ data: 2, title: t('Template') },
{ data: 3, title: t('Description') },
{ data: 4, title: t('Created'), render: data => moment(data).fromNow() }
];
return (
<div>
<Toolbar>
<NavButton linkTo="/reports/create" className="btn-primary" icon="plus" label={t('Create Report')}/>
<NavButton linkTo="/reports/templates" className="btn-primary" label={t('Report Templates')}/>
</Toolbar>
<Title>{t('Reports')}</Title>
<Table withHeader dataUrl="/rest/reports-table" columns={columns} actionLinks={actionLinks} />
</div>
);
}
}