#8939 comment optimization
This commit is contained in:
parent
a42328ff29
commit
4ae2df8ded
|
@ -1476,16 +1476,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);
|
||||
|
|
|
@ -596,7 +596,6 @@ class EventsListWidget extends Widget
|
|||
'te.event_type',
|
||||
'te.id_alert_am',
|
||||
'te.criticity',
|
||||
'te.user_comment',
|
||||
'te.tags',
|
||||
'te.source',
|
||||
'te.id_extra',
|
||||
|
@ -612,6 +611,10 @@ class EventsListWidget extends Widget
|
|||
'tg.nombre as group_name',
|
||||
];
|
||||
|
||||
if (empty($filter['search']) === false || empty($filter['user_comment']) === false) {
|
||||
$fields[] = 'te.user_comment';
|
||||
}
|
||||
|
||||
$home_url = $config['homeurl'];
|
||||
|
||||
if ((bool) \is_metaconsole() === false
|
||||
|
|
|
@ -286,7 +286,6 @@ if (is_ajax() === true) {
|
|||
'te.event_type',
|
||||
'te.id_alert_am',
|
||||
'te.criticity',
|
||||
'te.user_comment',
|
||||
'te.tags',
|
||||
'te.source',
|
||||
'te.id_extra',
|
||||
|
@ -303,6 +302,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') {
|
||||
|
|
Loading…
Reference in New Issue