transfer remove button of each component to a global remove button

This commit is contained in:
Maren Süwer
2018-08-21 11:27:35 +02:00
parent cd0c1a5f2a
commit 68f62b9b05
7 changed files with 19 additions and 119 deletions

View File

@@ -1,7 +1,7 @@
//@flow
import React from "react";
import { translate } from "react-i18next";
import RemoveAdminGroupButton from "../buttons/RemoveAdminGroupButton";
import { RemoveEntryOfTableButton } from "../../../components/buttons";
type Props = {
adminGroups: string[],
@@ -25,10 +25,11 @@ class AdminGroupTable extends React.Component<Props, State> {
<tr key={group}>
<td key={group}>{group}</td>
<td>
<RemoveAdminGroupButton
groupname={group}
removeGroup={this.removeGroup}
<RemoveEntryOfTableButton
entryname={group}
removeEntry={this.removeEntry}
disabled={disabled}
label={t("admin-settings.remove-group-button")}
/>
</td>
</tr>
@@ -40,7 +41,7 @@ class AdminGroupTable extends React.Component<Props, State> {
);
}
removeGroup = (groupname: string) => {
removeEntry = (groupname: string) => {
const newGroups = this.props.adminGroups.filter(name => name !== groupname);
this.props.onChange(true, newGroups, "adminGroups");
};