mirror of https://github.com/MISP/MISP
chg: [attackMatrix] Improved layout + fixed bug (carret on scale do not
go out of bound anymore)pull/4156/head
parent
431529c81c
commit
2dc34ab84c
|
@ -4694,11 +4694,14 @@ class EventsController extends AppController
|
|||
|
||||
$scoresDataAttr = $this->Event->Attribute->AttributeTag->getTagScores($eventId, $attackTags);
|
||||
$scoresDataEvent = $this->Event->EventTag->getTagScores($eventId, $attackTags);
|
||||
$maxScore = 0;
|
||||
$scoresData = array();
|
||||
foreach (array_keys($scoresDataAttr['scores'] + $scoresDataEvent['scores']) as $key) {
|
||||
$scoresData[$key] = (isset($scoresDataAttr['scores'][$key]) ? $scoresDataAttr['scores'][$key] : 0) + (isset($scoresDataEvent['scores'][$key]) ? $scoresDataEvent['scores'][$key] : 0);
|
||||
$sum = (isset($scoresDataAttr['scores'][$key]) ? $scoresDataAttr['scores'][$key] : 0) + (isset($scoresDataEvent['scores'][$key]) ? $scoresDataEvent['scores'][$key] : 0);
|
||||
$scoresData[$key] = $sum;
|
||||
$maxScore = max($maxScore, $sum);
|
||||
}
|
||||
$maxScore = max($scoresDataAttr['maxScore'], $scoresDataEvent['maxScore']);
|
||||
|
||||
$scores = $scoresData;
|
||||
|
||||
if ($this->_isRest()) {
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
foreach ($interpolation as $k => $colArr) {
|
||||
$col = str_pad(dechex($colArr[0]), 2, '0', STR_PAD_LEFT) . str_pad(dechex($colArr[1]), 2, '0', STR_PAD_LEFT) . str_pad(dechex($colArr[2]), 2, '0', STR_PAD_LEFT);
|
||||
$interpolation[$k] = '#' . $col;
|
||||
if ($k == 0) { // force small area on white
|
||||
$interpolation[$k] .= ' 3%';
|
||||
}
|
||||
}
|
||||
$colorScale = implode($interpolation, ', ');
|
||||
?>
|
||||
|
@ -28,10 +31,9 @@ foreach($attackTactic as $tabName => $tactic):
|
|||
<span class="fa fa-caret-down"></span>
|
||||
</span>
|
||||
<div>
|
||||
<span>0</span>
|
||||
|
||||
<div id="matrix-heatmap-legend" style="background: linear-gradient(to right, white, <?php echo $colorScale ?>);"></div>
|
||||
<span id="matrix-heatmap-maxval"><?php echo h($maxScore); ?></span>
|
||||
<span>0</span>
|
||||
<div id="matrix-heatmap-legend" style="background: linear-gradient(to right, white 0%, <?php echo $colorScale ?>);"></div>
|
||||
<span id="matrix-heatmap-maxval"><?php echo h($maxScore); ?></span>
|
||||
</div>
|
||||
<label style="display: inline-block; margin-left: 30px;"><input type="checkbox" id="checkbox_attackMatrix_showAll" checked><span class="fa fa-filter"><?php echo __('Show all');?></span></input></label>
|
||||
</div>
|
||||
|
|
|
@ -105,7 +105,6 @@ div.th-inner {
|
|||
#matrix-heatmap-legend {
|
||||
width: 300px;
|
||||
height: 10px;
|
||||
/* background: linear-gradient(to right, white, #0000FF); */
|
||||
}
|
||||
|
||||
.attack-matrix-options div {
|
||||
|
|
Loading…
Reference in New Issue