Pull request 2016: 6217-warning-validation
Squashed commit of the following: commit 50c3b548511f1815a80977f55d96120c275d3cd1 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Sep 15 16:49:42 2023 +0300 client: fix warning validation
This commit is contained in:
parent
a59fca2da3
commit
5c20bf7cd4
|
@ -34,7 +34,7 @@ const validate = (values) => {
|
||||||
return errors;
|
return errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearFields = (change, setTlsConfig, t) => {
|
const clearFields = (change, setTlsConfig, validateTlsConfig, t) => {
|
||||||
const fields = {
|
const fields = {
|
||||||
private_key: '',
|
private_key: '',
|
||||||
certificate_chain: '',
|
certificate_chain: '',
|
||||||
|
@ -53,6 +53,7 @@ const clearFields = (change, setTlsConfig, t) => {
|
||||||
Object.keys(fields)
|
Object.keys(fields)
|
||||||
.forEach((field) => change(field, fields[field]));
|
.forEach((field) => change(field, fields[field]));
|
||||||
setTlsConfig(fields);
|
setTlsConfig(fields);
|
||||||
|
validateTlsConfig(fields);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,6 +103,7 @@ let Form = (props) => {
|
||||||
subject,
|
subject,
|
||||||
warning_validation,
|
warning_validation,
|
||||||
setTlsConfig,
|
setTlsConfig,
|
||||||
|
validateTlsConfig,
|
||||||
certificateSource,
|
certificateSource,
|
||||||
privateKeySource,
|
privateKeySource,
|
||||||
privateKeySaved,
|
privateKeySaved,
|
||||||
|
@ -419,7 +421,7 @@ let Form = (props) => {
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-secondary btn-standart"
|
className="btn btn-secondary btn-standart"
|
||||||
disabled={submitting || processingConfig}
|
disabled={submitting || processingConfig}
|
||||||
onClick={() => clearFields(change, setTlsConfig, t)}
|
onClick={() => clearFields(change, setTlsConfig, validateTlsConfig, t)}
|
||||||
>
|
>
|
||||||
<Trans>reset_settings</Trans>
|
<Trans>reset_settings</Trans>
|
||||||
</button>
|
</button>
|
||||||
|
@ -455,6 +457,7 @@ Form.propTypes = {
|
||||||
subject: PropTypes.string,
|
subject: PropTypes.string,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
setTlsConfig: PropTypes.func.isRequired,
|
setTlsConfig: PropTypes.func.isRequired,
|
||||||
|
validateTlsConfig: PropTypes.func.isRequired,
|
||||||
certificateSource: PropTypes.string,
|
certificateSource: PropTypes.string,
|
||||||
privateKeySource: PropTypes.string,
|
privateKeySource: PropTypes.string,
|
||||||
privateKeySaved: PropTypes.bool,
|
privateKeySaved: PropTypes.bool,
|
||||||
|
|
|
@ -116,6 +116,7 @@ class Encryption extends Component {
|
||||||
onSubmit={this.handleFormSubmit}
|
onSubmit={this.handleFormSubmit}
|
||||||
onChange={this.handleFormChange}
|
onChange={this.handleFormChange}
|
||||||
setTlsConfig={this.props.setTlsConfig}
|
setTlsConfig={this.props.setTlsConfig}
|
||||||
|
validateTlsConfig={this.props.validateTlsConfig}
|
||||||
{...this.props.encryption}
|
{...this.props.encryption}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
Loading…
Reference in New Issue