Add warning message if watching report while monkeys are running
This commit is contained in:
parent
f14dc8e2fb
commit
8bc9e3a65f
|
@ -30,16 +30,29 @@ class ReportPageComponent extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
report: {},
|
report: {},
|
||||||
graph: {nodes: [], edges: []}
|
graph: {nodes: [], edges: []},
|
||||||
|
allMonkeysAreDead: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getReportFromServer();
|
this.getReportFromServer();
|
||||||
this.updateMapFromServer();
|
this.updateMapFromServer();
|
||||||
|
this.updateMonkeysRunning();
|
||||||
this.interval = setInterval(this.updateMapFromServer, 1000);
|
this.interval = setInterval(this.updateMapFromServer, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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'])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
|
@ -361,8 +374,18 @@ class ReportPageComponent extends React.Component {
|
||||||
Infection Monkey did not find any critical security issues.
|
Infection Monkey did not find any critical security issues.
|
||||||
</p>)
|
</p>)
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
this.state.allMonkeysAreDead ?
|
||||||
|
''
|
||||||
|
:
|
||||||
|
(<p className="alert alert-warning">
|
||||||
|
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
|
||||||
|
Some monkeys are still running. To get the best report it's best to wait for all of them to finish
|
||||||
|
running.
|
||||||
|
</p>)
|
||||||
|
}
|
||||||
<p className="alert alert-info">
|
<p className="alert alert-info">
|
||||||
<i className="glyphicon glyphicon-ok-sign" style={{'marginRight': '5px'}}/>
|
<i className="glyphicon glyphicon-info-sign" style={{'marginRight': '5px'}}/>
|
||||||
To improve the monkey's success rate, try adding users and passwords, and enabling the "Local
|
To improve the monkey's success rate, try adding users and passwords, and enabling the "Local
|
||||||
network scan" config value under "Basic - Network"
|
network scan" config value under "Basic - Network"
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in New Issue