Merge branch 'ent-8302-Añadir-opción-de-mostrar-solo-grupos-con-datos-en-Group-view' into 'develop'

Ent 8302 añadir opción de mostrar solo grupos con datos en group view

https://brutus.artica.es:8081/artica/pandora_enterprise/-/issues/8302

See merge request artica/pandorafms!4949
This commit is contained in:
Jimmy Olano 2022-07-01 10:47:27 +00:00
commit c074cd81bf
3 changed files with 29 additions and 5 deletions

View File

@ -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] = '<em>'.__('Example').'</em> '.date($config['date_format']);
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);

View File

@ -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);
}

View File

@ -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 '<table cellpadding="0" cellspacing="0" class="databox data mrgn_top_10px" border="0" width="100%">';
echo '<tr>';
echo '<th colspan=2 ></th>';
@ -235,10 +235,17 @@ if (!empty($result_groups)) {
echo '</tr>';
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 "<tr class='height_35px'>";
// Force
// Force.
echo "<td class='group_view_data center vertical_middle'>";
if (!isset($data['_is_tag_']) && check_acl($config['id_user'], $data['_id_'], 'AW')) {
echo '<a href="index.php?sec=estado&sec2=operation/agentes/group_view&update_netgroup='.$data['_id_'].'">'.html_print_image(