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)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -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 = '<img src="';
|
||||
$html .= ui_get_full_url(
|
||||
|
@ -524,6 +527,7 @@ class TreeService extends Tree
|
|||
$tmp['alias'] = $item->service()->name();
|
||||
$tmp['description'] = $item->service()->description();
|
||||
$tmp['elementDescription'] = $item->description();
|
||||
$tmp['disabled'] = $item->service()->disabled();
|
||||
|
||||
if ($this->connectedToNode === false
|
||||
&& is_metaconsole() === true
|
||||
|
|
|
@ -508,6 +508,11 @@ var TreeController = {
|
|||
|
||||
// Content
|
||||
$content.addClass("node-content");
|
||||
var disabled = false;
|
||||
if (element.disabled == true) {
|
||||
disabled = true;
|
||||
$content.addClass("disabled");
|
||||
}
|
||||
switch (element.type) {
|
||||
case "group":
|
||||
if (
|
||||
|
@ -956,7 +961,10 @@ var TreeController = {
|
|||
}
|
||||
}
|
||||
// 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") {
|
||||
$content
|
||||
.click(function(e) {
|
||||
|
@ -990,7 +998,8 @@ var TreeController = {
|
|||
|
||||
if (
|
||||
typeof element.children != "undefined" &&
|
||||
element.children.length > 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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue