From e64eadcb3794002abc932520c2106e80ea192f89 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 3 Oct 2023 10:31:57 +0200 Subject: [PATCH] #10194 hide widget not activated --- .../lib/TacticalView/elements/LogStorage.php | 20 ++++++++++++++++ .../lib/TacticalView/elements/Overview.php | 23 ++++++++++++++++++- .../lib/TacticalView/elements/SnmpTraps.php | 20 ++++++++++++++++ .../include/styles/general_tactical_view.css | 3 +++ pandora_console/views/tacticalView/view.php | 14 ++++++++--- 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/lib/TacticalView/elements/LogStorage.php b/pandora_console/include/lib/TacticalView/elements/LogStorage.php index 76c13ac580..da8214b69d 100644 --- a/pandora_console/include/lib/TacticalView/elements/LogStorage.php +++ b/pandora_console/include/lib/TacticalView/elements/LogStorage.php @@ -64,6 +64,26 @@ class LogStorage extends Element } + /** + * Check if log storage module exist. + * + * @return boolean + */ + public function isEnabled():bool + { + if (empty($this->monitoringAgent) === true) { + return false; + } + + $existModule = modules_get_agentmodule_id(io_safe_input('Log server connection'), $this->monitoringAgent['id_agente']); + if ($existModule === false) { + return false; + } else { + return true; + } + } + + /** * Returns the html status of log storage. * diff --git a/pandora_console/include/lib/TacticalView/elements/Overview.php b/pandora_console/include/lib/TacticalView/elements/Overview.php index 369dab1df7..5a266db8a6 100644 --- a/pandora_console/include/lib/TacticalView/elements/Overview.php +++ b/pandora_console/include/lib/TacticalView/elements/Overview.php @@ -54,6 +54,26 @@ class Overview extends Element } + /** + * Check if module WUX connection exist. + * + * @return boolean + */ + public function wuxIsEnabled():bool + { + if (empty($this->monitoringAgent) === true) { + return false; + } + + $existModule = modules_get_agentmodule_id(io_safe_input('WUX connection'), $this->monitoringAgent['id_agente']); + if ($existModule === false) { + return false; + } else { + return true; + } + } + + /** * Return the html log size status. * @@ -86,10 +106,11 @@ class Overview extends Element $output = $image_status.$text; + $align = ($this->wuxIsEnabled() === true) ? 'flex_center' : 'flex_justify'; return html_print_div( [ 'content' => $output, - 'class' => 'flex_center margin-top-5', + 'class' => 'margin-top-5 '.$align, 'id' => 'status-log-size', ], true diff --git a/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php b/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php index 02cb2b49ac..7783a5277b 100644 --- a/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php +++ b/pandora_console/include/lib/TacticalView/elements/SnmpTraps.php @@ -54,6 +54,26 @@ class SnmpTraps extends Element } + /** + * Check if snmp traps module exist. + * + * @return boolean + */ + public function isEnabled():bool + { + if (empty($this->monitoringAgent) === true) { + return false; + } + + $existModule = modules_get_agentmodule_id(io_safe_input('snmp_trap_queue'), $this->monitoringAgent['id_agente']); + if ($existModule === false) { + return false; + } else { + return true; + } + } + + /** * Returns the html of queues traps. * diff --git a/pandora_console/include/styles/general_tactical_view.css b/pandora_console/include/styles/general_tactical_view.css index 75fee1df21..b1b81e3c68 100644 --- a/pandora_console/include/styles/general_tactical_view.css +++ b/pandora_console/include/styles/general_tactical_view.css @@ -21,6 +21,9 @@ display: flex; width: 100%; } +.col-12 { + width: 100%; +} .col-6, .col-xl-6 { width: 50%; diff --git a/pandora_console/views/tacticalView/view.php b/pandora_console/views/tacticalView/view.php index bf8bb6a421..09e293bddb 100644 --- a/pandora_console/views/tacticalView/view.php +++ b/pandora_console/views/tacticalView/view.php @@ -14,14 +14,15 @@
-
-
+
+
getLogSizeStatus(); ?>
+ wuxIsEnabled() === true) : ?>
@@ -30,6 +31,7 @@ getWuxServerStatus(); ?>
+
@@ -150,7 +152,7 @@
total < 200) : ?> -
+
title; ?> @@ -162,7 +164,9 @@
+ isEnabled() === true && $SnmpTraps->isEnabled() === true) : ?>
+ isEnabled() === true) : ?>
title; ?> @@ -198,6 +202,8 @@
+ + isEnabled() === true) : ?>
title; ?> @@ -217,7 +223,9 @@
+
+