Merge branch 'ent-8939-Cambiar-comportamiento-de-los-comentarios-en-eventos-rendimiento' into 'develop'

Ent 8939 cambiar comportamiento de los comentarios en eventos rendimiento

See merge request 
This commit is contained in:
Diego Muñoz-Reja 2022-07-05 15:44:24 +00:00
commit a257f43d49
3 changed files with 20 additions and 7 deletions
pandora_console
include
operation/events

View File

@ -1424,16 +1424,19 @@ function events_get_all(
$group_selects = '';
if ($group_by != '') {
if ($count === false) {
$group_selects = ',COUNT(id_evento) AS event_rep,
GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,
MAX(utimestamp) as timestamp_last,
MIN(utimestamp) as timestamp_first,
MAX(id_evento) as max_id_evento';
$idx = array_search('te.user_comment', $fields);
if ($idx !== false) {
unset($fields[$idx]);
}
$group_selects = sprintf(
',COUNT(id_evento) AS event_rep,
%s
MAX(utimestamp) as timestamp_last,
MIN(utimestamp) as timestamp_first,
MAX(id_evento) as max_id_evento',
($idx !== false) ? 'GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,' : ''
);
}
} else {
$idx = array_search('te.user_comment', $fields);

View File

@ -615,6 +615,10 @@ class EventsListWidget extends Widget
$fields = $default_fields;
}
if (empty($filter['search']) === false || empty($filter['user_comment']) === false) {
$fields[] = 'user_comment';
}
// Get column names.
$column_names = events_get_column_names($fields, true);

View File

@ -284,7 +284,6 @@ if (is_ajax() === true) {
'te.event_type',
'te.id_alert_am',
'te.criticity',
'te.user_comment',
'te.tags',
'te.source',
'te.id_extra',
@ -301,6 +300,13 @@ if (is_ajax() === true) {
'ta.direccion',
];
if (strpos($config['event_fields'], 'user_comment') !== false
|| empty($user_comment) === false
|| empty($search) === false
) {
$fields[] = 'te.user_comment';
}
$order = get_datatable_order(true);
if (is_array($order) === true && $order['field'] === 'mini_severity') {