Remove button removed from the namespace that contains the current user.
Optimizations in how mixins are composed. The refresh should now be up to 2x faster for deeper hierarchies.
This commit is contained in:
parent
6ae9143c22
commit
a46c8fa9c3
15 changed files with 764 additions and 680 deletions
|
@ -82,9 +82,11 @@ export default class CUD extends Component {
|
|||
this.removeNsIdSubtree(data);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
treeData: data
|
||||
});
|
||||
if (this.isComponentMounted()) {
|
||||
this.setState({
|
||||
treeData: data
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +193,7 @@ export default class CUD extends Component {
|
|||
render() {
|
||||
const t = this.props.t;
|
||||
const isEdit = !!this.props.entity;
|
||||
const canDelete = isEdit && !this.isEditGlobal() && this.props.entity.permissions.includes('delete');
|
||||
const canDelete = isEdit && !this.isEditGlobal() && mailtrainConfig.user.namespace !== this.props.entity.id && this.props.entity.permissions.includes('delete');
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
|
@ -10,6 +10,7 @@ import {checkPermissions} from "../lib/permissions";
|
|||
import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
|
||||
import {getGlobalNamespaceId} from "../../../shared/namespaces";
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
import mailtrainConfig from 'mailtrainConfig';
|
||||
|
||||
@withComponentMixins([
|
||||
withTranslation,
|
||||
|
@ -64,7 +65,8 @@ export default class List extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
if (Number.parseInt(node.key) !== getGlobalNamespaceId()) {
|
||||
const namespaceId = Number.parseInt(node.key);
|
||||
if (namespaceId !== getGlobalNamespaceId() && mailtrainConfig.user.namespace !== namespaceId) {
|
||||
tableAddDeleteButton(actions, this, node.data.permissions, `rest/namespaces/${node.key}`, node.data.unsanitizedTitle, t('deletingNamespace'), t('namespaceDeleted'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue