#11031 fix audit log filter

This commit is contained in:
miguel angel rasteu 2023-07-12 10:19:08 +02:00
parent 08b7beb9c7
commit f6637e3827
2 changed files with 15 additions and 9 deletions

View File

@ -84,7 +84,7 @@ if ($save_log_filter) {
if ($recover_aduit_log_select) { if ($recover_aduit_log_select) {
echo json_encode(audit_get_audit_filter_select()); echo json_encode(audit_get_audit_filter_select_fix_order());
} }
if ($update_log_filter) { if ($update_log_filter) {
@ -190,7 +190,7 @@ function show_filter() {
draggable: true, draggable: true,
modal: false, modal: false,
closeOnEscape: true, closeOnEscape: true,
width: 380 width: "auto"
}); });
} }
@ -207,12 +207,13 @@ function load_filter_values() {
}, },
success: function(data) { success: function(data) {
var options = ""; var options = "";
console.log(data);
$.each(data,function(i,value){ $.each(data,function(i,value){
if (i == 'text'){ if (i == 'text'){
$("#text-filter_text").val(value); $("#text-filter_text").val(value);
} }
if (i == 'period'){ if (i == 'period'){
$("#text-filter_period").val(value); $("#filter_period").val(value).change();
} }
if (i == 'ip'){ if (i == 'ip'){
$("#text-filter_ip").val(value); $("#text-filter_ip").val(value);
@ -395,7 +396,7 @@ function save_new_filter() {
"save_log_filter" : 1, "save_log_filter" : 1,
"id_name" : $("#text-id_name").val(), "id_name" : $("#text-id_name").val(),
"text" : $("#text-filter_text").val(), "text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(), "period" : $("#filter_period :selected").val(),
"ip" : $('#text-filter_ip').val(), "ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(), "type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(), "user" : $('#filter_user :selected').val(),
@ -431,7 +432,7 @@ function save_update_filter() {
"update_log_filter" : 1, "update_log_filter" : 1,
"id" : $("#overwrite_filter :selected").val(), "id" : $("#overwrite_filter :selected").val(),
"text" : $("#text-filter_text").val(), "text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(), "period" : $("#filter_period :selected").val(),
"ip" : $('#text-filter_ip').val(), "ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(), "type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(), "user" : $('#filter_user :selected').val(),

View File

@ -469,7 +469,7 @@ class AuditLog extends HTML
success: function(data) { success: function(data) {
var options = ""; var options = "";
$.each(data,function(key,value){ $.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>"; options += "<option value='"+value+"'>"+key+"</option>";
}); });
$('#overwrite_filter').html(options); $('#overwrite_filter').html(options);
$('#overwrite_filter').select2(); $('#overwrite_filter').select2();
@ -509,8 +509,12 @@ class AuditLog extends HTML
/* Filter management */ /* Filter management */
$('#button-load-filter').click(function (){ $('#button-load-filter').click(function (){
if($('#load-filter-select').length) { if($('#load-filter-select').length) {
$('#load-filter-select').dialog({width: "20%", $('#load-filter-select').dialog({
maxWidth: "25%", resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
width: "auto",
title: "<?php echo __('Load filter'); ?>" title: "<?php echo __('Load filter'); ?>"
}); });
$.ajax({ $.ajax({
@ -523,8 +527,9 @@ class AuditLog extends HTML
}, },
success: function(data) { success: function(data) {
var options = ""; var options = "";
console.log(data)
$.each(data,function(key,value){ $.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>"; options += "<option value='"+value+"'>"+key+"</option>";
}); });
$('#filter_id').html(options); $('#filter_id').html(options);
$('#filter_id').select2(); $('#filter_id').select2();