From ab52700aaa76a5623de23cd0156f5dbd9a24e264 Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 12 Jul 2016 16:10:04 -0400 Subject: PLT-3624 quick fix remove SAML certificates without saving (#3555) --- webapp/components/admin_console/file_upload_setting.jsx | 6 ++++-- webapp/components/admin_console/remove_file_setting.jsx | 13 +------------ webapp/components/admin_console/saml_settings.jsx | 10 +++++++--- 3 files changed, 12 insertions(+), 17 deletions(-) (limited to 'webapp') diff --git a/webapp/components/admin_console/file_upload_setting.jsx b/webapp/components/admin_console/file_upload_setting.jsx index e7cb387ee..a7df16c0a 100644 --- a/webapp/components/admin_console/file_upload_setting.jsx +++ b/webapp/components/admin_console/file_upload_setting.jsx @@ -18,7 +18,8 @@ export default class FileUploadSetting extends Setting { uploadingText: React.PropTypes.node, onSubmit: React.PropTypes.func.isRequired, disabled: React.PropTypes.bool, - fileType: React.PropTypes.string.isRequired + fileType: React.PropTypes.string.isRequired, + error: React.PropTypes.string }; } @@ -29,7 +30,8 @@ export default class FileUploadSetting extends Setting { this.handleSubmit = this.handleSubmit.bind(this); this.state = { - fileName: null + fileName: null, + serverError: props.error }; } diff --git a/webapp/components/admin_console/remove_file_setting.jsx b/webapp/components/admin_console/remove_file_setting.jsx index 5a76faae2..9a6266a62 100644 --- a/webapp/components/admin_console/remove_file_setting.jsx +++ b/webapp/components/admin_console/remove_file_setting.jsx @@ -23,28 +23,18 @@ export default class RemoveFileSetting extends Setting { constructor(props) { super(props); this.handleRemove = this.handleRemove.bind(this); - - this.state = { - serverError: null - }; } handleRemove(e) { e.preventDefault(); $(this.refs.remove_button).button('loading'); - this.props.onSubmit(this.props.id, (error) => { + this.props.onSubmit(this.props.id, () => { $(this.refs.remove_button).button('reset'); - this.setState({serverError: error}); }); } render() { - let serverError; - if (this.state.serverError) { - serverError =
; - } - return ( {this.props.removeButtonText} - {serverError} ); diff --git a/webapp/components/admin_console/saml_settings.jsx b/webapp/components/admin_console/saml_settings.jsx index 611c37192..5fba78b75 100644 --- a/webapp/components/admin_console/saml_settings.jsx +++ b/webapp/components/admin_console/saml_settings.jsx @@ -76,7 +76,7 @@ export default class SamlSettings extends AdminSettings { () => { const fileName = file.name; this.handleChange(id, fileName); - this.setState({[id]: fileName}); + this.setState({[id]: fileName, [`${id}Error`]: null}); if (callback && typeof callback === 'function') { callback(); } @@ -94,12 +94,13 @@ export default class SamlSettings extends AdminSettings { this.state[id], () => { this.handleChange(id, ''); - this.setState({[id]: null}); + this.setState({[id]: null, [`${id}Error`]: null}); }, (error) => { if (callback && typeof callback === 'function') { - callback(error.message); + callback(); } + this.setState({[id]: null, [`${id}Error`]: error.message}); } ); } @@ -168,6 +169,7 @@ export default class SamlSettings extends AdminSettings { disabled={!this.state.enable} fileType='.crt,.cer' onSubmit={this.uploadCertificate} + error={this.state.idpCertificateFileError} /> ); } @@ -215,6 +217,7 @@ export default class SamlSettings extends AdminSettings { disabled={!this.state.enable || !this.state.encrypt} fileType='.key' onSubmit={this.uploadCertificate} + error={this.state.privateKeyFileError} /> ); } @@ -262,6 +265,7 @@ export default class SamlSettings extends AdminSettings { disabled={!this.state.enable || !this.state.encrypt} fileType='.crt,.cer' onSubmit={this.uploadCertificate} + error={this.state.publicCertificateFileError} /> ); } -- cgit v1.2.3-1-g7c22