From 5c20bf7cd4b0f075a12fa0450fd36dc5849551e1 Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Fri, 15 Sep 2023 17:48:21 +0300 Subject: [PATCH] Pull request 2016: 6217-warning-validation Squashed commit of the following: commit 50c3b548511f1815a80977f55d96120c275d3cd1 Author: Stanislav Chzhen Date: Fri Sep 15 16:49:42 2023 +0300 client: fix warning validation --- client/src/components/Settings/Encryption/Form.js | 7 +++++-- client/src/components/Settings/Encryption/index.js | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/components/Settings/Encryption/Form.js b/client/src/components/Settings/Encryption/Form.js index 9df440aa..de7a7158 100644 --- a/client/src/components/Settings/Encryption/Form.js +++ b/client/src/components/Settings/Encryption/Form.js @@ -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)} > reset_settings @@ -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, diff --git a/client/src/components/Settings/Encryption/index.js b/client/src/components/Settings/Encryption/index.js index bcd2d323..4e4cef67 100644 --- a/client/src/components/Settings/Encryption/index.js +++ b/client/src/components/Settings/Encryption/index.js @@ -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} />