wip event vwr ui-box close tick
@ -954,26 +954,26 @@ if ($change_owner) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Generate a modal window with extended information of given event.
|
||||||
if ($get_extended_event) {
|
if ($get_extended_event) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$event_id = get_parameter('event_id', false);
|
$event = get_parameter('event', false);
|
||||||
$childrens_ids = get_parameter('childrens_ids');
|
|
||||||
$childrens_ids = json_decode($childrens_ids);
|
|
||||||
|
|
||||||
if ($meta) {
|
if ($event === false) {
|
||||||
$event = events_meta_get_event($event_id, false, $history, 'ER');
|
return;
|
||||||
} else {
|
|
||||||
$event = events_get_event($event_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$event_id = $event['id_evento'];
|
||||||
|
|
||||||
$readonly = false;
|
$readonly = false;
|
||||||
if (!$meta
|
if (!$meta
|
||||||
&& isset($config['event_replication'])
|
&& isset($config['event_replication'])
|
||||||
&& $config['event_replication'] == 1
|
&& $config['event_replication'] == 1
|
||||||
&& $config['show_events_in_local'] == 1
|
&& $config['show_events_in_local'] == 1
|
||||||
) {
|
) {
|
||||||
$readonly = true;
|
$readonly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean url from events and store in array.
|
// Clean url from events and store in array.
|
||||||
@ -986,20 +986,17 @@ if ($get_extended_event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dialog_page = get_parameter('dialog_page', 'general');
|
$dialog_page = get_parameter('dialog_page', 'general');
|
||||||
$similar_ids = get_parameter('similar_ids', $event_id);
|
|
||||||
$group_rep = get_parameter('group_rep', false);
|
|
||||||
$event_rep = get_parameter('event_rep', 1);
|
|
||||||
$timestamp_first = get_parameter('timestamp_first', $event['utimestamp']);
|
|
||||||
$timestamp_last = get_parameter('timestamp_last', $event['utimestamp']);
|
|
||||||
$server_id = get_parameter('server_id', 0);
|
|
||||||
$filter = get_parameter('filter', []);
|
$filter = get_parameter('filter', []);
|
||||||
|
$group_rep = $filter['group_rep'];
|
||||||
|
$event_rep = $event['event_rep'];
|
||||||
|
$timestamp_first = $event['min_timestamp'];
|
||||||
|
$timestamp_last = $event['max_timestamp'];
|
||||||
|
$server_id = $event['server_id'];
|
||||||
|
$comments = $event['comments'];
|
||||||
|
|
||||||
$event_rep = events_get_related_events($event_id, true, $filter);
|
if (!isset($comments)) {
|
||||||
|
$comments = $event['user_comment'];
|
||||||
$event['similar_ids'] = $similar_ids;
|
}
|
||||||
$event['timestamp_first'] = $timestamp_first;
|
|
||||||
$event['timestamp_last'] = $timestamp_last;
|
|
||||||
$event['event_rep'] = $event_rep;
|
|
||||||
|
|
||||||
// Check ACLs.
|
// Check ACLs.
|
||||||
if (is_user_admin($config['id_user'])) {
|
if (is_user_admin($config['id_user'])) {
|
||||||
|
@ -448,6 +448,7 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
|
|||||||
* @param string $sort_field Sort field.
|
* @param string $sort_field Sort field.
|
||||||
* @param boolean $history Apply on historical table.
|
* @param boolean $history Apply on historical table.
|
||||||
* @param boolean $return_sql Return SQL (true) or execute it (false).
|
* @param boolean $return_sql Return SQL (true) or execute it (false).
|
||||||
|
* @param string $having Having filter.
|
||||||
*
|
*
|
||||||
* @return array Events.
|
* @return array Events.
|
||||||
* @throws Exception On error.
|
* @throws Exception On error.
|
||||||
@ -460,7 +461,8 @@ function events_get_all(
|
|||||||
$order=null,
|
$order=null,
|
||||||
$sort_field=null,
|
$sort_field=null,
|
||||||
$history=false,
|
$history=false,
|
||||||
$return_sql=false
|
$return_sql=false,
|
||||||
|
$having=''
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -653,6 +655,17 @@ function events_get_all(
|
|||||||
|
|
||||||
// Free search.
|
// Free search.
|
||||||
if (!empty($filter['search'])) {
|
if (!empty($filter['search'])) {
|
||||||
|
if (isset($config['dbconnection']->server_version)
|
||||||
|
&& $config['dbconnection']->server_version > 50600
|
||||||
|
) {
|
||||||
|
// Use "from_base64" requires mysql 5.6 or greater.
|
||||||
|
$custom_data_search = 'from_base64(te.custom_data)';
|
||||||
|
} else {
|
||||||
|
// Custom data is JSON encoded base64, if 5.6 or lower,
|
||||||
|
// user is condemned to use plain search.
|
||||||
|
$custom_data_search = 'te.custom_data';
|
||||||
|
}
|
||||||
|
|
||||||
$sql_filters[] = vsprintf(
|
$sql_filters[] = vsprintf(
|
||||||
' AND (lower(ta.alias) like lower("%%%s%%")
|
' AND (lower(ta.alias) like lower("%%%s%%")
|
||||||
OR te.id_evento like "%%%s%%"
|
OR te.id_evento like "%%%s%%"
|
||||||
@ -660,7 +673,7 @@ function events_get_all(
|
|||||||
OR lower(te.user_comment) like lower("%%%s%%")
|
OR lower(te.user_comment) like lower("%%%s%%")
|
||||||
OR lower(te.id_extra) like lower("%%%s%%")
|
OR lower(te.id_extra) like lower("%%%s%%")
|
||||||
OR lower(te.source) like lower("%%%s%%")
|
OR lower(te.source) like lower("%%%s%%")
|
||||||
OR lower(te.custom_data) like lower("%%%s%%") )',
|
OR lower('.$custom_data_search.') like lower("%%%s%%") )',
|
||||||
array_fill(0, 7, $filter['search'])
|
array_fill(0, 7, $filter['search'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -947,7 +960,8 @@ function events_get_all(
|
|||||||
if ($group_by != '') {
|
if ($group_by != '') {
|
||||||
$group_selects = ',COUNT(id_evento) AS event_rep
|
$group_selects = ',COUNT(id_evento) AS event_rep
|
||||||
,GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,
|
,GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,
|
||||||
MAX(timestamp) as max_timestamp,
|
MAX(utimestamp) as timestamp_last,
|
||||||
|
MIN(utimestamp) as timestamp_first,
|
||||||
MAX(id_evento) as max_id_evento';
|
MAX(id_evento) as max_id_evento';
|
||||||
|
|
||||||
if ($count === false) {
|
if ($count === false) {
|
||||||
@ -974,6 +988,7 @@ function events_get_all(
|
|||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
|
%s
|
||||||
',
|
',
|
||||||
join(',', $fields),
|
join(',', $fields),
|
||||||
$group_selects,
|
$group_selects,
|
||||||
@ -988,7 +1003,8 @@ function events_get_all(
|
|||||||
join(' ', $sql_filters),
|
join(' ', $sql_filters),
|
||||||
$group_by,
|
$group_by,
|
||||||
$order_by,
|
$order_by,
|
||||||
$pagination
|
$pagination,
|
||||||
|
$having
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$user_is_admin) {
|
if (!$user_is_admin) {
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
/*global jQuery,$,forced_title_callback,Base64, dt_events*/
|
/*global jQuery,$,forced_title_callback,Base64, dt_events*/
|
||||||
|
|
||||||
// Show the modal window of an event
|
// Show the modal window of an event
|
||||||
function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
function show_event_dialog(event, dialog_page, result) {
|
||||||
var ajax_file = $("#hidden-ajax_file").val();
|
var ajax_file = $("#hidden-ajax_file").val();
|
||||||
|
|
||||||
if (dialog_page == undefined) {
|
if (dialog_page == undefined) {
|
||||||
dialog_page = "general";
|
dialog_page = "general";
|
||||||
}
|
}
|
||||||
|
|
||||||
var similar_ids = $("#hidden-similar_ids_" + event_id).val();
|
try {
|
||||||
var timestamp_first = $("#hidden-timestamp_first_" + event_id).val();
|
event = JSON.parse(atob(event));
|
||||||
var timestamp_last = $("#hidden-timestamp_last_" + event_id).val();
|
} catch (e) {
|
||||||
var user_comment = $("#hidden-user_comment_" + event_id).val();
|
console.error(e);
|
||||||
var event_rep = $("#hidden-event_rep_" + event_id).val();
|
return;
|
||||||
var server_id = $("#hidden-server_id_" + event_id).val();
|
}
|
||||||
var childrens_ids = $("#hidden-childrens_ids").val();
|
|
||||||
|
|
||||||
var inputs = $("#events_form :input");
|
var inputs = $("#events_form :input");
|
||||||
var values = {};
|
var values = {};
|
||||||
@ -33,17 +32,9 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
|||||||
{
|
{
|
||||||
page: "include/ajax/events",
|
page: "include/ajax/events",
|
||||||
get_extended_event: 1,
|
get_extended_event: 1,
|
||||||
group_rep: group_rep,
|
|
||||||
event_rep: event_rep,
|
|
||||||
dialog_page: dialog_page,
|
dialog_page: dialog_page,
|
||||||
similar_ids: similar_ids,
|
event: event,
|
||||||
timestamp_first: timestamp_first,
|
|
||||||
timestamp_last: timestamp_last,
|
|
||||||
user_comment: user_comment,
|
|
||||||
event_id: event_id,
|
|
||||||
server_id: server_id,
|
|
||||||
meta: meta,
|
meta: meta,
|
||||||
childrens_ids: childrens_ids,
|
|
||||||
history: history,
|
history: history,
|
||||||
filter: values
|
filter: values
|
||||||
},
|
},
|
||||||
@ -53,7 +44,7 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
|||||||
.empty()
|
.empty()
|
||||||
.append(data)
|
.append(data)
|
||||||
.dialog({
|
.dialog({
|
||||||
title: get_event_name(event_id, meta, history),
|
title: event.evento,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 86 B |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 3.2 KiB |
@ -168,22 +168,22 @@
|
|||||||
.ui-dialog-titlebar {
|
.ui-dialog-titlebar {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
.ui-dialog-titlebar .ui-icon-closethick,
|
|
||||||
.ui-dialog-titlebar .ui-state-default,
|
.ui-state-hover .ui-icon,
|
||||||
.ui-dialog-titlebar .ui-state-hover,
|
.ui-state-focus .ui-icon,
|
||||||
.ui-dialog-titlebar button {
|
.ui-button:hover .ui-icon,
|
||||||
background: transparent;
|
.ui-button:focus .ui-icon {
|
||||||
border: 0px;
|
background: none;
|
||||||
}
|
}
|
||||||
|
.ui-dialog-titlebar.ui-icon-closethick:hover,
|
||||||
.ui-dialog-titlebar .ui-icon-closethick {
|
.ui-dialog-titlebar .ui-icon-closethick {
|
||||||
margin-top: -5px;
|
background: none;
|
||||||
background-image: url("../../../images/icono_cerrar.png");
|
|
||||||
top: 20%;
|
|
||||||
left: 70%;
|
|
||||||
}
|
}
|
||||||
.ui-dialog-titlebar.ui-icon-closethick:hover {
|
.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close,
|
||||||
background-image: url("../../../images/icono_cerrar.png");
|
.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close:hover {
|
||||||
|
background: url("../../../images/icono_cerrar.png") no-repeat center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-dialog-title {
|
.ui-dialog-title {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
|
@ -142,41 +142,43 @@ switch ($status) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""');
|
* Never use things like this.
|
||||||
$count_events = 0;
|
*
|
||||||
$events_wi_cdata_id = 'OR id_evento IN (';
|
* $events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""');
|
||||||
if ($events_wi_cdata === false) {
|
* $count_events = 0;
|
||||||
$events_wi_cdata = [];
|
* $events_wi_cdata_id = 'OR id_evento IN (';
|
||||||
}
|
* if ($events_wi_cdata === false) {
|
||||||
|
* $events_wi_cdata = [];
|
||||||
foreach ($events_wi_cdata as $key => $value) {
|
* }
|
||||||
$needle = base64_decode($value['custom_data']);
|
*
|
||||||
if (($needle != '') && ($search != '')) {
|
* foreach ($events_wi_cdata as $key => $value) {
|
||||||
if (strpos(strtolower($needle), strtolower($search)) != false) {
|
* $needle = base64_decode($value['custom_data']);
|
||||||
$events_wi_cdata_id .= $value['id_evento'];
|
* if (($needle != '') && ($search != '')) {
|
||||||
$count_events++;
|
* if (strpos(strtolower($needle), strtolower($search)) != false) {
|
||||||
}
|
* $events_wi_cdata_id .= $value['id_evento'];
|
||||||
}
|
* $count_events++;
|
||||||
|
* }
|
||||||
if ($value !== end($events_wi_cdata) && $count_events > 0) {
|
* }
|
||||||
$events_wi_cdata_id .= ',';
|
*
|
||||||
$events_wi_cdata_id = str_replace(',,', ',', $events_wi_cdata_id);
|
* if ($value !== end($events_wi_cdata) && $count_events > 0) {
|
||||||
}
|
* $events_wi_cdata_id .= ',';
|
||||||
}
|
* $events_wi_cdata_id = str_replace(',,', ',', $events_wi_cdata_id);
|
||||||
|
* }
|
||||||
$events_wi_cdata_id .= ')';
|
* }
|
||||||
|
*
|
||||||
$events_wi_cdata_id = str_replace(',)', ')', $events_wi_cdata_id);
|
* $events_wi_cdata_id .= ')';
|
||||||
|
*
|
||||||
if ($count_events == 0) {
|
* $events_wi_cdata_id = str_replace(',)', ')', $events_wi_cdata_id);
|
||||||
$events_wi_cdata_id = '';
|
*
|
||||||
}
|
* if ($count_events == 0) {
|
||||||
|
* $events_wi_cdata_id = '';
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
if ($search != '') {
|
if ($search != '') {
|
||||||
$filter_resume['free_search'] = $search;
|
$filter_resume['free_search'] = $search;
|
||||||
$sql_post .= " AND (evento LIKE '%".$search."%' OR id_evento LIKE '%$search%' ".$events_wi_cdata_id.')';
|
$sql_post .= " AND (evento LIKE '%".$search."%' OR id_evento LIKE '%$search%' )";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_type != '') {
|
if ($event_type != '') {
|
||||||
|
@ -169,7 +169,9 @@ if (is_ajax()) {
|
|||||||
$data = array_reduce(
|
$data = array_reduce(
|
||||||
$events,
|
$events,
|
||||||
function ($carry, $item) {
|
function ($carry, $item) {
|
||||||
$carry[] = (object) $item;
|
$tmp = (object) $item;
|
||||||
|
$tmp->evento = io_safe_output($tmp->evento);
|
||||||
|
$carry[] = $tmp;
|
||||||
return $carry;
|
return $carry;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -589,6 +591,47 @@ if (is_metaconsole() !== true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load user default form.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$user_filter = db_get_row_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT f.id_filter, f.id_name
|
||||||
|
FROM tevent_filter f
|
||||||
|
INNER JOIN tusuario u
|
||||||
|
ON u.default_event_filter=f.id_filter
|
||||||
|
WHERE u.id_user = "%s" ',
|
||||||
|
$config['id_user']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ($user_filter !== false) {
|
||||||
|
$filter = events_get_event_filter($user_filter['id_filter']);
|
||||||
|
if ($filter !== false) {
|
||||||
|
$id_group = $filter['id_group'];
|
||||||
|
$event_type = $filter['event_type'];
|
||||||
|
$severity = $filter['severity'];
|
||||||
|
$status = $filter['status'];
|
||||||
|
$search = $filter['search'];
|
||||||
|
$text_agent = $filter['text_agent'];
|
||||||
|
$id_agent = $filter['id_agent'];
|
||||||
|
$id_agent_module = $filter['id_agent_module'];
|
||||||
|
$pagination = $filter['pagination'];
|
||||||
|
$event_view_hr = $filter['event_view_hr'];
|
||||||
|
$id_user_ack = $filter['id_user_ack'];
|
||||||
|
$group_rep = $filter['group_rep'];
|
||||||
|
$tag_with = $filter['tag_with'];
|
||||||
|
$tag_without = $filter['tag_without'];
|
||||||
|
$filter_only_alert = $filter['filter_only_alert'];
|
||||||
|
$id_group_filter = $filter['id_group_filter'];
|
||||||
|
$date_from = $filter['date_from'];
|
||||||
|
$date_to = $filter['date_to'];
|
||||||
|
$source = $filter['source'];
|
||||||
|
$id_extra = $filter['id_extra'];
|
||||||
|
$user_comment = $filter['user_comment'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load filter form.
|
* Load filter form.
|
||||||
*/
|
*/
|
||||||
@ -1039,6 +1082,20 @@ try {
|
|||||||
|
|
||||||
// Open current filter quick reference.
|
// Open current filter quick reference.
|
||||||
$active_filters_div = '<div class="filter_summary">';
|
$active_filters_div = '<div class="filter_summary">';
|
||||||
|
|
||||||
|
// Current filter.
|
||||||
|
$active_filters_div .= '<div>';
|
||||||
|
$active_filters_div .= '<div class="label box-shadow">'.__('Current filter').'</div>';
|
||||||
|
$active_filters_div .= '<div id="current_filter" class="content">';
|
||||||
|
if ($user_filter !== false) {
|
||||||
|
$active_filters_div .= io_safe_output($user_filter['id_name']);
|
||||||
|
} else {
|
||||||
|
$active_filters_div .= __('Not set.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$active_filters_div .= '</div>';
|
||||||
|
$active_filters_div .= '</div>';
|
||||||
|
|
||||||
// Event status.
|
// Event status.
|
||||||
$active_filters_div .= '<div>';
|
$active_filters_div .= '<div>';
|
||||||
$active_filters_div .= '<div class="label box-shadow">'.__('Event status').'</div>';
|
$active_filters_div .= '<div class="label box-shadow">'.__('Event status').'</div>';
|
||||||
@ -1362,8 +1419,8 @@ function process_datatables_item(item) {
|
|||||||
|
|
||||||
// Add event severity to end of text.
|
// Add event severity to end of text.
|
||||||
evn = '<div class="event flex-row h100p nowrap">';
|
evn = '<div class="event flex-row h100p nowrap">';
|
||||||
evn += '<div><a href="javascript:" onclick="show_event_dialog(';
|
evn += '<div><a href="javascript:" onclick="show_event_dialog(\'';
|
||||||
evn += item.id_evento+','+$("#group_rep").val()+');">';
|
evn += btoa(JSON.stringify(item))+'\','+$("#group_rep").val()+');">';
|
||||||
// Grouped events.
|
// Grouped events.
|
||||||
if(item.event_rep) {
|
if(item.event_rep) {
|
||||||
evn += '('+item.event_rep+') ';
|
evn += '('+item.event_rep+') ';
|
||||||
|