Merge branch 'ent-6626filtros-de-eventos-personalizados-no-guardia-varios-apartados' into 'develop'
Primeras modificaciones del filtro de eventos See merge request artica/pandorafms!3585
This commit is contained in:
commit
946c548244
|
@ -130,6 +130,15 @@ if ($update || $create) {
|
|||
$id_agent = (int) get_parameter('id_agent');
|
||||
$text_module = get_parameter('text_module', '');
|
||||
$id_agent_module = (int) get_parameter('module_search_hidden');
|
||||
if ($text_module === '') {
|
||||
$text_module = io_safe_output(
|
||||
db_get_value_filter(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $id_agent_module]
|
||||
)
|
||||
);
|
||||
}
|
||||
$pagination = get_parameter('pagination', '');
|
||||
$event_view_hr = get_parameter('event_view_hr', '');
|
||||
$id_user_ack = get_parameter('id_user_ack', '');
|
||||
|
|
|
@ -333,17 +333,52 @@ 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' => $event_filter['id_agent_module']]));
|
||||
$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']);
|
||||
if ($event_filter['group_name'] === false) {
|
||||
$event_filter['group_name'] = __('All');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
|
||||
}
|
||||
|
||||
$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'])
|
||||
);
|
||||
|
@ -355,7 +390,7 @@ if ($get_filter_values) {
|
|||
}
|
||||
|
||||
if ($load_filter_modal) {
|
||||
$current = get_parameter('current_filter', '');
|
||||
$current = db_get_value_filter('default_event_filter', 'tusuario', ['id_user' => $config['id_user']]);
|
||||
$filters = events_get_event_filter_select();
|
||||
$user_groups_array = users_get_groups_for_select(
|
||||
$config['id_user'],
|
||||
|
@ -435,10 +470,12 @@ function load_form_filter() {
|
|||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
console.log(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') {
|
||||
|
@ -448,9 +485,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')
|
||||
|
@ -479,6 +516,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
|
||||
|
|
|
@ -444,7 +444,7 @@ $user_filter = db_get_row_sql(
|
|||
)
|
||||
);
|
||||
|
||||
// Do not load the user filter if we come from the 24h event graph
|
||||
// Do not load the user filter if we come from the 24h event graph.
|
||||
$from_event_graph = get_parameter('filter[from_event_graph]', $filter['from_event_graph']);
|
||||
if ($user_filter !== false && $from_event_graph != 1) {
|
||||
$filter = events_get_event_filter($user_filter['id_filter']);
|
||||
|
@ -457,6 +457,13 @@ 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'];
|
||||
|
@ -893,13 +900,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%',
|
||||
|
@ -2019,6 +2030,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;
|
||||
|
@ -2343,9 +2357,8 @@ $(document).ready( function() {
|
|||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/events',
|
||||
load_filter_modal: 1,
|
||||
current_filter: $('#latest_filter_id').val()
|
||||
},
|
||||
load_filter_modal: 1
|
||||
},
|
||||
success: function (data){
|
||||
$('#load-modal-filter')
|
||||
.empty()
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue