diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index d425c13b14..897d5ddea0 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1298,6 +1298,15 @@ $table_other->data[$row][1] = html_print_checkbox_switch( ); $row++; +$table_other->data[$row][0] = __('Show empty groups in group view'); +$table_other->data[$row][1] = html_print_checkbox_switch( + 'show_empty_groups', + 1, + $config['show_empty_groups'], + true +); +$row++; + $table_other->data[$row][0] = __('Date format string'); $table_other->data[$row][1] = ''.__('Example').' '.date($config['date_format']); $table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index a7db04abb0..eebc498131 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1245,6 +1245,10 @@ function config_update_config() $error_update[] = __('Show the group name instead the group icon.'); } + if (config_update_value('show_empty_groups', get_parameter('show_empty_groups'), true) === false) { + $error_update[] = __('Show empty groups in group view.'); + } + if (config_update_value('custom_graph_width', (int) get_parameter('custom_graph_width', 1), true) === false) { $error_update[] = __('Default line thickness for the Custom Graph.'); } @@ -3115,6 +3119,10 @@ function config_process_config() config_update_value('show_group_name', 0); } + if (!isset($config['show_empty_groups'])) { + config_update_value('show_empty_groups', 1); + } + if (!isset($config['custom_graph_width'])) { config_update_value('custom_graph_width', 1); } diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 9ec0782e1f..a7ab834665 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -167,7 +167,7 @@ if ($total > 0) { } if ($total_agentes > 0) { - // Agents + // Agents. $total_agent_unknown = format_numeric((($agents_unknown * 100) / $total_agentes), 2); $total_agent_critical = format_numeric((($agents_critical * 100) / $total_agentes), 2); $total_agent_warning = format_numeric((($agents_warning * 100) / $total_agentes), 2); @@ -209,7 +209,7 @@ if ($count == 1) { ui_pagination($count); -if (!empty($result_groups)) { +if (empty($result_groups) === false) { echo ''; echo ''; echo ''; @@ -235,10 +235,17 @@ if (!empty($result_groups)) { echo ''; foreach ($result_groups as $data) { + if ((bool) $config['show_empty_groups'] === false + && $data['_total_agents_'] === 0 + && $data['_monitor_checks_'] === 0 + ) { + continue; + } + $groups_id = $data['_id_']; - // Calculate entire row color - if ($groups_id != 0) { + // Calculate entire row color. + if ($groups_id !== '0') { if ($data['_monitors_alerts_fired_'] > 0) { $color_class = 'group_view_alrm'; $status_image = ui_print_status_image('agent_alertsfired_ball.png', '', true); @@ -265,7 +272,7 @@ if (!empty($result_groups)) { echo ""; - // Force + // Force. echo "
"; if (!isset($data['_is_tag_']) && check_acl($config['id_user'], $data['_id_'], 'AW')) { echo ''.html_print_image(