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

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

View File

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

View File

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

View File

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

View File

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