diff --git a/monkey_island/cc/ui/src/components/pages/StartOverPage.js b/monkey_island/cc/ui/src/components/pages/StartOverPage.js index 6ecb2cc69..0152c9b61 100644 --- a/monkey_island/cc/ui/src/components/pages/StartOverPage.js +++ b/monkey_island/cc/ui/src/components/pages/StartOverPage.js @@ -1,19 +1,71 @@ import React from 'react'; import {Col} from 'react-bootstrap'; import {Link} from 'react-router-dom'; +import {ModalContainer, ModalDialog} from 'react-modal-dialog'; class StartOverPageComponent extends React.Component { constructor(props) { super(props); this.state = { - cleaned: false + cleaned: false, + showCleanDialog: false, + allMonkeysAreDead: false }; } + updateMonkeysRunning = () => { + fetch('/api') + .then(res => res.json()) + .then(res => { + // This check is used to prevent unnecessary re-rendering + this.setState({ + allMonkeysAreDead: (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done']) + }); + }); + }; + + renderCleanDialogModal = () => { + if (!this.state.showCleanDialog) { + return
+ } + + return ( ++ Are you sure you want to reset the environment? +
+ { + !this.state.allMonkeysAreDead ? +@@ -23,19 +75,26 @@ class StartOverPageComponent extends React.Component {
After that you could go back to the Run Monkey page to start new infections.
-+
+- * BTW you can just continue and run more monkeys as you wish, - and see the results on the Infection Map without deleting anything. -