forked from p34709852/monkey
Refactored notification logic to method
This commit is contained in:
parent
a51a6065b8
commit
53f31ddcc9
|
@ -212,21 +212,23 @@ class AppComponent extends AuthComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
showInfectionDoneNotification() {
|
showInfectionDoneNotification() {
|
||||||
if (this.state.completedSteps.infection_done) {
|
if (this.shouldShowNotification()) {
|
||||||
// No need to show the notification to redirect to the report if we're already in the report page
|
const hostname = window.location.hostname;
|
||||||
if (!window.location.href.includes("report")) {
|
const port = window.location.port;
|
||||||
const hostname = window.location.hostname;
|
const url = `https://${hostname}:${port}${reportZeroTrustRoute}`;
|
||||||
const port = window.location.port;
|
|
||||||
let url = `https://${hostname}:${port}${reportZeroTrustRoute}`;
|
|
||||||
|
|
||||||
Notifier.start(
|
Notifier.start(
|
||||||
"Monkey Island",
|
"Monkey Island",
|
||||||
"Infection is done! Click here to go to the report page.",
|
"Infection is done! Click here to go to the report page.",
|
||||||
url,
|
url,
|
||||||
notificationIcon);
|
notificationIcon);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldShowNotification() {
|
||||||
|
// No need to show the notification to redirect to the report if we're already in the report page
|
||||||
|
return (this.state.completedSteps.infection_done && !window.location.pathname.startsWith("/report"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppComponent.defaultProps = {};
|
AppComponent.defaultProps = {};
|
||||||
|
|
Loading…
Reference in New Issue