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:
Stanislav Chzhen 2023-09-15 17:48:21 +03:00
parent a59fca2da3
commit 5c20bf7cd4
2 changed files with 6 additions and 2 deletions

View File

@ -34,7 +34,7 @@ const validate = (values) => {
return errors;
};
const clearFields = (change, setTlsConfig, t) => {
const clearFields = (change, setTlsConfig, validateTlsConfig, t) => {
const fields = {
private_key: '',
certificate_chain: '',
@ -53,6 +53,7 @@ const clearFields = (change, setTlsConfig, t) => {
Object.keys(fields)
.forEach((field) => change(field, fields[field]));
setTlsConfig(fields);
validateTlsConfig(fields);
}
};
@ -102,6 +103,7 @@ let Form = (props) => {
subject,
warning_validation,
setTlsConfig,
validateTlsConfig,
certificateSource,
privateKeySource,
privateKeySaved,
@ -419,7 +421,7 @@ let Form = (props) => {
type="button"
className="btn btn-secondary btn-standart"
disabled={submitting || processingConfig}
onClick={() => clearFields(change, setTlsConfig, t)}
onClick={() => clearFields(change, setTlsConfig, validateTlsConfig, t)}
>
<Trans>reset_settings</Trans>
</button>
@ -455,6 +457,7 @@ Form.propTypes = {
subject: PropTypes.string,
t: PropTypes.func.isRequired,
setTlsConfig: PropTypes.func.isRequired,
validateTlsConfig: PropTypes.func.isRequired,
certificateSource: PropTypes.string,
privateKeySource: PropTypes.string,
privateKeySaved: PropTypes.bool,

View File

@ -116,6 +116,7 @@ class Encryption extends Component {
onSubmit={this.handleFormSubmit}
onChange={this.handleFormChange}
setTlsConfig={this.props.setTlsConfig}
validateTlsConfig={this.props.validateTlsConfig}
{...this.props.encryption}
/>
</Card>