mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 02:06:18 +01:00
transfer remove button of each component to a global remove button
This commit is contained in:
@@ -4,3 +4,4 @@ export { default as CreateButton } from "./CreateButton";
|
|||||||
export { default as DeleteButton } from "./DeleteButton";
|
export { default as DeleteButton } from "./DeleteButton";
|
||||||
export { default as EditButton } from "./EditButton";
|
export { default as EditButton } from "./EditButton";
|
||||||
export { default as SubmitButton } from "./SubmitButton";
|
export { default as SubmitButton } from "./SubmitButton";
|
||||||
|
export {default as RemoveEntryOfTableButton} from "./RemoveEntryOfTableButton";
|
||||||
|
|||||||
@@ -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
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import RemoveAdminGroupButton from "../buttons/RemoveAdminGroupButton";
|
import { RemoveEntryOfTableButton } from "../../../components/buttons";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
adminGroups: string[],
|
adminGroups: string[],
|
||||||
@@ -25,10 +25,11 @@ class AdminGroupTable extends React.Component<Props, State> {
|
|||||||
<tr key={group}>
|
<tr key={group}>
|
||||||
<td key={group}>{group}</td>
|
<td key={group}>{group}</td>
|
||||||
<td>
|
<td>
|
||||||
<RemoveAdminGroupButton
|
<RemoveEntryOfTableButton
|
||||||
groupname={group}
|
entryname={group}
|
||||||
removeGroup={this.removeGroup}
|
removeEntry={this.removeEntry}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
label={t("admin-settings.remove-group-button")}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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);
|
const newGroups = this.props.adminGroups.filter(name => name !== groupname);
|
||||||
this.props.onChange(true, newGroups, "adminGroups");
|
this.props.onChange(true, newGroups, "adminGroups");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import RemoveAdminUserButton from "../buttons/RemoveAdminUserButton";
|
import { RemoveEntryOfTableButton } from "../../../components/buttons";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
adminUsers: string[],
|
adminUsers: string[],
|
||||||
@@ -25,10 +25,11 @@ class AdminUserTable extends React.Component<Props, State> {
|
|||||||
<tr key={user}>
|
<tr key={user}>
|
||||||
<td key={user}>{user}</td>
|
<td key={user}>{user}</td>
|
||||||
<td>
|
<td>
|
||||||
<RemoveAdminUserButton
|
<RemoveEntryOfTableButton
|
||||||
username={user}
|
entryname={user}
|
||||||
removeUser={this.removeUser}
|
removeEntry={this.removeEntry}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
label={t("admin-settings.remove-user-button")}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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);
|
const newUsers = this.props.adminUsers.filter(name => name !== username);
|
||||||
this.props.onChange(true, newUsers, "adminUsers");
|
this.props.onChange(true, newUsers, "adminUsers");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import RemoveProxyExcludeButton from "../buttons/RemoveProxyExcludeButton";
|
import { RemoveEntryOfTableButton } from "../../../components/buttons";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
proxyExcludes: string[],
|
proxyExcludes: string[],
|
||||||
@@ -25,10 +25,11 @@ class ProxyExcludesTable extends React.Component<Props, State> {
|
|||||||
<tr key={excludes}>
|
<tr key={excludes}>
|
||||||
<td key={excludes}>{excludes}</td>
|
<td key={excludes}>{excludes}</td>
|
||||||
<td>
|
<td>
|
||||||
<RemoveProxyExcludeButton
|
<RemoveEntryOfTableButton
|
||||||
proxyExcludeName={excludes}
|
entryname={excludes}
|
||||||
removeProxyExclude={this.removeProxyExclude}
|
removeEntry={this.removeEntry}
|
||||||
disabled={this.props.disabled}
|
disabled={this.props.disabled}
|
||||||
|
label={t("proxy-settings.remove-proxy-exclude-button")}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -40,7 +41,7 @@ class ProxyExcludesTable extends React.Component<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeProxyExclude = (excludename: string) => {
|
removeEntry = (excludename: string) => {
|
||||||
const newExcludes = this.props.proxyExcludes.filter(
|
const newExcludes = this.props.proxyExcludes.filter(
|
||||||
name => name !== excludename
|
name => name !== excludename
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user