From 278a09e039ace3114e92e10cfaf6b8b225191ea0 Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 13 Jul 2021 14:23:51 +0530 Subject: [PATCH] cc: Add ransomware report tab to reports page depending on mode --- .../cc/ui/src/components/pages/ReportPage.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js index 86b73dbb4..df3fd1137 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js @@ -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); }