Blacklist functionality
Some API improvements
This commit is contained in:
parent
c343e4efd3
commit
9203b5cee7
40 changed files with 726 additions and 398 deletions
|
|
@ -52,7 +52,7 @@ export default class CUD extends Component {
|
|||
email: '',
|
||||
password: '',
|
||||
password2: '',
|
||||
namespace: null
|
||||
namespace: mailtrainConfig.user.namespace
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ export default class CUD extends Component {
|
|||
const t = this.props.t;
|
||||
const isEdit = !!this.props.entity;
|
||||
const userId = this.getFormValue('id');
|
||||
const canDelete = userId !== 1 && mailtrainConfig.userId !== userId;
|
||||
const canDelete = isEdit && userId !== 1 && mailtrainConfig.user.id !== userId;
|
||||
|
||||
const rolesColumns = [
|
||||
{ data: 1, title: "Name" },
|
||||
|
|
@ -192,7 +192,7 @@ export default class CUD extends Component {
|
|||
|
||||
return (
|
||||
<div>
|
||||
{isEdit && canDelete &&
|
||||
{canDelete &&
|
||||
<DeleteModalDialog
|
||||
stateOwner={this}
|
||||
visible={this.props.action === 'delete'}
|
||||
|
|
@ -220,7 +220,7 @@ export default class CUD extends Component {
|
|||
|
||||
<ButtonRow>
|
||||
<Button type="submit" className="btn-primary" icon="ok" label={t('Save')}/>
|
||||
{isEdit && canDelete && <NavButton className="btn-danger" icon="remove" label={t('Delete User')} linkTo={`/users/${this.props.entity.id}/delete`}/>}
|
||||
{canDelete && <NavButton className="btn-danger" icon="remove" label={t('Delete User')} linkTo={`/users/${this.props.entity.id}/delete`}/>}
|
||||
</ButtonRow>
|
||||
</Form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { translate } from 'react-i18next';
|
||||
import { requiresAuthenticatedUser, withPageHelpers, Title, Toolbar, NavButton } from '../lib/page';
|
||||
import { Table } from '../lib/table';
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
import React, {Component} from "react";
|
||||
import {translate} from "react-i18next";
|
||||
import {NavButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from "../lib/page";
|
||||
import {Table} from "../lib/table";
|
||||
import mailtrainConfig from "mailtrainConfig";
|
||||
import {Icon} from "../lib/bootstrap-components";
|
||||
|
||||
@translate()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const getStructure = t => {
|
|||
users: {
|
||||
title: t('Users'),
|
||||
link: '/users',
|
||||
component: List,
|
||||
panelComponent: List,
|
||||
children: {
|
||||
':userId([0-9]+)': {
|
||||
title: resolved => t('User "{{name}}"', {name: resolved.user.name}),
|
||||
|
|
@ -31,18 +31,18 @@ const getStructure = t => {
|
|||
':action(edit|delete)': {
|
||||
title: t('Edit'),
|
||||
link: params => `/users/${params.userId}/edit`,
|
||||
render: props => <CUD action={props.match.params.action} entity={props.resolved.user} />
|
||||
panelRender: props => <CUD action={props.match.params.action} entity={props.resolved.user} />
|
||||
},
|
||||
shares: {
|
||||
title: t('Shares'),
|
||||
link: params => `/users/${params.userId}/shares`,
|
||||
render: props => <UserShares user={props.resolved.user} />
|
||||
panelRender: props => <UserShares user={props.resolved.user} />
|
||||
}
|
||||
}
|
||||
},
|
||||
create: {
|
||||
title: t('Create'),
|
||||
render: props => <CUD action="create" />
|
||||
panelRender: props => <CUD action="create" />
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -56,6 +56,6 @@ export default function() {
|
|||
<I18nextProvider i18n={ i18n }><Section root='/users' structure={getStructure}/></I18nextProvider>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue