mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 17:56:17 +01:00
transfer remove button of each component to a global remove button
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { DeleteButton } from "../../../components/buttons";
|
||||
import { translate } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
groupname: string,
|
||||
removeGroup: string => void,
|
||||
disabled: boolean
|
||||
};
|
||||
|
||||
type State = {};
|
||||
|
||||
class RemoveAdminGroupButton extends React.Component<Props, State> {
|
||||
render() {
|
||||
const { t, groupname, removeGroup, disabled } = this.props;
|
||||
return (
|
||||
<div className={classNames("is-pulled-right")}>
|
||||
<DeleteButton
|
||||
label={t("admin-settings.remove-group-button")}
|
||||
action={(event: Event) => {
|
||||
event.preventDefault();
|
||||
removeGroup(groupname);
|
||||
}}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("config")(RemoveAdminGroupButton);
|
||||
@@ -1,34 +0,0 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { DeleteButton } from "../../../components/buttons";
|
||||
import { translate } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
username: string,
|
||||
removeUser: string => void,
|
||||
disabled: boolean
|
||||
};
|
||||
|
||||
type State = {};
|
||||
|
||||
class RemoveAdminUserButton extends React.Component<Props, State> {
|
||||
render() {
|
||||
const { t, username, removeUser, disabled } = this.props;
|
||||
return (
|
||||
<div className={classNames("is-pulled-right")}>
|
||||
<DeleteButton
|
||||
label={t("admin-settings.remove-user-button")}
|
||||
action={(event: Event) => {
|
||||
event.preventDefault();
|
||||
removeUser(username);
|
||||
}}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("config")(RemoveAdminUserButton);
|
||||
@@ -1,36 +0,0 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import {DeleteButton} from "../../../components/buttons";
|
||||
import { translate } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
proxyExcludeName: string,
|
||||
removeProxyExclude: string => void,
|
||||
disabled: boolean
|
||||
};
|
||||
|
||||
type State = {};
|
||||
|
||||
|
||||
|
||||
class RemoveProxyExcludeButton extends React.Component<Props, State> {
|
||||
render() {
|
||||
const { t , proxyExcludeName, removeProxyExclude} = this.props;
|
||||
return (
|
||||
<div className={classNames("is-pulled-right")}>
|
||||
<DeleteButton
|
||||
label={t("proxy-settings.remove-proxy-exclude-button")}
|
||||
action={(event: Event) => {
|
||||
event.preventDefault();
|
||||
removeProxyExclude(proxyExcludeName);
|
||||
}}
|
||||
disabled={this.props.disabled}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("config")(RemoveProxyExcludeButton);
|
||||
@@ -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");
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import RemoveAdminUserButton from "../buttons/RemoveAdminUserButton";
|
||||
import { RemoveEntryOfTableButton } from "../../../components/buttons";
|
||||
|
||||
type Props = {
|
||||
adminUsers: string[],
|
||||
@@ -25,10 +25,11 @@ class AdminUserTable extends React.Component<Props, State> {
|
||||
<tr key={user}>
|
||||
<td key={user}>{user}</td>
|
||||
<td>
|
||||
<RemoveAdminUserButton
|
||||
username={user}
|
||||
removeUser={this.removeUser}
|
||||
<RemoveEntryOfTableButton
|
||||
entryname={user}
|
||||
removeEntry={this.removeEntry}
|
||||
disabled={disabled}
|
||||
label={t("admin-settings.remove-user-button")}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -40,7 +41,7 @@ class AdminUserTable extends React.Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
removeUser = (username: string) => {
|
||||
removeEntry = (username: string) => {
|
||||
const newUsers = this.props.adminUsers.filter(name => name !== username);
|
||||
this.props.onChange(true, newUsers, "adminUsers");
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import RemoveProxyExcludeButton from "../buttons/RemoveProxyExcludeButton";
|
||||
import { RemoveEntryOfTableButton } from "../../../components/buttons";
|
||||
|
||||
type Props = {
|
||||
proxyExcludes: string[],
|
||||
@@ -25,10 +25,11 @@ class ProxyExcludesTable extends React.Component<Props, State> {
|
||||
<tr key={excludes}>
|
||||
<td key={excludes}>{excludes}</td>
|
||||
<td>
|
||||
<RemoveProxyExcludeButton
|
||||
proxyExcludeName={excludes}
|
||||
removeProxyExclude={this.removeProxyExclude}
|
||||
<RemoveEntryOfTableButton
|
||||
entryname={excludes}
|
||||
removeEntry={this.removeEntry}
|
||||
disabled={this.props.disabled}
|
||||
label={t("proxy-settings.remove-proxy-exclude-button")}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -40,7 +41,7 @@ class ProxyExcludesTable extends React.Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
removeProxyExclude = (excludename: string) => {
|
||||
removeEntry = (excludename: string) => {
|
||||
const newExcludes = this.props.proxyExcludes.filter(
|
||||
name => name !== excludename
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user