diff --git a/pandora_console/include/ajax/heatmap.ajax.php b/pandora_console/include/ajax/heatmap.ajax.php
index 3a4a1b1022..f2f6c81280 100644
--- a/pandora_console/include/ajax/heatmap.ajax.php
+++ b/pandora_console/include/ajax/heatmap.ajax.php
@@ -38,7 +38,7 @@ if (is_ajax() === true) {
$type = get_parameter('type', 0);
if ($getFilters === true) {
- $refresh = get_parameter('refresh', 30);
+ $refresh = get_parameter('refresh', 180);
$search = get_parameter('search', '');
$group = get_parameter('group', true);
@@ -117,6 +117,7 @@ if (is_ajax() === true) {
'return' => true,
'required' => true,
'privilege' => 'AR',
+ 'multiple' => true,
]
);
break;
@@ -186,28 +187,20 @@ if (is_ajax() === true) {
break;
case 2:
- $module_groups = modules_get_modulegroups();
- // $module_groups[0] = _('Not assigned');
- // hd(current($filter));
echo '
';
echo graph_graphic_agentevents(
$id,
100,
- 80,
+ 40,
SECONDS_1DAY,
'',
true,
diff --git a/pandora_console/include/class/Heatmap.class.php b/pandora_console/include/class/Heatmap.class.php
index 2f448df4a4..3f70d29a27 100644
--- a/pandora_console/include/class/Heatmap.class.php
+++ b/pandora_console/include/class/Heatmap.class.php
@@ -112,7 +112,7 @@ class Heatmap
int $type=0,
array $filter=[],
string $randomId=null,
- int $refresh=300,
+ int $refresh=180,
int $width=0,
int $height=0,
string $search=null,
@@ -230,6 +230,8 @@ class Heatmap
},
(refresh * 1000)
);
+ } else {
+ location.reload();
}
}
});
@@ -307,8 +309,7 @@ class Heatmap
$id_grupo = '';
if (empty($this->filter) === false && current($this->filter) != 0) {
- $filter['id_grupo'] = current($this->filter);
- $id_grupo = ' AND id_grupo = '.current($this->filter);
+ $id_grupo = ' AND id_grupo IN ('.implode(',', $this->filter).')';
}
// All agents.
@@ -380,7 +381,7 @@ class Heatmap
{
$filter_group = '';
if (empty($this->filter) === false && current($this->filter) != -1) {
- $filter_group = 'AND am.id_module_group ='.current($this->filter);
+ $filter_group = 'AND am.id_module_group IN ('.implode(',', $this->filter).')';
}
$filter_name = '';
@@ -477,9 +478,8 @@ class Heatmap
{
$filter_tag = '';
if (empty($this->filter) === false && $this->filter[0] !== '0') {
- foreach ($this->filter as $key => $value) {
- $filter_tag .= ' AND tm.id_tag ='.$value;
- }
+ $tags = implode(',', $this->filter);
+ $filter_tag .= ' AND tm.id_tag IN ('.$tags.')';
}
$filter_name = '';
@@ -680,11 +680,22 @@ class Heatmap
{
$result = $this->getData();
- $scale = ($this->width / $this->height);
+ if (empty($result) === true) {
+ echo '
'.__('No data found').'
';
+ return;
+ }
- $Yaxis = $this->getYAxis(count($result), $scale);
- $Xaxis = (int) ceil($Yaxis * $scale);
- $Yaxis = ceil($Yaxis);
+ $count_result = count($result);
+
+ $scale = ($this->width / $this->height);
+ $Yaxis = $this->getYAxis($count_result, $scale);
+ if ($count_result <= 3) {
+ $Xaxis = $count_result;
+ $Yaxis = 1;
+ } else {
+ $Xaxis = (int) ceil($Yaxis * $scale);
+ $Yaxis = ceil($Yaxis);
+ }
$viewBox = sprintf(
'0 0 %d %d',
@@ -728,7 +739,7 @@ class Heatmap
modal: true,
closeOnEscape: true,
height: 400,
- width: 430,
+ width: 530,
title: '',
open: function() {
$.ajax({
@@ -755,7 +766,15 @@ class Heatmap
$x_back = 0;
$y_back = 0;
- echo '
';
+ if ($count_result <= 100) {
+ $fontSize = 'small-size';
+ $stroke = 'small-stroke';
+ } else {
+ $fontSize = 'big-size';
+ $stroke = 'big-stroke';
+ }
+
+ echo '
';
foreach ($groups as $key => $group) {
$name = '';
switch ($this->type) {
@@ -786,7 +805,7 @@ class Heatmap
($y_back + 1)
);
- echo '
';
+ echo '
';
}
$points = sprintf(
@@ -799,11 +818,11 @@ class Heatmap
$y_back
);
- echo '
';
+ echo '
';
// Name.
echo '
'.$name.'';
+ class="'.$fontSize.'">'.$name.'';
$x_back = $x_position;
if ($x_position === $Xaxis) {
@@ -815,7 +834,7 @@ class Heatmap
($y_back + 1)
);
- echo '
';
+ echo '
';
$y_back++;
$x_back = 0;
@@ -838,7 +857,7 @@ class Heatmap
($y_position)
);
- echo '
';
+ echo '
';
}
// Bottom of last line.
@@ -850,11 +869,11 @@ class Heatmap
($y_position + 1)
);
- echo '
';
+ echo '
';
// Name.
echo '
'.$name.'';
+ class="'.$fontSize.'">'.$name.'';
// Bottom-right of last line.
$points = sprintf(
@@ -865,7 +884,7 @@ class Heatmap
($y_position + 1)
);
- echo '
';
+ echo '
';
if ($x_position > $x_back) {
// Bottom-top of last line.
@@ -877,7 +896,7 @@ class Heatmap
($y_position)
);
- echo '
';
+ echo '
';
}
} else {
// Two or more lines.
@@ -896,7 +915,7 @@ class Heatmap
($y_position + 1)
);
- echo '
';
+ echo '
';
// Bottom-right of last line.
$points = sprintf(
@@ -907,11 +926,11 @@ class Heatmap
($y_position + 1)
);
- echo '
';
+ echo '
';
// Name.
echo '
'.$name.'';
+ class="'.$fontSize.'">'.$name.'';
// Bottom-top of last line.
$points = sprintf(
@@ -922,7 +941,7 @@ class Heatmap
($y_position)
);
- echo '
';
+ echo '
';
}
if ($x_position === $Xaxis) {
diff --git a/pandora_console/include/styles/heatmap.css b/pandora_console/include/styles/heatmap.css
index 2e9533c339..bac09b561e 100644
--- a/pandora_console/include/styles/heatmap.css
+++ b/pandora_console/include/styles/heatmap.css
@@ -253,3 +253,19 @@ div#heatmap-controls div.heatmap-refr > div {
stroke: black;
stroke-width: 0.05;
}
+
+.small-stroke {
+ stroke-width: 0.03;
+}
+
+.big-stroke {
+ stroke-width: 0.05;
+}
+
+.small-size {
+ font-size: 0.2px;
+}
+
+.big-size {
+ font-size: 0.4px;
+}
diff --git a/pandora_console/operation/heatmap.php b/pandora_console/operation/heatmap.php
index 9f7d4cee4d..59f97048a9 100644
--- a/pandora_console/operation/heatmap.php
+++ b/pandora_console/operation/heatmap.php
@@ -45,7 +45,7 @@ require_once $config['homedir'].'/include/class/Heatmap.class.php';
$pure = (bool) get_parameter('pure', false);
$type = get_parameter('type', 0);
$randomId = get_parameter('randomId', null);
-$refresh = get_parameter('refresh', 30);
+$refresh = get_parameter('refresh', 180);
$height = get_parameter('height', 0);
$width = get_parameter('width', 0);
$search = get_parameter('search', '');
@@ -274,7 +274,7 @@ if ($is_ajax === true) {
draggable: false,
modal: true,
closeOnEscape: true,
- height: 370,
+ height: 410,
width: 330,
title: '',
position: {