Raise a modal indicating that Monkey binaries are missing.

This commit is contained in:
ophirharpazg 2020-05-27 19:32:09 +03:00
parent e1229baa61
commit a4d4f629e0
2 changed files with 34 additions and 10 deletions

View File

@ -43,7 +43,8 @@ class RunMonkeyPageComponent extends AuthComponent {
isLoadingAws: true,
isErrorWhileCollectingAwsMachines: false,
awsMachineCollectionErrorMsg: '',
showModal: false
showModal: false,
errorDetails: ''
};
this.closeModal = this.closeModal.bind(this);
@ -138,7 +139,8 @@ class RunMonkeyPageComponent extends AuthComponent {
/* If Monkey binaries are missing, change the state accordingly */
if (res['error_text'].startsWith('Copy file failed')) {
this.setState({
showModal: true}
showModal: true,
errorDetails: res['error_text']}
);
}
this.setState({
@ -320,7 +322,7 @@ class RunMonkeyPageComponent extends AuthComponent {
<MissingBinariesModal
showModal = {this.state.showModal}
onClose = {this.closeModal}
onVerify = {this.cleanup}/>
errorDetails = {this.state.errorDetails}/>
{
// TODO: implement button functionality
/*

View File

@ -9,22 +9,44 @@ class MissingBinariesModal extends React.PureComponent {
super(props);
this.state = {
showModal: this.props.showModal
showModal: this.props.showModal,
errorDetails: this.props.errorDetails
};
}
componentDidUpdate(prevProps) {
if (this.props !== prevProps) {
this.setState({
showModal: this.props.showModal,
errorDetails: this.props.errorDetails
})
}
}
render = () => {
return (
<Modal show={this.props.showModal} onHide={() => this.props.onClose()}>
<Modal show={this.state.showModal} onHide={() => this.props.onClose()}>
<Modal.Body>
<h3>
<div className='text-center'>Uh oh...</div>
</h3>
<p style={{'fontSize': '1.2em', 'marginBottom': '2em'}}>
Some Monkey binaries are not found where they should be...{"\r\n"}
Try downloading them from <a href="https://github.com/guardicore/monkey/releases/latest" target="blank">here</a>,
at the bottommost section titled "Assets".
</p>
<div style={{'marginTop': '1em', 'marginBottom': '1em'}}>
<p className="alert alert-warning">
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
Some Monkey binaries are not found where they should be...<br/>
Try downloading them from <a href="https://github.com/guardicore/monkey/releases/latest" target="blank">here</a>,
at the bottommost section titled "Assets".
</p>
</div>
<hr/>
<h4>
Error Details
</h4>
<div style={{'marginTop': '1em', 'marginBottom': '1em'}}>
<pre>
{this.state.errorDetails}
</pre>
</div>
<div className='text-center'>
<button type='button' className='btn btn-success btn-lg' style={{margin: '5px'}}
onClick={() => this.props.onClose()}>