|
|
@@ -16,6 +16,7 @@ type Props = {
|
|
|
childUserGroups: IUserGroupHasId[],
|
|
|
isAclEnabled: boolean,
|
|
|
onEdit?: (userGroup: IUserGroupHasId) => void | Promise<void>,
|
|
|
+ onRemove?: (userGroup: IUserGroupHasId) => void | Promise<void>,
|
|
|
onDelete?: (userGroup: IUserGroupHasId) => void | Promise<void>,
|
|
|
};
|
|
|
|
|
|
@@ -86,6 +87,19 @@ const UserGroupTable: FC<Props> = (props: Props) => {
|
|
|
props.onEdit(userGroup);
|
|
|
};
|
|
|
|
|
|
+ const onClickRemove = (e) => {
|
|
|
+ if (props.onRemove == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const userGroup = findUserGroup(e);
|
|
|
+ if (userGroup == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ props.onRemove(userGroup);
|
|
|
+ };
|
|
|
+
|
|
|
const onClickDelete = (e) => { // no preventDefault
|
|
|
if (props.onDelete == null) {
|
|
|
return;
|
|
|
@@ -179,6 +193,9 @@ const UserGroupTable: FC<Props> = (props: Props) => {
|
|
|
<button className="dropdown-item" type="button" role="button" onClick={onClickEdit} data-user-group-id={group._id}>
|
|
|
<i className="icon-fw icon-note"></i> {t('Edit')}
|
|
|
</button>
|
|
|
+ <button className="dropdown-item" type="button" role="button" onClick={onClickRemove} data-user-group-id={group._id}>
|
|
|
+ <i className="icon-fw fa fa-chain-broken"></i> {t('Remove')}
|
|
|
+ </button>
|
|
|
<button className="dropdown-item" type="button" role="button" onClick={onClickDelete} data-user-group-id={group._id}>
|
|
|
<i className="icon-fw icon-fire text-danger"></i> {t('Delete')}
|
|
|
</button>
|