Created immediate threat counter

This commit is contained in:
VakarisZ 2021-03-30 13:00:47 +03:00
parent d2fdabe26b
commit 2b3351baec
1 changed files with 23 additions and 14 deletions

View File

@ -224,6 +224,8 @@ class ReportPageComponent extends AuthComponent {
if (this.stillLoadingDataFromServer()) { if (this.stillLoadingDataFromServer()) {
content = <ReportLoader loading={true}/>; content = <ReportLoader loading={true}/>;
} else { } else {
console.log(this.state.report);
content = content =
<div> <div>
{this.generateReportOverviewSection()} {this.generateReportOverviewSection()}
@ -430,23 +432,29 @@ class ReportPageComponent extends AuthComponent {
</h3> </h3>
<div>During this simulated attack the Monkey uncovered <div>During this simulated attack the Monkey uncovered
{ {
this.state.report.overview.issues.length > 0 ?
<> <>
<span <span className="badge badge-warning">
className="badge badge-warning"> {threatCount} threats
{this.state.report.overview.issues.length} threats</span>: </span>:
</>
:
<>
<span
className="badge badge-success">0 threats</span>.
</> </>
} }
</div> </div>
</div>) </div>)
} }
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() { generateReportRecommendationsSection() {
return ( return (
<div id='recommendations'> <div id='recommendations'>
@ -543,7 +551,8 @@ class ReportPageComponent extends AuthComponent {
generateIssue = (issue) => { generateIssue = (issue) => {
let issueDescriptor = this.IssueDescriptorEnum[issue.type]; let issueDescriptor = this.IssueDescriptorEnum[issue.type];
let reportFnc = (issue) => {}; let reportFnc = (issue) => {
};
if (issue.hasOwnProperty('credential_type')) { if (issue.hasOwnProperty('credential_type')) {
reportFnc = issueDescriptor[this.issueContentTypes.REPORT][issue.credential_type]; reportFnc = issueDescriptor[this.issueContentTypes.REPORT][issue.credential_type];
} else { } else {