提交 ab52700a 编写于 作者: E enahum 提交者: Harrison Healey

PLT-3624 quick fix remove SAML certificates without saving (#3555)

上级 caef414a
......@@ -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
};
}
......
......@@ -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 = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
}
return (
<Setting
label={this.props.label}
......@@ -64,7 +54,6 @@ export default class RemoveFileSetting extends Setting {
>
{this.props.removeButtonText}
</button>
{serverError}
</div>
</Setting>
);
......
......@@ -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}
/>
);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册