#11763 save filter regex on bbdd

This commit is contained in:
Jonathan 2023-11-29 11:14:40 +01:00
parent 49a81b34c4
commit f86a3e60e8
4 changed files with 12 additions and 1 deletions

View File

@ -5,4 +5,7 @@ DROP TABLE tagent_access;
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
ALTER TABLE `tevent_filter`
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
COMMIT;

View File

@ -313,6 +313,7 @@ if ($save_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
@ -381,6 +382,7 @@ if ($update_event_filter) {
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['regex'] = get_parameter('regex');
$values['not_search'] = get_parameter('not_search');
$values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
@ -640,6 +642,8 @@ function load_form_filter() {
$("#status").val(val);
if (i == 'search')
$('#text-search').val(val);
if (i == 'regex')
$('#text-regex').val(val);
if (i == 'not_search')
$('#checkbox-not_search').val(val);
if (i == 'text_agent')
@ -970,6 +974,7 @@ function save_new_filter() {
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
@ -1050,6 +1055,7 @@ function save_update_filter() {
"severity" : $("#severity").val(),
"status" : $("#status").val(),
"search" : $("#text-search").val(),
"regex" : $('#text-regex').val(),
"not_search" : $("#checkbox-not_search").val(),
"text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),

View File

@ -1320,6 +1320,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$severity = $filter['severity'];
$status = $filter['status'];
$search = $filter['search'];
$regex = $filter['regex'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
@ -2085,7 +2086,7 @@ $in .= $data.'</div>';
$inputs[] = $in;
// REGEX search datatable.
$in = '<div class="filter_input"><label>'.__('Regexp search').ui_print_help_tip(__('Regular expresion to filter.'), true).'</label>';
$in = '<div class="filter_input"><label>'.__('Regex search').ui_print_help_tip(__('Regular expresion to filter.'), true).'</label>';
$in .= html_print_input_text('regex', $regex, '', '', 255, true);
$in .= '</div>';
$inputs[] = $in;

View File

@ -1271,6 +1271,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT,
`private_filter_user` TEXT,
`regex` TEXT,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;