From b343ccf21eb1864bc6bd9fba69491f48dafb3edf Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Wed, 28 Aug 2019 19:52:30 +0300 Subject: [PATCH] New Version of the Venn Diagram --- .../zerotrust/venn-components/ArcNode.js | 11 +++--- .../zerotrust/venn-components/CircularNode.js | 7 ++-- .../zerotrust/venn-components/VennDiagram.js | 39 +++++++------------ 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js index 1b4343045..79dfa4b18 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/ArcNode.js @@ -11,11 +11,11 @@ class ArcNode extends React.Component { let id = prefix + 'Node_' + index; return ( - {data.tooltip}}> - + - - {data.label} + {data.icon + '\u2000'} + {data.label} diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js index a5cbc6698..0c18c9ea8 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/venn-components/CircularNode.js @@ -9,12 +9,11 @@ class CircularNode extends React.Component { let translate = 'translate(' + data.cx + ',' + data.cy + ')'; return ( - {data.tooltip}}> - + rest; @@ -140,6 +133,7 @@ class VennDiagram extends React.Component { this.props.pillarsGrades.forEach((d_, i_) => { let params = omit('pillar', d_); + let sum = Object.keys(params).reduce((sum_, key_) => sum_ + parseFloat(params[key_] || 0), 0); let key = TypographicUtilities.removeAmpersand(d_.pillar); let html = self.buildTooltipHtmlContent(params); let rule = null; @@ -159,15 +153,13 @@ class VennDiagram extends React.Component { this.setState({data: data}); this.render(); } - + buildTooltipHtmlContent(object_) { var out = []; - Object.keys(object_).forEach(function (d_) { - out.push([d_ + ': ' + object_[d_],
]); - }); - return out; - + Object.keys(object_).forEach(function(d_){ out.push([d_ + ': ' + object_[d_],
]); }); + return out; + } setLayoutElement(rule_, key_, html_, d_) { @@ -183,7 +175,7 @@ class VennDiagram extends React.Component { this.layout[key_].hex = this.rules[rule_].hex; this.layout[key_].status = this.rules[rule_].status; - this.layout[key_].label = d_.pillar + this.suffices[rule_]; + this.layout[key_].label = d_.pillar; this.layout[key_].node = d_; this.layout[key_].tooltip = html_; } @@ -219,12 +211,11 @@ class VennDiagram extends React.Component { }); return ( -
this.divElement = divElement} onMouseMove={this._onMouseMove.bind(this)} - onClick={this._onClick.bind(this)}> - this.divElement = divElement} onMouseMove={this._onMouseMove.bind(this)}> + {nodes} - +
) }