2018-08-16 11:18:28 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { translate } from "react-i18next";
|
|
|
|
|
import RemoveProxyExcludeButton from "../buttons/RemoveProxyExcludeButton";
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
proxyExcludes: string[],
|
|
|
|
|
t: string => string,
|
2018-08-16 11:26:45 +02:00
|
|
|
onChange: (boolean, any, string) => void,
|
2018-08-16 12:12:59 +02:00
|
|
|
disabled: boolean
|
2018-08-16 11:18:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type State = {};
|
|
|
|
|
|
|
|
|
|
class ProxyExcludesTable extends React.Component<Props, State> {
|
|
|
|
|
render() {
|
|
|
|
|
const { t } = this.props;
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<label className="label">{t("proxy-settings.proxy-excludes")}</label>
|
|
|
|
|
<table className="table is-hoverable is-fullwidth">
|
|
|
|
|
<tbody>
|
2018-08-16 11:26:45 +02:00
|
|
|
{this.props.proxyExcludes.map(excludes => {
|
|
|
|
|
return (
|
|
|
|
|
<tr key={excludes}>
|
|
|
|
|
<td key={excludes}>{excludes}</td>
|
|
|
|
|
<td>
|
|
|
|
|
<RemoveProxyExcludeButton
|
|
|
|
|
proxyExcludeName={excludes}
|
|
|
|
|
removeProxyExclude={this.removeProxyExclude}
|
2018-08-16 12:12:59 +02:00
|
|
|
disabled={this.props.disabled}
|
2018-08-16 11:26:45 +02:00
|
|
|
/>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2018-08-16 11:18:28 +02:00
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeProxyExclude = (excludename: string) => {
|
2018-08-16 11:26:45 +02:00
|
|
|
const newExcludes = this.props.proxyExcludes.filter(
|
|
|
|
|
name => name !== excludename
|
|
|
|
|
);
|
2018-08-16 11:18:28 +02:00
|
|
|
this.props.onChange(true, newExcludes, "proxyExcludes");
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate("config")(ProxyExcludesTable);
|