From 3c76f4138764e4ea541a9d111e48e652da0604be Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 1 Dec 2014 13:55:47 +0100 Subject: [PATCH] Fixed the group view for agents not init. Ticket: #1584 --- pandora_console/include/functions_groups.php | 26 ++++++++++++++++++- .../include/functions_reporting.php | 6 +++-- pandora_console/include/styles/pandora.css | 5 ++++ pandora_console/mobile/include/style/main.css | 7 +++++ .../operation/agentes/group_view.php | 1 + 5 files changed, 42 insertions(+), 3 deletions(-) mode change 100644 => 100755 pandora_console/mobile/include/style/main.css diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index b44c54cd1b..ea0c0b165f 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -897,6 +897,10 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { $group_class = 'group_view_ok'; $status_image = ui_print_status_image ('agent_ok_ball.png', "", true); } + elseif ($data["agent_not_init"] > 0) { + $group_class = 'group_view_not_init'; + $status_image = ui_print_status_image ('agent_no_data_ball.png', "", true); + } else { $group_class = 'group_view_normal'; $status_image = ui_print_status_image ('agent_no_data_ball.png', "", true); @@ -958,6 +962,19 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { echo ""; } + // Agents not init + if ($data["agent_not_init"] > 0) { + echo ""; + echo ""; + echo $data["agent_not_init"]; + echo ""; + echo ""; + } + else { + echo ""; + } + // Monitors Unknown if ($data["monitor_unknown"] > 0) { echo ""; @@ -1123,7 +1140,14 @@ function groups_agent_not_init ($group_array) { $group_clause = implode (",", $group_array); $group_clause = "(" . $group_clause . ")"; - $count = db_get_sql ("SELECT COUNT(*) FROM tagente WHERE disabled=0 AND critical_count=0 AND warning_count=0 AND unknown_count=0 AND notinit_count>0 AND id_grupo IN $group_clause"); + $count = db_get_sql ("SELECT COUNT(*) + FROM tagente + WHERE disabled = 0 + AND critical_count = 0 + AND warning_count = 0 + AND unknown_count = 0 + AND (notinit_count > 0 OR total_count = 0) + AND id_grupo IN $group_clause"); return $count > 0 ? $count : 0; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index b3b3c3dc37..c34770600c 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1803,7 +1803,8 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') { } if ($id_group == 0) { - $id_group = array_keys (users_get_groups ($config['id_user'], $access, false)); + $id_group = array_keys( + users_get_groups($config['id_user'], $access, false)); } // ----------------------------------------------------------------- @@ -1820,7 +1821,8 @@ function reporting_get_group_stats ($id_group = 0, $access = 'AR') { foreach ($id_group as $group) { $group_stat = db_get_all_rows_sql ("SELECT * FROM tgroup_stat, tgrupo - WHERE tgrupo.id_grupo = tgroup_stat.id_group AND tgroup_stat.id_group = $group + WHERE tgrupo.id_grupo = tgroup_stat.id_group + AND tgroup_stat.id_group = $group ORDER BY nombre"); $data["monitor_checks"] += $group_stat[0]["modules"]; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index a603ec697e..4b7e8a59c4 100755 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -2151,6 +2151,11 @@ tr.group_view_ok, .group_view_ok { color: #fff; } +tr.group_view_not_init, .group_view_not_init, tr.group_view_not_init, .group_view_not_init { + background-color: #5AB7E5; + color: #fff !important; +} + tr.group_view_warn, .group_view_warn, tr.group_view_warn.a, a.group_view_warn, tr.a.group_view_warn { background-color: #ffea59; color: #3F3F3F !important; diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css old mode 100644 new mode 100755 index 21d2ea5305..ed349a4335 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -113,6 +113,13 @@ tr.group_view_crit, .group_view_crit { .group_view_norm * { color: #000000 !important; } + + +.group_view_not_init, .group_view_not_init * { + background-color: #5AB7E5; + color: #fff !important; +} + .ui-btn-up-group_view_normal, .ui-btn-hover-group_view_normal, .ui-btn-up-group_view_norm, .ui-btn-hover-group_view_norm { background-color: #6EB432; diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index fae1bddc9f..00a027de51 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -107,6 +107,7 @@ if (count($agents) > 0) { echo "" . __("Group") . ""; echo "" . __("Agents") . ""; echo "" . __("Agent unknown") . ""; + echo "" . __("Agents not init") . ""; echo "" . __("Unknown") . ""; echo "" . __("Not Init") . ""; echo "" . __("Normal") . "";