mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 23:15:43 +01:00
add proxy exclude view and edit
This commit is contained in:
71
scm-ui/src/config/components/fields/AddProxyExcludeField.js
Normal file
71
scm-ui/src/config/components/fields/AddProxyExcludeField.js
Normal file
@@ -0,0 +1,71 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
|
||||
import { translate } from "react-i18next";
|
||||
import { AddButton } from "../../../components/buttons";
|
||||
import InputField from "../../../components/forms/InputField";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
addProxyExclude: string => void
|
||||
};
|
||||
|
||||
type State = {
|
||||
proxyExcludeToAdd: string,
|
||||
//validationError: boolean
|
||||
};
|
||||
|
||||
class AddProxyExcludeField extends React.Component<Props, State> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
proxyExcludeToAdd: "",
|
||||
//validationError: false
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
return (
|
||||
<div className="field">
|
||||
<InputField
|
||||
|
||||
label={t("proxy-settings.add-proxy-exclude-textfield")}
|
||||
errorMessage={t("proxy-settings.add-proxy-exclude-error")}
|
||||
onChange={this.handleAddProxyExcludeChange}
|
||||
validationError={false}
|
||||
value={this.state.proxyExcludeToAdd}
|
||||
onReturnPressed={this.appendProxyExclude}
|
||||
/>
|
||||
<AddButton
|
||||
label={t("proxy-settings.add-proxy-exclude-button")}
|
||||
action={this.addButtonClicked}
|
||||
//disabled={!isMemberNameValid(this.state.memberToAdd)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
addButtonClicked = (event: Event) => {
|
||||
event.preventDefault();
|
||||
this.appendProxyExclude();
|
||||
};
|
||||
|
||||
appendProxyExclude = () => {
|
||||
const { proxyExcludeToAdd } = this.state;
|
||||
//if (isMemberNameValid(memberToAdd)) {
|
||||
this.props.addProxyExclude(proxyExcludeToAdd);
|
||||
this.setState({ ...this.state, proxyExcludeToAdd: "" });
|
||||
// }
|
||||
};
|
||||
|
||||
handleAddProxyExcludeChange = (username: string) => {
|
||||
this.setState({
|
||||
...this.state,
|
||||
proxyExcludeToAdd: username,
|
||||
//validationError: membername.length > 0 && !isMemberNameValid(membername)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("config")(AddProxyExcludeField);
|
||||
Reference in New Issue
Block a user