* disable config saving if invalid pair

This commit is contained in:
Ildar Kamalov 2019-02-28 14:59:25 +03:00
parent 224c2a891d
commit b8595b87c4
2 changed files with 13 additions and 9 deletions

View File

@ -57,6 +57,7 @@ let Form = (props) => {
valid_chain, valid_chain,
valid_key, valid_key,
valid_cert, valid_cert,
valid_pair,
dns_names, dns_names,
key_type, key_type,
issuer, issuer,
@ -65,6 +66,15 @@ let Form = (props) => {
setTlsConfig, setTlsConfig,
} = props; } = props;
const isSavingDisabled = invalid
|| submitting
|| processingConfig
|| processingValidate
|| (isEnabled && (!privateKey || !certificateChain))
|| (privateKey && !valid_key)
|| (certificateChain && !valid_cert)
|| (privateKey && certificateChain && !valid_pair);
return ( return (
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<div className="row"> <div className="row">
@ -291,15 +301,7 @@ let Form = (props) => {
<button <button
type="submit" type="submit"
className="btn btn-success btn-standart" className="btn btn-success btn-standart"
disabled={ disabled={isSavingDisabled}
invalid
|| submitting
|| processingConfig
|| processingValidate
|| (isEnabled && (!privateKey || !certificateChain))
|| (privateKey && !valid_key)
|| (certificateChain && !valid_cert)
}
> >
<Trans>save_config</Trans> <Trans>save_config</Trans>
</button> </button>
@ -334,6 +336,7 @@ Form.propTypes = {
valid_chain: PropTypes.bool, valid_chain: PropTypes.bool,
valid_key: PropTypes.bool, valid_key: PropTypes.bool,
valid_cert: PropTypes.bool, valid_cert: PropTypes.bool,
valid_pair: PropTypes.bool,
dns_names: PropTypes.string, dns_names: PropTypes.string,
key_type: PropTypes.string, key_type: PropTypes.string,
issuer: PropTypes.string, issuer: PropTypes.string,

View File

@ -70,6 +70,7 @@ const encryption = handleActions({
valid_chain: false, valid_chain: false,
valid_key: false, valid_key: false,
valid_cert: false, valid_cert: false,
valid_pair: false,
status_cert: '', status_cert: '',
status_key: '', status_key: '',
certificate_chain: '', certificate_chain: '',