Merge branch 'ent-7644-mapa-servicio-tree-view-muestra-elementos-deshabilitados' into 'develop'
Ent 7644 mapa servicio tree view muestra elementos deshabilitados See merge request artica/pandorafms!4193
This commit is contained in:
commit
a13256043c
|
@ -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)
|
protected function getAgentStatusFilter($status=self::TV_DEFAULT_AGENT_STATUS)
|
||||||
{
|
{
|
||||||
if ($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;
|
$agent_filter = 'AND ta.id_agente = '.$this->id;
|
||||||
$tag_condition = $this->getTagCondition();
|
$tag_condition = $this->getTagCondition();
|
||||||
$tag_join = empty($tag_condition) && (!$this->L3forceTagCondition) ? '' : $this->getTagJoin();
|
$tag_join = empty($tag_condition) && (!$this->L3forceTagCondition) ? '' : $this->getTagJoin();
|
||||||
|
$show_disabled = $this->getDisabledFilter();
|
||||||
|
|
||||||
if ($this->avoid_condition === true) {
|
if ($this->avoid_condition === true) {
|
||||||
$condition = '';
|
$condition = '';
|
||||||
|
@ -1107,6 +1123,10 @@ class Tree
|
||||||
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
|
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
|
||||||
tam.parent_module_id AS parent, tatm.id AS alerts, tam.unit';
|
tam.parent_module_id AS parent, tatm.id AS alerts, tam.unit';
|
||||||
|
|
||||||
|
if ($show_disabled) {
|
||||||
|
$columns .= ', tam.disabled';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT $columns
|
$sql = "SELECT $columns
|
||||||
FROM tagente_modulo tam
|
FROM tagente_modulo tam
|
||||||
$tag_join
|
$tag_join
|
||||||
|
@ -1119,7 +1139,8 @@ class Tree
|
||||||
LEFT JOIN talert_template_modules tatm
|
LEFT JOIN talert_template_modules tatm
|
||||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||||
$inner
|
$inner
|
||||||
WHERE tam.disabled = 0 AND ta.disabled = 0
|
WHERE
|
||||||
|
$show_disabled
|
||||||
$condition
|
$condition
|
||||||
$agent_filter
|
$agent_filter
|
||||||
$group_acl
|
$group_acl
|
||||||
|
|
|
@ -180,6 +180,7 @@ class TreeService extends Tree
|
||||||
} else if ($this->type == 'services') {
|
} else if ($this->type == 'services') {
|
||||||
$this->getSecondLevel();
|
$this->getSecondLevel();
|
||||||
} else if ($this->type == 'agent') {
|
} else if ($this->type == 'agent') {
|
||||||
|
$this->filter['showDisabled'] = true;
|
||||||
$this->getThirdLevel();
|
$this->getThirdLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,6 +434,7 @@ class TreeService extends Tree
|
||||||
|
|
||||||
$tmp['showEventsBtn'] = 1;
|
$tmp['showEventsBtn'] = 1;
|
||||||
$tmp['eventAgent'] = $item->agent()->id_agente();
|
$tmp['eventAgent'] = $item->agent()->id_agente();
|
||||||
|
$tmp['disabled'] = (bool) $item->agent()->disabled();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERVICE_ELEMENT_MODULE:
|
case SERVICE_ELEMENT_MODULE:
|
||||||
|
@ -495,6 +497,7 @@ class TreeService extends Tree
|
||||||
$tmp['showGraphs'] = 1;
|
$tmp['showGraphs'] = 1;
|
||||||
$tmp['showEventsBtn'] = 1;
|
$tmp['showEventsBtn'] = 1;
|
||||||
$tmp['eventAgent'] = $item->module()->id_agente();
|
$tmp['eventAgent'] = $item->module()->id_agente();
|
||||||
|
$tmp['disabled'] = $item->module()->disabled();
|
||||||
|
|
||||||
$html = '<img src="';
|
$html = '<img src="';
|
||||||
$html .= ui_get_full_url(
|
$html .= ui_get_full_url(
|
||||||
|
@ -524,6 +527,7 @@ class TreeService extends Tree
|
||||||
$tmp['alias'] = $item->service()->name();
|
$tmp['alias'] = $item->service()->name();
|
||||||
$tmp['description'] = $item->service()->description();
|
$tmp['description'] = $item->service()->description();
|
||||||
$tmp['elementDescription'] = $item->description();
|
$tmp['elementDescription'] = $item->description();
|
||||||
|
$tmp['disabled'] = $item->service()->disabled();
|
||||||
|
|
||||||
if ($this->connectedToNode === false
|
if ($this->connectedToNode === false
|
||||||
&& is_metaconsole() === true
|
&& is_metaconsole() === true
|
||||||
|
|
|
@ -508,6 +508,11 @@ var TreeController = {
|
||||||
|
|
||||||
// Content
|
// Content
|
||||||
$content.addClass("node-content");
|
$content.addClass("node-content");
|
||||||
|
var disabled = false;
|
||||||
|
if (element.disabled == true) {
|
||||||
|
disabled = true;
|
||||||
|
$content.addClass("disabled");
|
||||||
|
}
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
case "group":
|
case "group":
|
||||||
if (
|
if (
|
||||||
|
@ -956,7 +961,10 @@ var TreeController = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If exist the detail container, show the data
|
// If exist the detail container, show the data
|
||||||
if (typeof controller.detailRecipient !== "undefined") {
|
if (
|
||||||
|
typeof controller.detailRecipient !== "undefined" &&
|
||||||
|
disabled == false
|
||||||
|
) {
|
||||||
if (element.type == "agent" || element.type == "module") {
|
if (element.type == "agent" || element.type == "module") {
|
||||||
$content
|
$content
|
||||||
.click(function(e) {
|
.click(function(e) {
|
||||||
|
@ -990,7 +998,8 @@ var TreeController = {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof element.children != "undefined" &&
|
typeof element.children != "undefined" &&
|
||||||
element.children.length > 0
|
element.children.length > 0 &&
|
||||||
|
element.disabled == false
|
||||||
) {
|
) {
|
||||||
$node.removeClass("leaf-empty").addClass("leaf-closed");
|
$node.removeClass("leaf-empty").addClass("leaf-closed");
|
||||||
|
|
||||||
|
@ -1027,8 +1036,9 @@ var TreeController = {
|
||||||
element.searchChildren
|
element.searchChildren
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
element.rootType == "group_edition" &&
|
(element.rootType == "group_edition" &&
|
||||||
typeof element.children == "undefined"
|
typeof element.children == "undefined") ||
|
||||||
|
element.disabled == true
|
||||||
) {
|
) {
|
||||||
$node.addClass("leaf-empty");
|
$node.addClass("leaf-empty");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -179,3 +179,7 @@ div#tree-controller-recipient {
|
||||||
.tree-node > .node-content > div + div:not(.tree-node-counters) {
|
.tree-node > .node-content > div + div:not(.tree-node-counters) {
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tree-node .disabled {
|
||||||
|
filter: opacity(0.3);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue