Some initial files for management of segments

This commit is contained in:
Tomas Bures 2017-08-13 20:24:17 +02:00
parent e73c0a8b28
commit b23529a75b
4 changed files with 543 additions and 3 deletions

View file

@ -0,0 +1,54 @@
'use strict';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { translate } from 'react-i18next';
import {requiresAuthenticatedUser, withPageHelpers, Title, Toolbar, NavButton} from '../../lib/page';
import { withErrorHandling } from '../../lib/error-handling';
import { Table } from '../../lib/table';
@translate()
@withPageHelpers
@withErrorHandling
@requiresAuthenticatedUser
export default class List extends Component {
constructor(props) {
super(props);
this.state = {};
}
static propTypes = {
list: PropTypes.object
}
componentDidMount() {
}
render() {
const t = this.props.t;
const columns = [
{ data: 1, title: t('Name') },
{ data: 2, title: t('Match') },
{
actions: data => [{
label: <span className="glyphicon glyphicon-edit" aria-hidden="true" title="Edit"></span>,
link: `/lists/${this.props.list.id}/segments/${data[0]}/edit`
}]
}
];
return (
<div>
<Toolbar>
<NavButton linkTo={`/lists/${this.props.list.id}/segments/create`} className="btn-primary" icon="plus" label={t('Create Segment')}/>
</Toolbar>
<Title>{t('Segment')}</Title>
<Table withHeader dataUrl={`/rest/segments-table/${this.props.list.id}`} columns={columns} />
</div>
);
}
}