cc: Add ransomware report tab to reports page depending on mode

This commit is contained in:
Shreya 2021-07-13 14:23:51 +05:30
parent e5160a5fb4
commit 278a09e039
1 changed files with 21 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class ReportPageComponent extends AuthComponent {
// });
// });
if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) {
this.state.sections.push({key: 'ransomware', title: 'Ransomware report'})
this.addRansomwareReportTab();
}
}
}
@ -104,6 +104,26 @@ class ReportPageComponent extends AuthComponent {
}
}
addRansomwareReportTab() { // TODO: Fetch mode from API endpoint
let ransomwareTab = {key: 'ransomware', title: 'Ransomware report'};
// let mode = "";
// this.authFetch('/api/mode')
// .then(res => res.json())
// .then(res => {
// mode = res.mode
// }
// );
let mode = 'ransomware';
if (mode === 'ransomware') {
this.state.sections.splice(0, 0, ransomwareTab);
}
else {
this.state.sections.push(ransomwareTab);
}
}
componentWillUnmount() {
clearInterval(this.state.ztReportRefreshInterval);
}