Files
SCM-Manager/scm-ui/src/config/components/table/ProxyExcludesTable.js

52 lines
1.4 KiB
JavaScript
Raw Normal View History

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,
onChange: (boolean, any, string) => void,
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>
{this.props.proxyExcludes.map(excludes => {
return (
<tr key={excludes}>
<td key={excludes}>{excludes}</td>
<td>
<RemoveProxyExcludeButton
proxyExcludeName={excludes}
removeProxyExclude={this.removeProxyExclude}
disabled={this.props.disabled}
/>
</td>
</tr>
);
})}
2018-08-16 11:18:28 +02:00
</tbody>
</table>
</div>
);
}
removeProxyExclude = (excludename: string) => {
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);