Reset fields on click
This commit is contained in:
parent
ff012cf0a3
commit
b8c0ed9335
|
@ -23,6 +23,19 @@ const validate = (values) => {
|
|||
return errors;
|
||||
};
|
||||
|
||||
const clearFields = (change) => {
|
||||
const fields = {
|
||||
private_key: '',
|
||||
certificate_chain: '',
|
||||
port_https: '',
|
||||
port_dns_over_tls: '',
|
||||
server_name: '',
|
||||
force_https: false,
|
||||
enabled: false,
|
||||
};
|
||||
Object.keys(fields).forEach(field => change(field, fields[field]));
|
||||
};
|
||||
|
||||
let Form = (props) => {
|
||||
const {
|
||||
t,
|
||||
|
@ -31,7 +44,7 @@ let Form = (props) => {
|
|||
isEnabled,
|
||||
certificateChain,
|
||||
privateKey,
|
||||
reset,
|
||||
change,
|
||||
invalid,
|
||||
submitting,
|
||||
processing,
|
||||
|
@ -269,7 +282,7 @@ let Form = (props) => {
|
|||
type="button"
|
||||
className="btn btn-secondary btn-standart"
|
||||
disabled={submitting || processing}
|
||||
onClick={reset}
|
||||
onClick={() => clearFields(change)}
|
||||
>
|
||||
<Trans>reset_settings</Trans>
|
||||
</button>
|
||||
|
@ -284,7 +297,7 @@ Form.propTypes = {
|
|||
isEnabled: PropTypes.bool.isRequired,
|
||||
certificateChain: PropTypes.string.isRequired,
|
||||
privateKey: PropTypes.string.isRequired,
|
||||
reset: PropTypes.func.isRequired,
|
||||
change: PropTypes.func.isRequired,
|
||||
submitting: PropTypes.bool.isRequired,
|
||||
invalid: PropTypes.bool.isRequired,
|
||||
initialValues: PropTypes.object.isRequired,
|
||||
|
|
|
@ -81,6 +81,11 @@
|
|||
box-shadow: 0 0 1px 1px rgba(74, 74, 74, 0.32);
|
||||
}
|
||||
|
||||
.checkbox__input:disabled + .checkbox__label {
|
||||
opacity: 0.7;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.checkbox__label-text {
|
||||
max-width: 515px;
|
||||
line-height: 1.5;
|
||||
|
|
Loading…
Reference in New Issue