Primeras modificaciones del filtro de eventos

This commit is contained in:
marcos 2020-10-29 10:24:37 +01:00
parent 860024a11a
commit edc9038783
3 changed files with 63 additions and 12 deletions

View File

@ -331,17 +331,49 @@ if ($get_filter_values) {
if ($event_filter === false) {
$event_filter = [
'status' => EVENT_NO_VALIDATED,
'event_view_hr' => $config['event_view_hr'],
'group_rep' => 1,
'tag_with' => [],
'tag_without' => [],
'history' => false,
'status' => EVENT_NO_VALIDATED,
'event_view_hr' => $config['event_view_hr'],
'group_rep' => 1,
'tag_with' => [],
'tag_without' => [],
'history' => false,
'module_search' => '',
'filter_only_alert' => '-1',
'user_comment' => '',
'id_extra' => '',
'id_user_ack' => '',
'date_from' => '',
'date_to' => '',
'severity' => '',
'event_type' => '',
'group_rep' => 0,
'id_group' => 0,
'id_group_filter' => 0,
'group_name' => 'All',
'text_agent' => '',
'id_agent' => 0,
'id_name' => 'None',
'filter_id' => 0,
];
} else {
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => 9]));
$a = array_keys(users_get_groups(false));
$event_filter['group_name'] = '';
foreach ($a as $key => $value) {
if ($value == $event_filter['id_group']) {
$event_filter['group_name'] = db_get_value('nombre', 'tgrupo', 'id_grupo', $event_filter['id_group_filter']);
}
}
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => 9]));
}
$event_filter['search'] = io_safe_output($event_filter['search']);
$event_filter['id_name'] = io_safe_output($event_filter['id_name']);
$event_filter['text_agent'] = io_safe_output($event_filter['text_agent']);
$event_filter['source'] = io_safe_output($event_filter['source']);
$event_filter['tag_with'] = base64_encode(
io_safe_output($event_filter['tag_with'])
);
@ -435,8 +467,9 @@ function load_form_filter() {
jQuery.each (data, function (i, val) {
if (i == 'id_name')
$("#hidden-id_name").val(val);
if (i == 'id_group')
$("#id_group").val(val);
if (i == 'id_group'){
$('#id_group').val(val);
}
if (i == 'event_type')
$("#event_type").val(val);
if (i == 'severity') {
@ -446,9 +479,9 @@ function load_form_filter() {
if (i == 'status')
$("#status").val(val);
if (i == 'search')
$("#text-search").val(val);
$('#text-search').val(val);
if (i == 'text_agent')
$("#text_id_agent").val(val);
$('input[name=text_agent]').val(val);
if (i == 'id_agent')
$('input:hidden[name=id_agent]').val(val);
if (i == 'id_agent_module')
@ -477,6 +510,15 @@ function load_form_filter() {
$("#text-user_comment").val(val);
if (i == 'id_source_event')
$("#text-id_source_event").val(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'date_to')
$("#text-date_to").val(val);
if(i == 'module_search')
$('input[name=module_search]').val(val);
if(i == 'group_name')
$("#select2-id_group_filter-container").text(val);
});
reorder_tags_inputs();
// Update the info with the loaded filter

View File

@ -442,6 +442,7 @@ if ($user_filter !== false && $from_event_graph != 1) {
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module'];
$text_module = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $filter['id_agent_module']]));
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack'];
@ -878,13 +879,17 @@ if (is_metaconsole() !== true) {
*/
// Group.
if ($id_group_filter === null) {
$id_group_filter = 0;
}
$data = html_print_input(
[
'name' => 'id_group_filter',
'returnAllGroup' => true,
'privilege' => 'AR',
'type' => 'select_groups',
'selected' => (defined($id_group_filter) ? $id_group_filter : 0),
'selected' => $id_group_filter,
'nothing' => false,
'return' => true,
'size' => '80%',
@ -1996,6 +2001,9 @@ function process_datatables_item(item) {
/* Group name */
if (item.id_grupo == "0") {
var severity_value = "<?php echo $severity; ?>";
const multiple = severity_value.split(",");
$("#severity").val(multiple);
item.id_grupo = "<?php echo __('All'); ?>";
} else {
item.id_grupo = item.group_name;

View File

@ -1477,7 +1477,8 @@ $(document).ready( function() {
$("#text-id_extra").val(val);
if (i == 'user_comment')
$("#text-user_comment").val(val);
if (i == 'module_search')
$("#text-module_search").val(val);
if(i == 'id_source_event')
$("#text-id_source_event").val(val);
}