diff --git a/pandora_console/include/javascript/general_tactical_view.js b/pandora_console/include/javascript/general_tactical_view.js index c3d48b133b..817315db50 100644 --- a/pandora_console/include/javascript/general_tactical_view.js +++ b/pandora_console/include/javascript/general_tactical_view.js @@ -64,7 +64,10 @@ $(document).ready(function() { }, type: "POST", success: function(data) { - $("#heatmap-group").html(data); + var title = $(data)[1]; + var heatmap = $(data)[0]; + $("#heatmap-group").html(heatmap); + $("#heatmap-title").html($(title).html()); } }); }); diff --git a/pandora_console/include/lib/TacticalView/elements/Database.php b/pandora_console/include/lib/TacticalView/elements/Database.php index 7d46d29cb1..ef5925162b 100644 --- a/pandora_console/include/lib/TacticalView/elements/Database.php +++ b/pandora_console/include/lib/TacticalView/elements/Database.php @@ -147,10 +147,11 @@ class Database extends Element */ public function getEvents():string { - // TODO connect to automonitorization. + $data = $this->valueMonitoring('last_events_24h'); + $value = round($data[0]['datos']); return html_print_div( [ - 'content' => '9.999.999', + 'content' => $value, 'class' => 'text-l', 'id' => 'total-events', 'style' => 'margin: 0px 10px 10px 10px;', diff --git a/pandora_console/include/lib/TacticalView/elements/Events.php b/pandora_console/include/lib/TacticalView/elements/Events.php index 2e20aaa4c0..b304e59300 100644 --- a/pandora_console/include/lib/TacticalView/elements/Events.php +++ b/pandora_console/include/lib/TacticalView/elements/Events.php @@ -103,6 +103,8 @@ class Events extends Element ]; } + $graph_values = array_slice($graph_values, -24); + $danger = $max_value; $ok = ($max_value / 3); diff --git a/pandora_console/include/lib/TacticalView/elements/Groups.php b/pandora_console/include/lib/TacticalView/elements/Groups.php index 016700ef92..82b0f358b1 100644 --- a/pandora_console/include/lib/TacticalView/elements/Groups.php +++ b/pandora_console/include/lib/TacticalView/elements/Groups.php @@ -81,11 +81,11 @@ class Groups extends Element $agents = agents_get_agents(); if (is_array($agents) === true && count($agents) >= 10) { $this->title = __('My monitored agents'); - return $this->getStatusHeatMapAgents(); + return $this->getStatusHeatMapAgents().''.$this->title.''; } $this->title = __('My monitored modules'); - return $this->getStatusHeatMapModules(); + return $this->getStatusHeatMapModules().''.$this->title.''; } diff --git a/pandora_console/include/lib/TacticalView/elements/Overview.php b/pandora_console/include/lib/TacticalView/elements/Overview.php index 706e6db321..01e4a67a49 100644 --- a/pandora_console/include/lib/TacticalView/elements/Overview.php +++ b/pandora_console/include/lib/TacticalView/elements/Overview.php @@ -153,27 +153,25 @@ class Overview extends Element */ public function getLicenseUsageGraph():string { - // TODO connect to automonitorization. - $options = [ - 'labels' => [ - 'Agents used', - 'Free agents', + // TODO: show real data. + $data = [ + 'free_agents' => [ + 'label' => __('Free agents'), + 'perc' => 40, + 'color' => '#5C63A2', ], - 'colors' => [ - '#1C4E6B', - '#5C63A2', + 'agents_used' => [ + 'label' => __('Agents used'), + 'perc' => 60, + 'color' => '#1C4E6B', ], - 'legend' => [ - 'position' => 'bottom', - 'align' => 'right', - ], - 'cutout' => 80, ]; - $pie = ring_graph([60, 40], $options); + + $bar = $this->printHorizontalBar($data); $output = html_print_div( [ - 'content' => $pie, - 'style' => 'margin: 0 auto; max-width: 320px', + 'content' => $bar, + 'style' => 'margin: 0 auto;', ], true ); @@ -183,11 +181,60 @@ class Overview extends Element /** - * Returns the html of a graph with the processed xmls + * Print horizontal bar divided by percentage. + * + * @param array $data Required [perc, color, label]. * * @return string */ - public function getXmlProcessedGraph():string + private function printHorizontalBar(array $data):string + { + $output = '