fixed minor error not init agent in tree view node

This commit is contained in:
daniel 2018-09-05 18:28:31 +02:00
parent 3b0436008a
commit 4781809e14
2 changed files with 35 additions and 30 deletions

View File

@ -950,7 +950,7 @@ class Tree {
SUM(if(%s, 1, 0)) as state_unknown, SUM(if(%s, 1, 0)) as state_unknown,
SUM(if(%s, 1, 0)) as state_notinit, SUM(if(%s, 1, 0)) as state_notinit,
SUM(if(%s, 1, 0)) as state_normal, SUM(if(%s, 1, 0)) as state_normal,
SUM(if(%s, 1, 0)) as state_total SUM(if(%s AND tae.estado IS NOT NULL, 1, 0)) as state_total
", ",
$this->getModuleStatusFilterFromTestado(AGENT_MODULE_STATUS_CRITICAL_ALERT, true), $this->getModuleStatusFilterFromTestado(AGENT_MODULE_STATUS_CRITICAL_ALERT, true),
$this->getModuleStatusFilterFromTestado(AGENT_MODULE_STATUS_WARNING_ALERT, true), $this->getModuleStatusFilterFromTestado(AGENT_MODULE_STATUS_WARNING_ALERT, true),
@ -977,7 +977,8 @@ class Tree {
FROM tagente ta FROM tagente ta
$inner_or_left JOIN tagente_modulo tam $inner_or_left JOIN tagente_modulo tam
ON ta.id_agente = tam.id_agente ON ta.id_agente = tam.id_agente
INNER JOIN tagente_estado tae AND tam.disabled = 0
$inner_or_left JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente_modulo ON tae.id_agente_modulo = tam.id_agente_modulo
$inner $inner
WHERE ta.id_agente IN WHERE ta.id_agente IN
@ -992,14 +993,13 @@ class Tree {
$group_search_filter $group_search_filter
$condition_inside $condition_inside
) )
AND ta.disabled = 0 AND tam.disabled = 0 AND ta.disabled = 0
$condition $condition
$agent_search_filter $agent_search_filter
$agent_status_filter $agent_status_filter
$module_search_filter $module_search_filter
$module_status_filter $module_status_filter
GROUP BY ta.id_agente GROUP BY ta.id_agente
HAVING state_total > 0
ORDER BY ta.alias ASC, ta.id_agente ASC ORDER BY ta.alias ASC, ta.id_agente ASC
"; ";

View File

@ -28,7 +28,6 @@ class TreeGroup extends Tree {
$this->L1fieldName = "id_group"; $this->L1fieldName = "id_group";
$this->L1extraFields = array( $this->L1extraFields = array(
"tg.nombre AS `name`", "tg.nombre AS `name`",
$this->getDisplayHierarchy() ? 'tg.parent' : '0 as parent',
"tg.icon", "tg.icon",
"tg.id_grupo AS gid" "tg.id_grupo AS gid"
); );
@ -91,7 +90,7 @@ class TreeGroup extends Tree {
protected function getProcessedGroups () { protected function getProcessedGroups () {
$processed_groups = array(); $processed_groups = array();
// Index and process the groups // Index and process the groups
$groups = $this->getGroupCounters(0); $groups = $this->getGroupCounters();
// If user have not permissions in parent, set parent node to 0 (all) // If user have not permissions in parent, set parent node to 0 (all)
// Avoid to do foreach for admins // Avoid to do foreach for admins
@ -250,6 +249,12 @@ class TreeGroup extends Tree {
return $group_stats; return $group_stats;
} }
protected function getFirstLevelFields() {
$fields = parent::getFirstLevelFields();
$parent = $this->getDisplayHierarchy() ? 'tg.parent' : '0 as parent';
return "$fields, $parent";
}
protected function getProcessedModules($modules_tree) { protected function getProcessedModules($modules_tree) {
$groups = array(); $groups = array();