From 2b3351baec52786d9850dbf89ea1525145737774 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 30 Mar 2021 13:00:47 +0300 Subject: [PATCH] Created immediate threat counter --- .../report-components/SecurityReport.js | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js index 7ac1beab8..4296e773c 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js @@ -224,6 +224,8 @@ class ReportPageComponent extends AuthComponent { if (this.stillLoadingDataFromServer()) { content = ; } else { + + console.log(this.state.report); content =
{this.generateReportOverviewSection()} @@ -430,23 +432,29 @@ class ReportPageComponent extends AuthComponent {
During this simulated attack the Monkey uncovered { - this.state.report.overview.issues.length > 0 ? - <> - - {this.state.report.overview.issues.length} threats: - - - : - <> - 0 threats. - + <> + + {threatCount} threats + : + }
) } + countImmediateThreats() { + let threatCount = 0; + let issues = this.state.report.overview.issues; + + for(let i=0; i < issues.length; i++) { + if (this.IssueDescriptorEnum[issues[i]][this.issueContentTypes.TYPE] === this.issueTypes.DANGER) { + threatCount++; + } + } + return threatCount; + } + + generateReportRecommendationsSection() { return (
@@ -543,8 +551,9 @@ class ReportPageComponent extends AuthComponent { generateIssue = (issue) => { let issueDescriptor = this.IssueDescriptorEnum[issue.type]; - let reportFnc = (issue) => {}; - if(issue.hasOwnProperty('credential_type')) { + let reportFnc = (issue) => { + }; + if (issue.hasOwnProperty('credential_type')) { reportFnc = issueDescriptor[this.issueContentTypes.REPORT][issue.credential_type]; } else { reportFnc = issueDescriptor[this.issueContentTypes.REPORT];