Fix filter view for module table

This commit is contained in:
Jose Gonzalez 2023-01-10 12:03:16 +01:00
parent 60685cdccc
commit 313240378e
3 changed files with 39 additions and 60 deletions

View File

@ -115,17 +115,13 @@
} }
.info_table tr > td:first-child, .info_table tr > td:first-child,
.info_table tr > th:first-child, .info_table tr > th:first-child {
.filter_table tr > td:first-child,
.filter_table tr > th:first-child {
/*padding-left: 5px;*/ /*padding-left: 5px;*/
padding-left: 10px; padding-left: 10px;
border-left: 1px solid #c0ccdc; border-left: 1px solid #c0ccdc;
} }
.info_table tr > td:last-child, .info_table tr > td:last-child,
.info_table tr > th:last-child, .info_table tr > th:last-child {
.filter_table tr > td:last-child,
.filter_table tr > th:last-child {
/*padding-right: 5px;*/ /*padding-right: 5px;*/
padding-right: 10px; padding-right: 10px;
border-right: 1px solid #c0ccdc; border-right: 1px solid #c0ccdc;

View File

@ -786,11 +786,11 @@ if ($last_incident != false) {
$network_interfaces_by_agents = agents_get_network_interfaces([$agent]); $network_interfaces_by_agents = agents_get_network_interfaces([$agent]);
$network_interfaces = []; $network_interfaces = [];
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) { if (empty($network_interfaces_by_agents) === false && empty($network_interfaces_by_agents[$id_agente]) === false) {
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces']; $network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
} }
if (!empty($network_interfaces)) { if (empty($network_interfaces) === false) {
$table_interface = new stdClass(); $table_interface = new stdClass();
$table_interface->id = 'agent_interface_info'; $table_interface->id = 'agent_interface_info';
$table_interface->class = 'info_table'; $table_interface->class = 'info_table';
@ -818,7 +818,7 @@ if (!empty($network_interfaces)) {
$event_text_cont = 0; $event_text_cont = 0;
foreach ($network_interfaces as $interface_name => $interface) { foreach ($network_interfaces as $interface_name => $interface) {
if (!empty($interface['traffic'])) { if (empty($interface['traffic']) === false) {
$permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR'); $permission = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
if ($permission) { if ($permission) {
@ -852,13 +852,13 @@ if (!empty($network_interfaces)) {
$events_limit = 5000; $events_limit = 5000;
$user_groups = users_get_groups($config['id_user'], 'ER'); $user_groups = users_get_groups($config['id_user'], 'ER');
$user_groups_ids = array_keys($user_groups); $user_groups_ids = array_keys($user_groups);
if (empty($user_groups)) { if (empty($user_groups) === true) {
$groups_condition = ' 1 = 0 '; $groups_condition = ' 1 = 0 ';
} else { } else {
$groups_condition = ' id_grupo IN ('.implode(',', $user_groups_ids).') '; $groups_condition = ' id_grupo IN ('.implode(',', $user_groups_ids).') ';
} }
if (!check_acl($config['id_user'], 0, 'PM')) { if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
$groups_condition .= ' AND id_grupo != 0'; $groups_condition .= ' AND id_grupo != 0';
} }
@ -1054,44 +1054,12 @@ $agentEvents = html_print_div(
true true
); );
/*
$table_events = '<div class="white_table_graph" id="table_events">';
$table_events .= '<div class="white_table_graph_header">';
$table_events .= html_print_image(
'images/arrow_down_green.png',
true
);
$table_events .= '<span>';
$table_events .= __('Events (Last 24h)');
$table_events .= '</span>';
$table_events .= '</div>';
$table_events .= '<div class="white_table_graph_content white-table-graph-content">';
$table_events .= graph_graphic_agentevents(
$id_agente,
95,
70,
SECONDS_1DAY,
'',
true,
true,
500
);
$table_events .= '</div>';
$table_events .= '</div>';
*/
/* /*
* EVENTS TABLE END. * EVENTS TABLE END.
*/ */
if (empty($data_opcional) === true) { if (isset($data_opcional) === false || isset($data_opcional->data) === false || empty($data_opcional->data) === true) {
$agentAdditionalInfo = ''; $agentAdditionalInfo = '';
} else { } else {
// if (count($table_data->data) === 1 && (bool) $config['activate_gis'] === true && $dataPositionAgent === false) {
if (empty($data_opcional) === true && (bool) $config['activate_gis'] === true && $dataPositionAgent === false) {
$agentAdditionalInfo = '';
} else {
// $agentAdditionalInfo = html_print_table($table_data, true);$agentAdditionalContent
$agentAdditionalInfo = ui_toggle( $agentAdditionalInfo = ui_toggle(
html_print_table($data_opcional, true), html_print_table($data_opcional, true),
'<span class="subsection_header_title">'.__('Agent data').'</span>', '<span class="subsection_header_title">'.__('Agent data').'</span>',
@ -1104,7 +1072,6 @@ if (empty($data_opcional) === true) {
'mrgn_lft_20px mrgn_right_20px w100p' 'mrgn_lft_20px mrgn_right_20px w100p'
); );
} }
}
$agentIncidents = (isset($table_incident) === false) ? '' : html_print_table($table_incident, true); $agentIncidents = (isset($table_incident) === false) ? '' : html_print_table($table_incident, true);
/* /*

View File

@ -546,8 +546,11 @@ function print_form_filter_monitors(
$table = new stdClass(); $table = new stdClass();
$table->class = 'filter_table'; $table->class = 'filter_table';
$table->id = 'module_filter_agent_view'; $table->id = 'module_filter_agent_view';
$table->styleTable = 'border-radius: 0;padding: 0;margin: 0;'; $table->styleTable = 'border-radius: 0;padding: 0;margin: 0 0 10px;';
$table->width = '100%'; $table->width = '100%';
$table->cellstyle[0][0] = 'width: 0';
$table->cellstyle[0][1] = 'width: 0';
$table->cellstyle[0][2] = 'width: 0';
// Captions. // Captions.
$table->data[0][0] = html_print_input_hidden('filter_monitors', 1, true); $table->data[0][0] = html_print_input_hidden('filter_monitors', 1, true);
$table->data[0][0] .= html_print_input_hidden('monitors_change_filter', 1, true); $table->data[0][0] .= html_print_input_hidden('monitors_change_filter', 1, true);
@ -593,7 +596,10 @@ function print_form_filter_monitors(
'id' => 'checkbox-status_hierachy_mode', 'id' => 'checkbox-status_hierachy_mode',
] ]
); );
$table->data[1][4] = html_print_button(
$filtersButtons = [];
$filtersButtons[] = html_print_button(
__('Filter'), __('Filter'),
'filter', 'filter',
false, false,
@ -604,7 +610,8 @@ function print_form_filter_monitors(
], ],
true true
); );
$table->data[1][5] = html_print_button(
$filtersButtons[] = html_print_button(
__('Reset'), __('Reset'),
'filter', 'filter',
false, false,
@ -615,6 +622,15 @@ function print_form_filter_monitors(
], ],
true true
); );
$table->data[1][4] = html_print_div(
[
'class' => 'action-buttons',
'content' => implode('', $filtersButtons),
],
true
);
$form_text .= html_print_table($table, true); $form_text .= html_print_table($table, true);
// TODO. Unused code. // TODO. Unused code.