diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 9b38279e21..a7d06810b6 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -26,6 +26,9 @@ * ============================================================================ */ +// Begin. +global $config; + require_once 'include/functions_events.php'; require_once 'include/functions_agents.php'; require_once 'include/functions_ui.php'; @@ -35,6 +38,21 @@ require_once 'include/functions.php'; enterprise_include_once('meta/include/functions_events_meta.php'); enterprise_include_once('include/functions_metaconsole.php'); +// Check access. +check_login(); + +if (! check_acl($config['id_user'], 0, 'ER') + && ! check_acl($config['id_user'], 0, 'EW') + && ! check_acl($config['id_user'], 0, 'EM') +) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access event viewer' + ); + include 'general/noaccess.php'; + return; +} + $get_events_details = (bool) get_parameter('get_events_details'); $get_list_events_agents = (bool) get_parameter('get_list_events_agents'); $get_extended_event = (bool) get_parameter('get_extended_event'); @@ -55,6 +73,567 @@ $total_events = (bool) get_parameter('total_events'); $total_event_graph = (bool) get_parameter('total_event_graph'); $graphic_event_group = (bool) get_parameter('graphic_event_group'); $get_table_response_command = (bool) get_parameter('get_table_response_command'); +$save_filter_modal = get_parameter('save_filter_modal', 0); +$load_filter_modal = get_parameter('load_filter_modal', 0); +$save_filter = get_parameter('save_filter', 0); +$get_filter_values = get_parameter('get_filter_values', 0); +$update_event_filter = get_parameter('update_event_filter', 0); +$save_event_filter = get_parameter('save_event_filter', 0); + +// Saves an event filter. +if ($save_event_filter) { + $values = []; + $values['id_name'] = get_parameter('id_name'); + $values['id_group'] = get_parameter('id_group'); + $values['event_type'] = get_parameter('event_type'); + $values['severity'] = get_parameter('severity'); + $values['status'] = get_parameter('status'); + $values['search'] = get_parameter('search'); + $values['text_agent'] = get_parameter('text_agent'); + $values['id_agent'] = get_parameter('id_agent'); + $values['id_agent_module'] = get_parameter('id_agent_module'); + $values['pagination'] = get_parameter('pagination'); + $values['event_view_hr'] = get_parameter('event_view_hr'); + $values['id_user_ack'] = get_parameter('id_user_ack'); + $values['group_rep'] = get_parameter('group_rep'); + $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); + $values['tag_without'] = get_parameter( + 'tag_without', + io_json_mb_encode([]) + ); + $values['filter_only_alert'] = get_parameter('filter_only_alert'); + $values['id_group_filter'] = get_parameter('id_group_filter'); + $values['date_from'] = get_parameter('date_from'); + $values['date_to'] = get_parameter('date_to'); + $values['source'] = get_parameter('source'); + $values['id_extra'] = get_parameter('id_extra'); + $values['user_comment'] = get_parameter('user_comment'); + + $exists = (bool) db_get_value_filter( + 'id_filter', + 'tevent_filter', + $values + ); + + if ($exists) { + echo 'duplicate'; + } else { + $result = db_process_sql_insert('tevent_filter', $values); + + if ($result === false) { + echo 'error'; + } else { + echo $result; + } + } +} + +if ($update_event_filter) { + $values = []; + $id = get_parameter('id'); + $values['id_group'] = get_parameter('id_group'); + $values['event_type'] = get_parameter('event_type'); + $values['severity'] = get_parameter('severity'); + $values['status'] = get_parameter('status'); + $values['search'] = get_parameter('search'); + $values['text_agent'] = get_parameter('text_agent'); + $values['id_agent'] = get_parameter('id_agent'); + $values['id_agent_module'] = get_parameter('id_agent_module'); + $values['pagination'] = get_parameter('pagination'); + $values['event_view_hr'] = get_parameter('event_view_hr'); + $values['id_user_ack'] = get_parameter('id_user_ack'); + $values['group_rep'] = get_parameter('group_rep'); + $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([])); + $values['tag_without'] = get_parameter( + 'tag_without', + io_json_mb_encode([]) + ); + $values['filter_only_alert'] = get_parameter('filter_only_alert'); + $values['id_group_filter'] = get_parameter('id_group_filter'); + $values['date_from'] = get_parameter('date_from'); + $values['date_to'] = get_parameter('date_to'); + $values['source'] = get_parameter('source'); + $values['id_extra'] = get_parameter('id_extra'); + $values['user_comment'] = get_parameter('user_comment'); + + if (io_safe_output($values['tag_with']) == '["0"]') { + $values['tag_with'] = '[]'; + } + + if (io_safe_output($values['tag_without']) == '["0"]') { + $values['tag_without'] = '[]'; + } + + $result = db_process_sql_update( + 'tevent_filter', + $values, + ['id_filter' => $id] + ); + + if ($result === false) { + echo 'error'; + } else { + echo 'ok'; + } +} + +// Get db values of a single filter. +if ($get_filter_values) { + $id_filter = get_parameter('id'); + + $event_filter = events_get_event_filter($id_filter); + + $event_filter['search'] = io_safe_output($event_filter['search']); + $event_filter['id_name'] = io_safe_output($event_filter['id_name']); + $event_filter['tag_with'] = base64_encode( + io_safe_output($event_filter['tag_with']) + ); + $event_filter['tag_without'] = base64_encode( + io_safe_output($event_filter['tag_without']) + ); + + echo io_json_mb_encode($event_filter); +} + +if ($load_filter_modal) { + $current = get_parameter('current_filter', ''); + $filters = events_get_event_filter_select(); + $user_groups_array = users_get_groups_for_select( + $config['id_user'], + $access, + true, + true, + false + ); + + echo '
'; + $table = new StdClass; + $table->id = 'load_filter_form'; + $table->width = '100%'; + $table->cellspacing = 4; + $table->cellpadding = 4; + $table->class = 'databox'; + if (is_metaconsole()) { + $table->cellspacing = 0; + $table->cellpadding = 0; + $table->class = 'databox filters'; + } + + $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; + if (!is_metaconsole()) { + $table->style[0] = 'width: 50%; width:50%;'; + } + + $data = []; + $table->rowid[3] = 'update_filter_row1'; + $data[0] = __('Load filter').$jump; + $data[0] .= html_print_select( + $filters, + 'filter_id', + $current, + '', + __('None'), + 0, + true + ); + $data[1] = html_print_submit_button( + __('Load filter'), + 'load_filter', + false, + 'class="sub upd" onclick="load_form_filter();"', + true + ); + $table->data[] = $data; + $table->rowclass[] = ''; + + html_print_table($table); + echo '
'; + ?> + + '; + if (check_acl($config['id_user'], 0, 'EW') + || check_acl($config['id_user'], 0, 'EM') + ) { + echo '
'; + $table = new StdClass; + $table->id = 'save_filter_form'; + $table->width = '100%'; + $table->cellspacing = 4; + $table->cellpadding = 4; + $table->class = 'databox'; + if (is_metaconsole()) { + $table->class = 'databox filters'; + $table->cellspacing = 0; + $table->cellpadding = 0; + } + + $table->styleTable = 'font-weight: bold; text-align:left;'; + if (!is_metaconsole()) { + $table->style[0] = 'width: 50%; width:50%;'; + } + + $data = []; + $table->rowid[0] = 'update_save_selector'; + $data[0] = html_print_radio_button( + 'filter_mode', + 'new', + '', + true, + true + ).__('New filter').''; + + $data[1] = html_print_radio_button( + 'filter_mode', + 'update', + '', + false, + true + ).__('Update filter').''; + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[1] = 'save_filter_row1'; + $data[0] = __('Filter name').$jump; + $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true); + if (is_metaconsole()) { + $data[1] = __('Save in Group').$jump; + } else { + $data[1] = __('Filter group').$jump; + } + + $data[1] .= html_print_select( + $user_groups_array, + 'id_group_filter', + $id_group_filter, + '', + '', + 0, + true, + false, + false, + 'w130' + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[2] = 'save_filter_row2'; + + $table->data[] = $data; + $table->rowclass[] = ''; + + $data = []; + $table->rowid[3] = 'update_filter_row1'; + $data[0] = __('Overwrite filter').$jump; + // Fix : Only admin user can see filters of group ALL for update. + $_filters_update = events_get_event_filter_select(false); + + $data[0] .= html_print_select( + $_filters_update, + 'overwrite_filter', + '', + '', + '', + 0, + true + ); + $data[1] = html_print_submit_button( + __('Update filter'), + 'update_filter', + false, + 'class="sub upd" onclick="save_update_filter();"', + true + ); + + $table->data[] = $data; + $table->rowclass[] = ''; + + html_print_table($table); + echo '
'; + echo html_print_submit_button( + __('Save filter'), + 'save_filter', + false, + 'class="sub upd" style="float:right;" onclick="save_new_filter();"', + true + ); + echo '
'; + } else { + include 'general/noaccess.php'; + } + + echo ''; + ?> + + "; + $tabs = "'; diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 29acf27c30..0011167308 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -2847,7 +2847,7 @@ class NetworkMap __('Node Details'), '', false, - false + true ); $output .= ''; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index a534b9e715..db6a679941 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -393,6 +393,7 @@ function events_get_all( } $tgrupo_join = 'LEFT'; + $tgrupo_join_filters = []; if (isset($filter['id_group_filter']) && $filter['id_group_filter'] > 0) { $tgrupo_join = 'INNER'; $tgrupo_join_filters[] = sprintf( @@ -405,8 +406,21 @@ function events_get_all( db_process_sql('SET group_concat_max_len = 9999999'); $event_lj = events_get_secondary_groups_left_join($table); + $group_selects = ''; + if ($group_by != '') { + if ($fields['0'] != 'count') { + $group_selects = ',GROUP_CONCAT(DISTINCT user_comment SEPARATOR "
") AS user_comment, + GROUP_CONCAT(DISTINCT id_evento SEPARATOR ",") AS similar_ids, + COUNT(id_evento) AS event_rep, MAX(utimestamp) AS timestamp_rep, + MIN(utimestamp) AS timestamp_rep_min'; + + unset($fields[array_search('te.user_comment', $fields)]); + } + } + $sql = sprintf( 'SELECT %s + %s FROM %s %s %s JOIN tagente ta @@ -422,6 +436,7 @@ function events_get_all( %s ', join(',', $fields), + $group_selects, $tevento, $event_lj, $tagente_join, diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 6200ab63e2..6f41f87f33 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2801,8 +2801,18 @@ function ui_progress( * 'column2', * ... * ], + * 'no_sortable_columns' => [ indexes ] 1,2... -1 etc. Avoid sorting. * 'form' => [ * 'html' => 'html code' a directly defined inputs in HTML. + * 'extra_buttons' => [ + * [ + * 'id' => button id, + * 'class' => button class, + * 'style' => button style, + * 'text' => button text, + * 'onclick' => button onclick, + * ] + * ], * 'search_button_class' => search button class. * 'class' => form class. * 'id' => form id. @@ -2850,6 +2860,11 @@ function ui_print_datatable(array $parameters) $parameters['default_pagination'] = $config['block_size']; } + $no_sortable_columns = []; + if (isset($parameters['no_sortable_columns'])) { + $no_sortable_columns = json_encode($parameters['no_sortable_columns']); + } + if (!is_array($parameters['order'])) { $order = '0, "asc"'; } else { @@ -2877,7 +2892,7 @@ function ui_print_datatable(array $parameters) $parameters['ajax_data'] = ''; } - $search_button_class = 'sub search'; + $search_button_class = 'sub filter'; if (isset($parameters['search_button_class'])) { $search_button_class = $parameters['search_button_class']; } @@ -2977,8 +2992,19 @@ function ui_print_datatable(array $parameters) $filter .= ''; } - // Search button. $filter .= '
  • '; + if (is_array($parameters['form']['extra_buttons'])) { + foreach ($parameters['form']['extra_buttons'] as $button) { + $filter .= ''; + } + } + + // Search button. $filter .= ''; $filter .= '
  • '; @@ -3078,7 +3104,9 @@ function ui_print_datatable(array $parameters) if (isset($parameters['ajax_postprocess'])) { $js .= ' if (json.data) { - json.data.forEach('.$parameters['ajax_postprocess'].'); + json.data.forEach(function(item) { + '.$parameters['ajax_postprocess'].' + }); } else { json.data = {}; }'; @@ -3110,7 +3138,8 @@ function ui_print_datatable(array $parameters) } }, "columnDefs": [ - { className: "no-class", targets: "_all" } + { className: "no-class", targets: "_all" }, + { bSortable: false, targets: '.$no_sortable_columns.' } ], columns: ['; diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 1f1ff42c3f..4182cb0476 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -56,8 +56,8 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) { opacity: 0.5, background: "black" }, - width: 725, - height: 530 + width: 850, + height: 750 }) .show(); diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 13bafabca3..a6b747a5b7 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -12,7 +12,7 @@ div.criticity { } div.mini-criticity { - width: 5px; + width: 10px; height: 3em; padding: 0; margin: 0; @@ -184,3 +184,117 @@ fieldset { border: none; margin-top: -2em; } + +/* Image open dialog in group events by agents*/ +#open_agent_groups { + cursor: pointer; +} + +.table_modal_alternate { + border-spacing: 0px; + text-align: left; +} + +/* Modal window - Show More */ +table.table_modal_alternate tr:nth-child(odd) td { + background-color: #ffffff; +} + +table.table_modal_alternate tr:nth-child(even) td { + background-color: #f9f9f9; + border-top: 1px solid #e0e0e0; + border-bottom: 1px solid #e0e0e0; +} + +table.table_modal_alternate tr td { + height: 33px; + max-height: 33px; + min-height: 33px; +} + +table.table_modal_alternate tr td:first-child { + width: 35%; + font-weight: bold; + padding-left: 20px; +} + +ul.events_tabs { + background: #ffffff; + border: 0px; + display: flex; + justify-content: space-between; + padding: 0px; +} + +ul.events_tabs:before, +ul.events_tabs:after { + content: none; +} + +ul.events_tabs > li { + margin: 0; + width: 100%; + text-align: center; + float: none; + outline-width: 0; +} + +ul.events_tabs > li.ui-state-default { + background: #fff; + border: none; + border-bottom: 2px solid #cacaca; +} + +ul.events_tabs > li a { + text-align: center; + float: none; + padding: 8px; + display: block; +} + +ul.events_tabs > li span { + position: relative; + top: -6px; + left: 5px; + margin-right: 10px; +} + +ul.events_tabs > li.ui-tabs-active { + border: none; +} + +ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header { + background: none; + margin: 0; + margin-bottom: -1px; + border: none; +} + +ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header + li { + padding: 0.5em; +} + +ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header + li + > a { + display: flex; + align-items: center; + flex-direction: row; +} +ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header + li + > a + > img { + margin-right: 0.3em; +} + +li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab { + border-bottom: 1px solid #ccc; +} +li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active { + border-bottom: 1px solid #fff; +} +div.extended_event_pages.ui-tabs-panel.ui-corner-bottom.ui-widget-content { + border-top: 1px solid #a9a9a9; +} diff --git a/pandora_console/include/styles/js/jquery-ui_custom.css b/pandora_console/include/styles/js/jquery-ui_custom.css index ac19de900c..6f707d174e 100644 --- a/pandora_console/include/styles/js/jquery-ui_custom.css +++ b/pandora_console/include/styles/js/jquery-ui_custom.css @@ -88,8 +88,7 @@ background-image: url(../images/ui-icons_444444_256x240.png); } .ui-widget-content { - background: #ffffff url(../images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% - repeat-x; + background: #fff; } .ui-state-default, .ui-widget-content .ui-state-default, @@ -97,8 +96,7 @@ margin-top: 3px; border: 1px solid #d3d3d3; border-bottom: 0; - background: #e6e6e6 url(../images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% - repeat-x; + background: #e6e6e6; font-weight: normal; color: #555555; } @@ -139,7 +137,7 @@ } .ui-dialog .ui-widget-header { background-color: #82b92e; - margin: -1px; + margin: -1px -1px 0px -1px; } .ui_tpicker_hour, .ui_tpicker_minute, @@ -213,8 +211,7 @@ a.ui-button:active, .ui-widget-header .ui-state-hover { border: 1px solid #999999; border-bottom: 0; - background: #dadada url(../images/ui-bg_glass_75_dadada_1x400.png) 50% 50% - repeat-x; + background: #dadada; } .ui-state-active, @@ -222,8 +219,7 @@ a.ui-button:active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; border-bottom: 0; - background: #ffffff url(../images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% - repeat-x; + background: #ffffff; font-weight: normal; color: #212121; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 5034d60069..b6862db108 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -517,6 +517,9 @@ select:-internal-list-box { .padding-6 { padding: 6em; } +.margin-right-2 { + margin-right: 2em; +} .no-border { border: none; } @@ -544,6 +547,12 @@ select:-internal-list-box { .td-bg-white td { background: #fff; } +.float-left { + float: left; +} +.float-right { + float: right; +} div#page { background: #fbfbfb; @@ -632,6 +641,7 @@ p.center { } /* --- Botones --- */ +button.sub, input.sub { font-weight: normal; -moz-border-radius: 2px; @@ -645,10 +655,24 @@ input.sub { padding-bottom: 10px; padding-top: 10px; padding-left: 15px; - border-color: #888; + border: 1px solid #888; font-family: "lato", "Open Sans", sans-serif; + cursor: pointer; } +button.sub:hover, +input.sub:hover { + border: 1px solid #333; +} + +button.sub:active, +input.sub:active { + border: 1px solid #000; + color: #333; + background-color: #e1e1e1; +} + +button.sub[disabled], input.sub[disabled] { color: #b4b4b4; background-color: #f3f3f3; @@ -1519,6 +1543,24 @@ div#logo_text3 { text-align: right; } +button.next, +button.upd, +button.ok, +button.wand, +button.delete, +button.cog, +button.target, +button.search, +button.copy, +button.add, +button.graph, +button.percentile, +button.binary, +button.camera, +button.config, +button.filter, +button.cancel, +button.default, input.next, input.upd, input.ok, @@ -1534,6 +1576,7 @@ input.percentile, input.binary, input.camera, input.config, +input.filter, input.cancel, input.default, input.filter, @@ -1542,75 +1585,99 @@ input.spinn { padding-right: 30px; } +button.next, input.next { background-image: url(../../images/input_go.png); } +button.upd, input.upd { background-image: url(../../images/input_update.png); } +button.wand, input.wand { background-image: url(../../images/input_wand.png); } +button.wand:disabled, input.wand:disabled { background-image: url(../../images/input_wand.disabled.png); } +button.search, input.search { background-image: url(../../images/input_zoom.png); } +button.search:disabled, input.search:disabled { background-image: url(../../images/input_zoom.disabled.png); } +button.ok, input.ok { background-image: url(../../images/input_tick.png); } +button.ok:disabled, input.ok:disabled { background-image: url(../../images/input_tick.disabled.png); } +button.add, input.add { background-image: url(../../images/input_add.png); } +button.add:disabled, input.add:disabled { background-image: url(../../images/input_add.disabled.png); } +button.cancel, input.cancel { background-image: url(../../images/input_cross.png); } +button.cancel:disabled, input.cancel:disabled { background-image: url(../../images/input_cross.disabled.png); } +button.delete, input.delete { background-image: url(../../images/input_delete.png); } +button.delete:disabled, input.delete:disabled { background-image: url(../../images/input_delete.disabled.png); } +button.cog, input.cog { background-image: url(../../images/input_cog.png); } +button.cog:disabled, input.cog:disabled { background-image: url(../../images/input_cog.disabled.png); } +button.config, input.config { background-image: url(../../images/input_config.png); } +button.config:disabled, input.config:disabled { background-image: url(../../images/input_config.disabled.png); } +button.filter, input.filter { background-image: url(../../images/input_filter.png); } +button.filter:disabled, input.filter:disabled { background-image: url(../../images/input_filter.disabled.png); } +button.pdf, input.pdf { background-image: url(../../images/input_pdf.png); } +button.pdf:disabled, input.pdf:disabled { background-image: url(../../images/input_pdf.disabled.png); } +button.camera, input.camera { background-image: url(../../images/input_camera.png); } +button.spinn, input.spinn { background-image: url(../../images/spinner_green.gif); } @@ -3491,90 +3558,6 @@ div.simple_value > a > span.text p { white-space: pre; } -/* - * --------------------------------------------------------------------- - * - EVENTS - - * --------------------------------------------------------------------- - */ -/* Image open dialog in group events by agents*/ -#open_agent_groups { - cursor: pointer; -} - -.table_modal_alternate { - border-spacing: 0px; - text-align: left; -} - -/* Modal window - Show More */ -table.table_modal_alternate tr:nth-child(odd) td { - background-color: #ffffff; -} - -table.table_modal_alternate tr:nth-child(even) td { - background-color: #f9f9f9; - border-top: 1px solid #e0e0e0; - border-bottom: 1px solid #e0e0e0; -} - -table.table_modal_alternate tr td { - height: 33px; - max-height: 33px; - min-height: 33px; -} - -table.table_modal_alternate tr td:first-child { - width: 35%; - font-weight: bold; - padding-left: 20px; -} - -ul.events_tabs { - background: #ffffff; - border: 0px; - display: flex; - justify-content: space-between; - padding: 0px; -} - -ul.events_tabs:before, -ul.events_tabs:after { - content: none; -} - -ul.events_tabs > li { - margin: 0; - width: 100%; - text-align: center; - float: none; - outline-width: 0; -} - -ul.events_tabs > li.ui-state-default { - background: #fff; - border: none; - border-bottom: 2px solid #cacaca; -} - -ul.events_tabs > li a { - text-align: center; - float: none; - padding: 8px; - display: block; -} - -ul.events_tabs > li span { - position: relative; - top: -6px; - left: 5px; - margin-right: 10px; -} - -ul.events_tabs > li.ui-tabs-active { - border-bottom: 2px solid #82b92e; - border-top: 2px solid #82b92e; -} - /* * --------------------------------------------------------------------- * - modal window and edit user - diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index fdc4d4e4a1..705c2ea7f0 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -109,7 +109,30 @@ if (is_ajax()) { $events = events_get_all( [ - 'te.*', + 'te.id_evento', + 'te.id_agente', + 'te.id_usuario', + 'te.id_grupo', + 'te.estado', + 'te.timestamp', + 'te.evento', + 'te.utimestamp', + 'te.event_type', + 'te.id_agentmodule', + 'te.id_alert_am', + 'te.criticity', + 'te.user_comment', + 'te.tags', + 'te.source', + 'te.id_extra', + 'te.critical_instructions', + 'te.warning_instructions', + 'te.unknown_instructions', + 'te.owner_user', + 'te.ack_utimestamp', + 'te.custom_data', + 'te.data', + 'te.module_status', 'ta.alias as agent_name', 'tg.nombre as group_name', ], @@ -687,6 +710,21 @@ $in = '
    '; $in .= $data.'
    '; $inputs[] = $in; +$buttons = []; + +$buttons[] = [ + 'id' => 'load-filter', + 'class' => 'float-left margin-right-2 sub config', + 'text' => __('Load filter'), + 'onclick' => '', +]; + +$buttons[] = [ + 'id' => 'save-filter', + 'class' => 'float-left margin-right-2 sub wand', + 'text' => __('Save filter'), + 'onclick' => '', +]; /* * Advanced filter. @@ -1010,7 +1048,7 @@ try { $active_filters_div .= __('Any time.'); } else if ($event_view_hr == 1) { $active_filters_div .= __('Last hour.'); - } else if ($event_view_hr == 2) { + } else if ($event_view_hr > 1) { $active_filters_div .= __('Last %d hours.', $event_view_hr); } @@ -1039,18 +1077,19 @@ try { // Print datatable. ui_print_datatable( [ - 'id' => 'events', - 'class' => 'info_table events', - 'style' => 'width: 100%;', - 'ajax_url' => 'operation/events/events', - 'ajax_data' => ['get_events' => 1], - 'form' => [ - 'class' => 'flex-row', - 'html' => $filter, - 'inputs' => [], + 'id' => 'events', + 'class' => 'info_table events', + 'style' => 'width: 100%;', + 'ajax_url' => 'operation/events/events', + 'ajax_data' => ['get_events' => 1], + 'form' => [ + 'class' => 'flex-row', + 'html' => $filter, + 'inputs' => [], + 'extra_buttons' => $buttons, ], - 'extra_html' => $active_filters_div, - 'pagination_options' => [ + 'extra_html' => $active_filters_div, + 'pagination_options' => [ [ $config['block_size'], 10, @@ -1072,136 +1111,14 @@ try { 'All', ], ], - 'order' => [ + 'order' => [ 'field' => 'timestamp', 'direction' => 'desc', ], - 'column_names' => $column_names, - 'columns' => $fields, - 'ajax_postprocess' => ' - function (item) { - var color = "'.COL_UNKNOWN.'"; - var text = "UNKNOWN"; - switch (item.criticity) { - case "'.EVENT_CRIT_CRITICAL.'": - text = "CRITICAL"; - color = "'.COL_CRITICAL.'"; - break; - - case "'.EVENT_CRIT_MAINTENANCE.'": - text = "MAINTENANCE"; - color = "'.COL_MAINTENANCE.'"; - break; - - case "'.EVENT_CRIT_INFORMATIONAL.'": - text = "INFORMATIONAL"; - color = "'.COL_INFORMATIONAL.'"; - break; - - case "'.EVENT_CRIT_MAJOR.'": - text = "MAJOR"; - color = "'.COL_MAJOR.'"; - break; - - case "'.EVENT_CRIT_MINOR.'": - text = "MINOR"; - color = "'.COL_MINOR.'"; - break; - - case "'.EVENT_CRIT_NORMAL.'": - text = "NORMAL"; - color = "'.COL_NORMAL.'"; - break; - - case "'.EVENT_CRIT_WARNING.'": - text = "WARNING"; - color = "'.COL_WARNING.'"; - break; - } - output = \'
    \'; - output += \'
    \'; - - evn = \'
    \'; - evn += \'
    \'; - evn += item.evento+\'
    \'; - evn += output; - evn += \'
    \' - - item.evento = evn; - item.criticity = \'
    \' + text + "
    "; - - - // Event type. - switch (item.event_type) { - case "'.EVENTS_ALERT_FIRED.'": - case "'.EVENTS_ALERT_RECOVERED.'": - case "'.EVENTS_ALERT_CEASED.'": - case "'.EVENTS_ALERT_MANUAL_VALIDATION.'": - text = "'.__('ALERT').'"; - color = "'.COL_ALERTFIRED.'"; - break; - - case "'.EVENTS_RECON_HOST_DETECTED.'": - case "'.EVENTS_SYSTEM.'": - case "'.EVENTS_ERROR.'": - case "'.EVENTS_NEW_AGENT.'": - case "'.EVENTS_CONFIGURATION_CHANGE.'": - text = "'.__('SYSTEM').'"; - color = "'.COL_MAINTENANCE.'"; - break; - - case "'.EVENTS_GOING_UP_WARNING.'": - case "'.EVENTS_GOING_DOWN_WARNING.'": - $tex = "'.__('WARNING').'"; - color = "'.COL_WARNING.'"; - break; - - case "'.EVENTS_GOING_DOWN_NORMAL.'": - case "'.EVENTS_GOING_UP_NORMAL.'": - text = "'.__('NORMAL').'"; - color = "'.COL_NORMAL.'"; - break; - - case "'.EVENTS_GOING_DOWN_CRITICAL.'": - case "'.EVENTS_GOING_UP_CRITICAL.'": - text = "'.__('CRITICAL').'"; - color = "'.COL_CRITICAL.'"; - break; - - case "'.EVENTS_UNKNOWN.'": - case "'.EVENTS_GOING_UNKNOWN.'": - default: - text = "'.__('UNKNOWN').'"; - color = "'.COL_UNKNOWN.'"; - break; - } - - item.event_type = \'
    \' + text + "
    "; - - if (item.id_agente > 0) { - item.agent_name = \'\' + item.agent_name + \'\'; - } - - if (item.id_agente > 0) { - item.id_agente = \'\' + item.id_agente + \'\'; - } - - if (item.id_grupo == "0") { - item.id_grupo = "'.__('All').'"; - } else { - item.id_grupo = item.group_name; - } - - item.options = \'button\'; - item.id_evento = "#"+item.id_evento; - }', + 'column_names' => $column_names, + 'columns' => $fields, + 'no_sortable_columns' => [-1], + 'ajax_postprocess' => 'process_datatables_item(item)', ] ); } catch (Exception $e) { @@ -1232,9 +1149,13 @@ html_print_input_hidden( echo "
    "; echo "
    "; echo "
    "; + +// Load filter div for dialog. +echo ''; +echo ''; ?>