From 14e69c5c070665bfa6e82200c922e09ec84a1f13 Mon Sep 17 00:00:00 2001 From: Luis Date: Fri, 25 Jun 2021 09:37:09 +0000 Subject: [PATCH] Ent 7644 mapa servicio tree view muestra elementos deshabilitados --- pandora_console/include/class/Tree.class.php | 23 ++++++++++++++++++- .../include/class/TreeService.class.php | 4 ++++ .../include/javascript/tree/TreeController.js | 18 +++++++++++---- pandora_console/include/styles/tree.css | 4 ++++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 8ff384a8fc..b0be9087a2 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -160,6 +160,21 @@ class Tree } + /** + * Show disabled modules + * + * @return string Sql disabled. + */ + protected function getDisabledFilter() + { + if (empty($this->filter['showDisabled'])) { + return ' tam.disabled = 0 AND ta.disabled = 0'; + } + + return ' 1 = 1'; + } + + protected function getAgentStatusFilter($status=self::TV_DEFAULT_AGENT_STATUS) { if ($status == self::TV_DEFAULT_AGENT_STATUS) { @@ -1094,6 +1109,7 @@ class Tree $agent_filter = 'AND ta.id_agente = '.$this->id; $tag_condition = $this->getTagCondition(); $tag_join = empty($tag_condition) && (!$this->L3forceTagCondition) ? '' : $this->getTagJoin(); + $show_disabled = $this->getDisabledFilter(); if ($this->avoid_condition === true) { $condition = ''; @@ -1107,6 +1123,10 @@ class Tree tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos, tam.parent_module_id AS parent, tatm.id AS alerts, tam.unit'; + if ($show_disabled) { + $columns .= ', tam.disabled'; + } + $sql = "SELECT $columns FROM tagente_modulo tam $tag_join @@ -1119,7 +1139,8 @@ class Tree LEFT JOIN talert_template_modules tatm ON tatm.id_agent_module = tam.id_agente_modulo $inner - WHERE tam.disabled = 0 AND ta.disabled = 0 + WHERE + $show_disabled $condition $agent_filter $group_acl diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index 119610eb0d..56ec13ac3a 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -180,6 +180,7 @@ class TreeService extends Tree } else if ($this->type == 'services') { $this->getSecondLevel(); } else if ($this->type == 'agent') { + $this->filter['showDisabled'] = true; $this->getThirdLevel(); } @@ -433,6 +434,7 @@ class TreeService extends Tree $tmp['showEventsBtn'] = 1; $tmp['eventAgent'] = $item->agent()->id_agente(); + $tmp['disabled'] = (bool) $item->agent()->disabled(); break; case SERVICE_ELEMENT_MODULE: @@ -495,6 +497,7 @@ class TreeService extends Tree $tmp['showGraphs'] = 1; $tmp['showEventsBtn'] = 1; $tmp['eventAgent'] = $item->module()->id_agente(); + $tmp['disabled'] = $item->module()->disabled(); $html = ' 0 + element.children.length > 0 && + element.disabled == false ) { $node.removeClass("leaf-empty").addClass("leaf-closed"); @@ -1027,8 +1036,9 @@ var TreeController = { element.searchChildren ) { if ( - element.rootType == "group_edition" && - typeof element.children == "undefined" + (element.rootType == "group_edition" && + typeof element.children == "undefined") || + element.disabled == true ) { $node.addClass("leaf-empty"); } else { diff --git a/pandora_console/include/styles/tree.css b/pandora_console/include/styles/tree.css index 1a479ac3cf..6a0cc7b19f 100644 --- a/pandora_console/include/styles/tree.css +++ b/pandora_console/include/styles/tree.css @@ -179,3 +179,7 @@ div#tree-controller-recipient { .tree-node > .node-content > div + div:not(.tree-node-counters) { margin-left: 3px; } + +.tree-node .disabled { + filter: opacity(0.3); +}