From 1a2d61e3a1cdb7285174ce39c36d3e93df8e8e16 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 8 Aug 2019 20:57:04 +0300 Subject: [PATCH] Made the test cell of the recommendation table a list instead of raw JSON --- monkey/monkey_island/cc/ui/package-lock.json | 3 +- .../zerotrust/RecommendationsStatusTable.js | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/ui/package-lock.json b/monkey/monkey_island/cc/ui/package-lock.json index dfccd0ec3..09ccebad9 100644 --- a/monkey/monkey_island/cc/ui/package-lock.json +++ b/monkey/monkey_island/cc/ui/package-lock.json @@ -19041,7 +19041,6 @@ "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "1.0.0", "concat-map": "0.0.1" @@ -19211,7 +19210,7 @@ "bundled": true, "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatusTable.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatusTable.js index dda771717..acd7bc322 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatusTable.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/RecommendationsStatusTable.js @@ -22,7 +22,6 @@ const columns = [ }, { Header: 'Tests', id:"Tests", accessor: x => { - console.log(x.Tests); return ; } } @@ -32,10 +31,35 @@ const columns = [ class TestsStatus extends AuthComponent { render() { + const positiveStatus = "Positive"; + const conclusiveStatus = "Conclusive"; + const inconclusiveStatus = "Inconclusive"; + const unexecutedStatus = "Unexecuted"; + return ( -
{JSON.stringify(this.props.tests,null,2)}
+
+ {this.getTestsOfStatusIfAny(conclusiveStatus)} + {this.getTestsOfStatusIfAny(inconclusiveStatus)} + {this.getTestsOfStatusIfAny(positiveStatus)} + {this.getTestsOfStatusIfAny(unexecutedStatus)} +
); } + + getTestsOfStatusIfAny(statusToFilter) { + const filteredTests = this.props.tests.filter((test) => { + return (test.Status === statusToFilter); + } + ); + + if (filteredTests.length > 0) { + const listItems = filteredTests.map((test) => { + return (
  • {test.Test}
  • ) + }); + return
    {statusToFilter}
      {listItems}
    ; + } + return
    ; + } } export class RecommendationsStatusTable extends AuthComponent {