'use strict'; import React, {Component} from "react"; import {withTranslation} from '../lib/i18n'; import { NavButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers } from "../lib/page"; import {Table} from "../lib/table"; import mailtrainConfig from "mailtrainConfig"; import {Icon} from "../lib/bootstrap-components"; import { tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender } from "../lib/modals"; import {withComponentMixins} from "../lib/decorator-helpers"; @withComponentMixins([ withTranslation, withPageHelpers, requiresAuthenticatedUser ]) export default class List extends Component { constructor(props) { super(props); this.state = {}; tableRestActionDialogInit(this); } render() { // There are no permissions checks here because this page makes no sense for anyone who does not have manageUsers permission // Once someone has this permission, then all on this page can be used. const t = this.props.t; const columns = [ { data: 1, title: "Username" }, ]; if (mailtrainConfig.isAuthMethodLocal) { columns.push({ data: 2, title: "Full Name" }); } columns.push({ data: 3, title: "Namespace" }); columns.push({ data: 4, title: "Role" }); columns.push({ actions: data => { const actions = []; actions.push({ label: , link: `/users/${data[0]}/edit` }); actions.push({ label: , link: `/users/${data[0]}/shares` }); tableAddDeleteButton(actions, this, null, `rest/users/${data[0]}`, data[1], t('deletingUser'), t('userDeleted')); return actions; } }); return (
{tableRestActionDialogRender(this)} {t('users')} this.table = node} withHeader dataUrl="rest/users-table" columns={columns} /> ); } }