remove unsued imports and disable editing if proxy is disabled

This commit is contained in:
Maren Süwer
2018-08-16 11:26:45 +02:00
parent 0452b95d10
commit d2c8560609
5 changed files with 30 additions and 21 deletions

View File

@@ -7,7 +7,8 @@ import classNames from "classnames";
type Props = { type Props = {
t: string => string, t: string => string,
proxyExcludeName: string, proxyExcludeName: string,
removeProxyExclude: string => void removeProxyExclude: string => void,
disable: boolean
}; };
type State = {}; type State = {};
@@ -25,6 +26,7 @@ class RemoveProxyExcludeButton extends React.Component<Props, State> {
event.preventDefault(); event.preventDefault();
removeProxyExclude(proxyExcludeName); removeProxyExclude(proxyExcludeName);
}} }}
disabled={this.props.disable}
/> />
</div> </div>
); );

View File

@@ -7,7 +7,8 @@ import InputField from "../../../components/forms/InputField";
type Props = { type Props = {
t: string => string, t: string => string,
addProxyExclude: string => void addProxyExclude: string => void,
disable: boolean
}; };
type State = { type State = {
@@ -36,10 +37,12 @@ class AddProxyExcludeField extends React.Component<Props, State> {
validationError={false} validationError={false}
value={this.state.proxyExcludeToAdd} value={this.state.proxyExcludeToAdd}
onReturnPressed={this.appendProxyExclude} onReturnPressed={this.appendProxyExclude}
disable={this.props.disable}
/> />
<AddButton <AddButton
label={t("proxy-settings.add-proxy-exclude-button")} label={t("proxy-settings.add-proxy-exclude-button")}
action={this.addButtonClicked} action={this.addButtonClicked}
disabled={this.props.disable}
//disabled={!isMemberNameValid(this.state.memberToAdd)} //disabled={!isMemberNameValid(this.state.memberToAdd)}
/> />
</div> </div>

View File

@@ -3,7 +3,6 @@ import React from "react";
import { translate } from "react-i18next"; import { translate } from "react-i18next";
import Subtitle from "../../../components/layout/Subtitle"; import Subtitle from "../../../components/layout/Subtitle";
import AdminGroupTable from "../table/AdminGroupTable"; import AdminGroupTable from "../table/AdminGroupTable";
import ProxySettings from "./ProxySettings";
import AdminUserTable from "../table/AdminUserTable"; import AdminUserTable from "../table/AdminUserTable";
import AddAdminGroupField from "../fields/AddAdminGroupField"; import AddAdminGroupField from "../fields/AddAdminGroupField";
import AddAdminUserField from "../fields/AddAdminUserField"; import AddAdminUserField from "../fields/AddAdminUserField";

View File

@@ -66,8 +66,9 @@ class ProxySettings extends React.Component<Props> {
onChange={(isValid, changedValue, name) => onChange={(isValid, changedValue, name) =>
this.props.onChange(isValid, changedValue, name) this.props.onChange(isValid, changedValue, name)
} }
disable={!enableProxy}
/> />
<AddProxyExcludeField addProxyExclude={this.addProxyExclude} /> <AddProxyExcludeField addProxyExclude={this.addProxyExclude} disable={!enableProxy}/>
</div> </div>
); );
} }

View File

@@ -6,7 +6,8 @@ import RemoveProxyExcludeButton from "../buttons/RemoveProxyExcludeButton";
type Props = { type Props = {
proxyExcludes: string[], proxyExcludes: string[],
t: string => string, t: string => string,
onChange: (boolean, any, string) => void onChange: (boolean, any, string) => void,
disable: boolean
}; };
type State = {}; type State = {};
@@ -27,6 +28,7 @@ class ProxyExcludesTable extends React.Component<Props, State> {
<RemoveProxyExcludeButton <RemoveProxyExcludeButton
proxyExcludeName={excludes} proxyExcludeName={excludes}
removeProxyExclude={this.removeProxyExclude} removeProxyExclude={this.removeProxyExclude}
disable={this.props.disable}
/> />
</td> </td>
</tr> </tr>
@@ -39,7 +41,9 @@ class ProxyExcludesTable extends React.Component<Props, State> {
} }
removeProxyExclude = (excludename: string) => { removeProxyExclude = (excludename: string) => {
const newExcludes = this.props.proxyExcludes.filter(name => name !== excludename); const newExcludes = this.props.proxyExcludes.filter(
name => name !== excludename
);
this.props.onChange(true, newExcludes, "proxyExcludes"); this.props.onChange(true, newExcludes, "proxyExcludes");
}; };
} }