From e024658520fff7731eeab2c25b7ec32d70484da9 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Mon, 27 Feb 2023 09:57:17 +0100 Subject: [PATCH] 10454-Events --- .../godmode/events/custom_events.php | 6 +- .../godmode/events/event_edit_filter.php | 801 +++++++++++------- .../godmode/events/event_filter.php | 60 +- pandora_console/include/ajax/events.php | 79 +- pandora_console/include/styles/events.css | 29 +- .../include/styles/pandora_black.css | 37 + pandora_console/include/styles/tables.css | 44 +- pandora_console/operation/events/events.php | 11 +- 8 files changed, 708 insertions(+), 359 deletions(-) diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index 4242b07208..627c81c27b 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -127,19 +127,21 @@ foreach ($fields_available as $key => $available) { $table->data[0][0] = ''.__('Fields available').''; $table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px'); $table->data[1][1] = ''.html_print_image( - 'images/darrowright_green.png', + 'images/arrow@svg.svg', true, [ 'id' => 'right', 'title' => __('Add fields to select'), + 'style' => 'rotate: 180deg; width: 40px', ] ).''; $table->data[1][1] .= '



'.html_print_image( - 'images/darrowleft_green.png', + 'images/arrow@svg.svg', true, [ 'id' => 'left', 'title' => __('Delete fields to select'), + 'style' => 'width: 40px', ] ).''; diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 30c2ab3ea5..5c4bdbaae9 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -262,12 +262,17 @@ if ($create) { $own_info = get_user_info($config['id_user']); $table = new stdClass(); -$table->width = '100%'; +$table->width = '1366px'; +// $table->width = '100%'; $table->border = 0; $table->cellspacing = 0; $table->cellpadding = 0; -$table->class = 'databox filters'; +$table->size[0] = '50%'; +$table->size[1] = '50%'; +$table->class = 'databox filters events-filters-create'; $table->style[0] = 'vertical-align: top;'; +$table->rowspan = []; +$table->rowspan[3][0] = 2; $table->valign[1] = 'top'; @@ -285,10 +290,22 @@ if (is_metaconsole()) { } $table->data = []; -$table->data[0][0] = ''.__('Filter name').''; -$table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true); -$table->data[1][0] = ''.__('Save in group').''.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true); +$table->data[0][0] = html_print_label_input_block( + __('Filter name'), + html_print_input_text( + 'id_name', + $id_name, + false, + 20, + 80, + true, + false, + false, + '', + 'w100p' + ) +); $returnAllGroup = users_can_manage_group_all(); // If the user can't manage All group but the filter is for All group, the user should see All group in the select. @@ -296,115 +313,135 @@ if ($returnAllGroup === false && $id_group_filter == 0) { $returnAllGroup = true; } -$table->data[1][1] = '
'.html_print_select_groups( - $config['id_user'], - $access, - $returnAllGroup, - 'id_group_filter', - $id_group_filter, - '', - '', - -1, - true, - false, - false, - '', - false, - '', - false, - false, - 'id_grupo', - $strict_user -).'
'; - +$table->data[0][1] = html_print_label_input_block( + __('Save in group').ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true), + '
'.html_print_select_groups( + $config['id_user'], + $access, + $returnAllGroup, + 'id_group_filter', + $id_group_filter, + '', + '', + -1, + true, + false, + false, + '', + false, + '', + false, + false, + 'id_grupo', + $strict_user + ).'
' +); $return_all_group = false; if (users_can_manage_group_all('AR') === true) { $return_all_group = true; } -$table->data[2][0] = ''.__('Group').''; $display_all_group = (users_is_admin() || users_can_manage_group_all('AR')); -$table->data[2][1] = '
'.html_print_select_groups( - $config['id_user'], - 'AR', - $return_all_group, - 'id_group', - $id_group, - '', - '', - '', - true -).'
'; +$table->data[2][0] = html_print_label_input_block( + __('Group'), + '
'.html_print_select_groups( + $config['id_user'], + 'AR', + $return_all_group, + 'id_group', + $id_group, + '', + '', + '', + true + ).'
' +); $types = get_event_types(); // Expand standard array to add not_normal (not exist in the array, used only for searches) $types['not_normal'] = __('Not normal'); - -$table->data[3][0] = ''.__('Event type').''; -$table->data[3][1] = html_print_select( - $types, - 'event_type', - $event_type, - '', - __('All'), - '', - true +$table->data[2][1] = html_print_label_input_block( + __('Event type'), + '
'.html_print_select( + $types, + 'event_type', + $event_type, + '', + __('All'), + '', + true, + false, + false, + 'w100p' + ).'
' ); if (empty($severity) && $severity !== '0') { $severity = -1; } -$table->data[4][0] = ''.__('Severity').''; -$table->data[4][1] = html_print_select( - get_priorities(), - 'severity[]', - $severity, - '', - __('All'), - -1, - true, - true, - true, - '', - false, - 'width: 175px' +$table->data[3][0] = html_print_label_input_block( + __('Severity'), + html_print_select( + get_priorities(), + 'severity[]', + $severity, + '', + __('All'), + -1, + true, + true, + true, + '', + false, + 'width: 100%' + ) ); $fields = events_get_all_status(); - -$table->data[5][0] = ''.__('Event status').''; -$table->data[5][1] = html_print_select( - $fields, - 'status', - $status, - '', - '', - '', - true +$table->data[3][1] = html_print_label_input_block( + __('Event status'), + html_print_select( + $fields, + 'status', + $status, + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%' + ) ); -$table->data[6][0] = ''.__('Free search').''; -$table->data[6][1] = html_print_input_text( - 'search', - $search, - '', - 15, - 255, - true -); -$table->data[6][1] .= ' '.html_print_checkbox_switch( - 'not_search', - $not_search, - $not_search, - true, - false, - 'checked_slide_events(this);', - true +$table->data[4][1] = html_print_label_input_block( + __('Free search'), + '
'.html_print_input_text( + 'search', + $search, + '', + 15, + 255, + true, + false, + false, + '', + 'w96p mrgn_right_15px' + ).' '.html_print_checkbox_switch( + 'not_search', + $not_search, + $not_search, + true, + false, + 'checked_slide_events(this);', + true + ).'
' ); -$table->data[7][0] = ''.__('Agent search').''; $params = []; $params['show_helptip'] = true; $params['input_name'] = 'text_agent'; @@ -419,39 +456,48 @@ if (is_metaconsole()) { $params['hidden_input_idagent_value'] = $id_agent; } -$table->data[7][1] = ui_print_agent_autocomplete_input($params); +$table->data[5][0] = html_print_label_input_block( + __('Agent search'), + '
'.ui_print_agent_autocomplete_input($params).'
' +); $lpagination[25] = 25; $lpagination[50] = 50; $lpagination[100] = 100; $lpagination[200] = 200; $lpagination[500] = 500; -$table->data[8][0] = ''.__('Block size for pagination').''; -$table->data[8][1] = html_print_select( - $lpagination, - 'pagination', - $pagination, - '', - __('Default'), - $config['block_size'], - true +$table->data[5][1] = html_print_label_input_block( + __('Block size for pagination'), + '
'.html_print_select( + $lpagination, + 'pagination', + $pagination, + '', + __('Default'), + $config['block_size'], + true, + false, + true, + '', + false, + 'width: 100%' + ).'
' ); -$table->data[9][0] = ''.__('Max. hours old').''; -$table->data[9][1] = html_print_input_text( - 'event_view_hr', - $event_view_hr, - '', - 5, - 255, - true -); - -$table->data[10][0] = ''.__('User ack.').''; -$table->data[10][0] .= ' '; -$table->data[10][0] .= ui_print_help_tip( - __('Choose between the users who have validated an event. '), - true +$table->data[6][0] = html_print_label_input_block( + __('Max. hours old'), + '
'.html_print_input_text( + 'event_view_hr', + $event_view_hr, + '', + 5, + 255, + true, + false, + false, + '', + 'w100p' + ).'
' ); if ($strict_user) { @@ -464,49 +510,96 @@ if ($strict_user) { ); } -$table->data[10][1] = html_print_select( - $users, - 'id_user_ack', - $id_user_ack, - '', - __('Any'), - 0, - true +$table->data[6][1] = html_print_label_input_block( + __('User ack.').' '.ui_print_help_tip( + __('Choose between the users who have validated an event. '), + true + ), + '
'.html_print_select( + $users, + 'id_user_ack', + $id_user_ack, + '', + __('Any'), + 0, + true, + false, + true, + 'w100p' + ).'
' ); -$table->data[11][0] = ''.__('Owner.').''; -$table->data[11][1] = html_print_select( - $users, - 'owner_user', - $owner_user, - '', - __('Any'), - 0, - true +$table->data[7][0] = html_print_label_input_block( + __('Owner.'), + '
'.html_print_select( + $users, + 'owner_user', + $owner_user, + '', + __('Any'), + 0, + true, + false, + true, + 'w100p' + ).'
' ); - $repeated_sel = [ EVENT_GROUP_REP_ALL => __('All events'), EVENT_GROUP_REP_EVENTS => __('Group events'), EVENT_GROUP_REP_AGENTS => __('Group agents'), EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'), ]; -$table->data[12][0] = ''.__('Repeated').''; -$table->data[12][1] = html_print_select( - $repeated_sel, - 'group_rep', - $group_rep, - '', - '', - '', - true + +$table->data[7][1] = html_print_label_input_block( + __('Repeated'), + '
'.html_print_select( + $repeated_sel, + 'group_rep', + $group_rep, + '', + '', + '', + true, + false, + true, + 'w100p' + ).'
' ); -$table->data[13][0] = ''.__('Date from').''; -$table->data[13][1] = html_print_input_text('date_from', $date_from, '', 15, 10, true); +$date_from = html_print_label_input_block( + __('Date from'), + '
'.html_print_input_text( + 'date_to', + $date_to, + '', + 15, + 10, + true, + false, + false, + '', + 'w100p' + ).'
' +); -$table->data[14][0] = ''.__('Date to').''; -$table->data[14][1] = html_print_input_text('date_to', $date_to, '', 15, 10, true); +$date_to = html_print_label_input_block( + __('Date from'), + '
'.html_print_input_text( + 'date_to', + $date_to, + '', + 15, + 10, + true, + false, + false, + '', + 'w100p' + ).'
' +); + +$table->data[8][0] = '
'.$date_from.$date_to.'
'; $tag_with = json_decode($tag_with_json_clean, true); if (empty($tag_with)) { @@ -545,176 +638,272 @@ $remove_with_tag_disabled = empty($tag_with_temp); $add_without_tag_disabled = empty($tags_select_without); $remove_without_tag_disabled = empty($tag_without_temp); -$table->colspan[15][0] = '2'; -$table->data[15][0] = ''.__('Events with following tags').''; -$table->data[16][0] = html_print_select( - $tags_select_with, - 'select_with', - '', - '', - '', - 0, - true, - false, - true, - '', - false, - 'width: 220px;' -); -$table->data[16][1] = html_print_button( - __('Add'), - 'add_whith', - $add_with_tag_disabled, - '', - 'class="add sub"', - true +$table->data[8][0] = html_print_label_input_block( + __('Events with following tags'), + '
'.html_print_select( + $tags_select_with, + 'select_with', + '', + '', + '', + 0, + true, + false, + true, + 'w100p' + ).'
' ); -$table->data[17][0] = html_print_select( - $tag_with_temp, - 'tag_with_temp', - [], - '', - '', - 0, - true, - true, - true, - '', - false, - 'width: 220px; height: 50px;' +$table->data[8][1] = html_print_label_input_block( + ' ', + '
'.html_print_button( + __('Add'), + 'add_whith', + $add_with_tag_disabled, + '', + ['class' => 'submitButton mini'], + true + ).'
' ); -$table->data[17][0] .= html_print_input_hidden( + +$table->data[9][0] = html_print_label_input_block( + '', + '
'.html_print_select( + $tag_with_temp, + 'tag_with_temp', + [], + '', + '', + 0, + true, + true, + true, + '', + false, + 'width: 100%; height: 50px;' + ).'
' +).html_print_input_hidden( 'tag_with', $tag_with_base64, true ); -$table->data[17][1] = html_print_button( - __('Remove'), - 'remove_whith', - $remove_with_tag_disabled, - '', - 'class="delete sub"', - true + +$table->data[9][1] = html_print_label_input_block( + ' ', + '
'.html_print_button( + __('Remove'), + 'remove_whith', + false, + '', + [ + 'mode' => 'link', + 'class' => 'submitButton', + ], + true + ).'
' ); -$table->colspan[18][0] = '2'; -$table->data[18][0] = ''.__('Events without following tags').''; -$table->data[19][0] = html_print_select( - $tags_select_without, - 'select_without', - '', - '', - '', - 0, - true, - false, - true, - '', - false, - 'width: 220px;' -); -$table->data[19][1] = html_print_button( - __('Add'), - 'add_whithout', - $add_without_tag_disabled, - '', - 'class="add sub"', - true +$table->data[10][0] = html_print_label_input_block( + __('Events without following tags'), + '
'.html_print_select( + $tags_select_without, + 'select_without', + '', + '', + '', + 0, + true, + false, + true, + 'w100p' + ).'
' ); -$table->data[20][0] = html_print_select( - $tag_without_temp, - 'tag_without_temp', - [], - '', - '', - 0, - true, - true, - true, - '', - false, - 'width: 220px; height: 50px;' +$table->data[10][1] = html_print_label_input_block( + ' ', + '
'.html_print_button( + __('Add'), + 'add_whithout', + $add_without_tag_disabled, + '', + ['class' => 'submitButton mini'], + true + ).'
' ); -$table->data[20][0] .= html_print_input_hidden( + +$table->data[11][0] = html_print_label_input_block( + '', + '
'.html_print_select( + $tag_without_temp, + 'tag_without_temp', + [], + '', + '', + 0, + true, + true, + true, + '', + false, + 'width: 100%; height: 50px;' + ).'
' +).html_print_input_hidden( 'tag_without', $tag_without_base64, true ); -$table->data[20][1] = html_print_button( - __('Remove'), - 'remove_whithout', - $remove_without_tag_disabled, - '', - 'class="delete sub"', - true + +$table->data[11][1] = html_print_label_input_block( + ' ', + '
'.html_print_button( + __('Remove'), + 'remove_whithout', + false, + '', + [ + 'mode' => 'link', + 'class' => 'submitButton', + ], + true + ).'
' ); -$table->data[21][0] = ''.__('Alert events').''; -$table->data[21][1] = html_print_select( - [ - '-1' => __('All'), - '0' => __('Filter alert events'), - '1' => __('Only alert events'), - ], - 'filter_only_alert', - $filter_only_alert, - '', - '', - '', - true +$table->data[12][0] = html_print_label_input_block( + __('Alert events'), + '
'.html_print_select( + [ + '-1' => __('All'), + '0' => __('Filter alert events'), + '1' => __('Only alert events'), + ], + 'filter_only_alert', + $filter_only_alert, + '', + '', + '', + true, + false, + true, + 'w100p' + ).'
' ); if (!is_metaconsole()) { - $table->data[22][0] = ''.__('Module search').''; - $table->data[22][1] .= html_print_autocomplete_modules( - 'module_search', - $text_module, - false, - true, - '', - [], - true, - $id_agent_module + $table->data[12][1] = html_print_label_input_block( + __('Module search'), + '
'.html_print_autocomplete_modules( + 'module_search', + $text_module, + false, + true, + '', + [], + true, + $id_agent_module + ).'
' ); +} else { + $table->data[12][1] = ''; } -$table->data[23][0] = ''.__('Source').''; -$table->data[23][1] = html_print_input_text('source', $source, '', 35, 255, true); - -$table->data[24][0] = ''.__('Extra ID').''; -$table->data[24][1] = html_print_input_text('id_extra', $id_extra, '', 11, 255, true); - -$table->data[25][0] = ''.__('Comment').''; -$table->data[25][1] = html_print_input_text('user_comment', $user_comment, '', 35, 255, true); - -$table->data[26][0] = ''.__('Custom data filter type').''; -$table->data[26][1] = html_print_select( - [ - '0' => __('Filter custom data by name field'), - '1' => __('Filter custom data by value field'), - ], - 'custom_data_filter_type', - $custom_data_filter_type, - '', - false, - '', - true -); - -$table->data[27][0] = ''.__('Custom data').''; -$table->data[27][1] = html_print_input_text('custom_data', $custom_data, '', 35, 255, true); - -if (is_metaconsole()) { - $table->data[28][0] = ''.__('Id souce event').''; - $table->data[28][1] = html_print_input_text( - 'id_source_event', - $id_source_event, +$table->data[13][0] = html_print_label_input_block( + __('Source'), + '
'.html_print_input_text( + 'source', + $source, '', 35, 255, - true + true, + false, + false, + '', + 'w100p' + ).'
' +); + +$table->data[13][1] = html_print_label_input_block( + __('Extra ID'), + '
'.html_print_input_text( + 'id_extra', + $id_extra, + '', + 11, + 255, + true, + false, + false, + '', + 'w100p' + ).'
' +); + +$table->data[14][0] = html_print_label_input_block( + __('Comment'), + '
'.html_print_input_text( + 'user_comment', + $user_comment, + '', + 35, + 255, + true, + false, + false, + '', + 'w100p' + ).'
' +); + +$table->data[14][1] = html_print_label_input_block( + __('Custom data filter type'), + '
'.html_print_select( + [ + '0' => __('Filter custom data by name field'), + '1' => __('Filter custom data by value field'), + ], + 'custom_data_filter_type', + $custom_data_filter_type, + '', + false, + '', + true, + false, + true, + 'w100p' + ).'
' +); + +$table->data[15][0] = html_print_label_input_block( + __('Custom data'), + '
'.html_print_input_text( + 'custom_data', + $custom_data, + '', + 35, + 255, + true, + false, + false, + '', + 'w100p' + ).'
' +); + +if (is_metaconsole()) { + $table->data[15][1] = html_print_label_input_block( + __('Id souce event'), + '
'.html_print_input_text( + 'id_source_event', + $id_source_event, + '', + 35, + 255, + true, + false, + false, + '', + 'w100p' + ).'
' ); } @@ -750,20 +939,20 @@ if (is_metaconsole() === true) { } } - $table->data[29][0] = ''.__('Server').''; - $table->data[29][1] = html_print_select( - $servers, - 'server_id[]', - $server_id, - '', - '', - 0, - true, - true, - true, - '', - false, - 'height: 60px;' + $table->data[16][0] = html_print_label_input_block( + __('Server'), + '
'.html_print_select( + $servers, + 'server_id[]', + $server_id, + '', + '', + 0, + true, + true, + true, + 'w100p' + ).'
' ); } @@ -775,12 +964,14 @@ echo '
'; if ($id) { html_print_input_hidden('update', 1); html_print_input_hidden('id', $id); - html_print_submit_button(__('Update'), 'crt', false, ['icon' => 'update']); + $actionButtons = html_print_submit_button(__('Update'), 'crt', false, ['icon' => 'update'], true); } else { html_print_input_hidden('create', 1); - html_print_submit_button(__('Create'), 'crt', false, ['icon' => 'wand']); + $actionButtons = html_print_submit_button(__('Create'), 'crt', false, ['icon' => 'wand'], true); } +html_print_action_buttons($actionButtons, ['type' => 'form_action']); + echo '
'; echo ''; diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php index ca75e6ff27..ed47ce8caf 100644 --- a/pandora_console/godmode/events/event_filter.php +++ b/pandora_console/godmode/events/event_filter.php @@ -198,37 +198,57 @@ foreach ($filters as $filter) { array_push($table->data, $data); } + if (isset($data)) { - echo "
"; + echo ""; html_print_input_hidden('multiple_delete', 1); html_print_table($table); - if (!is_metaconsole()) { - echo "
"; - } else { + if (is_metaconsole() === true) { echo "
"; } - html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); + if (is_metaconsole() === true) { echo '
'; + } + echo ''; } else { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined filters') ]); } -echo '
'; -html_print_div( + +$submitButtons = ''; +$submitButtons .= html_print_submit_button( + __('Create filter'), + 'crt', + false, [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Create filter'), - 'crt', - false, - [ 'icon' => 'wand' ], - true - ), + 'icon' => 'wand', + 'class' => 'mrgn_lft_15px', + ], + true +); +$submitButtons .= '
'; + +$submitButtons .= html_print_submit_button( + __('Delete'), + 'delete_btn', + false, + [ + 'icon' => 'delete', + 'class' => 'secondary', + 'id' => 'delete-event-filters', + ], + true +); + +html_print_action_buttons( + $submitButtons, + [ + 'type' => 'form_action', + 'id' => 'list-events-filters', ] ); -echo ''; ?>