Ent 7395 filtro de eventos en metaconsola server

This commit is contained in:
Daniel Maya 2021-04-28 10:50:04 +00:00 committed by Daniel Rodriguez
parent 9790be4f90
commit 8ef21d9b15
6 changed files with 48 additions and 8 deletions

View File

@ -26,4 +26,6 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event name\",\"Eve
UPDATE `tskin` SET `name` = 'Default theme' , `relative_path` = 'pandora.css' WHERE `id` = 1;
UPDATE `tskin` SET `name` = 'Black theme' , `relative_path` = 'Black theme' , `description` = 'Black theme' WHERE `id` = 2;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
COMMIT;

View File

@ -1506,6 +1506,7 @@ ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tusuario`

View File

@ -257,6 +257,11 @@ if ($save_event_filter) {
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
$exists = (bool) db_get_value_filter(
'id_filter',
'tevent_filter',
@ -305,6 +310,10 @@ if ($update_event_filter) {
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
if (io_safe_output($values['tag_with']) == '["0"]') {
$values['tag_with'] = '[]';
}
@ -371,6 +380,13 @@ if ($get_filter_values) {
}
}
if (is_metaconsole()) {
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
if ($server_name !== false) {
$event_filter['server_name'] = $server_name;
}
}
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
}
@ -476,7 +492,6 @@ 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'){
@ -522,6 +537,10 @@ function load_form_filter() {
$("#text-user_comment").val(val);
if (i == 'id_source_event')
$("#text-id_source_event").val(val);
if (i == 'server_id')
$("#server_id").val(val);
if (i == 'server_name')
$("#select2-server_id-container").text(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'date_to')
@ -752,7 +771,8 @@ function save_new_filter() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
},
function (data) {
$("#info_box").hide();
@ -822,7 +842,8 @@ function save_update_filter() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
},
function (data) {

View File

@ -509,6 +509,7 @@ if ($loaded_filter !== false && $from_event_graph != 1) {
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
$id_source_event = $filter['id_source_event'];
$server_id = $filter['server_id'];
}
}

View File

@ -132,6 +132,10 @@ if (is_ajax()) {
$values['id_source_event'] = get_parameter('id_source_event');
}
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
$exists = (bool) db_get_value_filter(
'id_filter',
'tevent_filter',
@ -183,6 +187,10 @@ if (is_ajax()) {
$values['id_source_event'] = get_parameter('id_source_event');
}
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
if (io_safe_output($values['tag_with']) == '["0"]') {
$values['tag_with'] = '[]';
}
@ -1365,6 +1373,8 @@ $(document).ready( function() {
$("#text-user_comment").val(val);
if (i == 'id_source_event')
$("#text-id_source_event").val(val);
if (i == 'server_id')
$("#server_id").val(val);
});
reorder_tags_inputs();
// Update the info with the loaded filter
@ -1405,9 +1415,10 @@ $(document).ready( function() {
$("#text-id_extra").val('');
$("#text-user_comment").val('');
$("#text-id_source_event").val('');
$("#server_id").val('');
clear_tags_inputs();
// Update the view of filter load with no loaded filters message
$('#filter_loaded_span').html($('#not_filter_loaded_text').html());
@ -1483,6 +1494,8 @@ $(document).ready( function() {
$("#text-module_search").val(val);
if(i == 'id_source_event')
$("#text-id_source_event").val(val);
if(i == 'server_id')
$("#server_id").val(val);
}
});
reorder_tags_inputs();
@ -1553,7 +1566,8 @@ $(document).ready( function() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id" : $("#server_id").val()
},
function (data) {
@ -1655,8 +1669,8 @@ $(document).ready( function() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id" : $("#server_id").val()
},
function (data) {
$(".info_box").hide();

View File

@ -1218,6 +1218,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_extra` tinytext NOT NULL,
`user_comment` text NOT NULL,
`id_source_event` int(10) NULL default 0,
`server_id` int(10) NOT NULL default 0,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;