diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js index a741148fb..afb8afafb 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage.js @@ -13,6 +13,8 @@ import {Link} from 'react-router-dom'; import AuthComponent from '../AuthComponent'; import AwsRunTable from '../run-monkey/AwsRunTable'; +import MissingBinariesModal from '../ui-components/MissingBinariesModal'; + import '../../styles/MonkeyRunPage.scss'; const loading_css_override = css` @@ -40,8 +42,12 @@ class RunMonkeyPageComponent extends AuthComponent { awsMachines: [], isLoadingAws: true, isErrorWhileCollectingAwsMachines: false, - awsMachineCollectionErrorMsg: '' + awsMachineCollectionErrorMsg: '', + showModal: false, + errorDetails: '' }; + + this.closeModal = this.closeModal.bind(this); } componentDidMount() { @@ -130,6 +136,13 @@ class RunMonkeyPageComponent extends AuthComponent { runningOnIslandState: 'installing' }); } else { + /* If Monkey binaries are missing, change the state accordingly */ + if (res['error_text'].startsWith('Copy file failed')) { + this.setState({ + showModal: true, + errorDetails: res['error_text']} + ); + } this.setState({ runningOnIslandState: 'not_running' }); @@ -285,6 +298,12 @@ class RunMonkeyPageComponent extends AuthComponent { ) } + closeModal = () => { + this.setState({ + showModal: false + }) + }; + render() { return ( @@ -296,11 +315,14 @@ class RunMonkeyPageComponent extends AuthComponent {

+ { // TODO: implement button functionality /* diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/MissingBinariesModal.js b/monkey/monkey_island/cc/ui/src/components/ui-components/MissingBinariesModal.js new file mode 100644 index 000000000..c73094fb6 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/MissingBinariesModal.js @@ -0,0 +1,63 @@ +import {Modal} from 'react-bootstrap'; +import React from 'react'; +import {GridLoader} from 'react-spinners'; + + +class MissingBinariesModal extends React.PureComponent { + + constructor(props) { + super(props); + + this.state = { + 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 ( + this.props.onClose()}> + +

+
Uh oh...
+

+
+

+ + Some Monkey binaries are not found where they should be...
+ You can download the files from here, + at the bottommost section titled "Assets", and place them under the directory monkey/monkey_island/cc/binaries. +

+
+
+

+ Error Details +

+
+
+              {this.state.errorDetails}
+            
+
+
+ +
+ + + ) + }; + +} + +export default MissingBinariesModal;