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

View File

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