2013-03-07 Sergio Martin <sergio.martin@artica.es>
* include/functions_events.php operation/events/events.build_table.php: Improve instructions in list and details view on agents and fix the bug of doesnt show the owner in the list table when events are grouped. To fix it I added a couple of subqueries to the grouped query. Yes, I checked the performance :) Bug: 3607097 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7809 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
69bd54c82c
commit
7a6614912b
|
@ -1,3 +1,12 @@
|
|||
2013-03-07 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_events.php
|
||||
operation/events/events.build_table.php: Improve instructions
|
||||
in list and details view on agents and fix the bug of doesnt
|
||||
show the owner in the list table when events are grouped. To fix
|
||||
it I added a couple of subqueries to the grouped query. Yes, I
|
||||
checked the performance :) Bug: 3607097
|
||||
|
||||
2013-03-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_reporting.php: fixed the apply format to
|
||||
|
|
|
@ -85,8 +85,10 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
GROUP_CONCAT(DISTINCT user_comment SEPARATOR '<br>') AS user_comment,
|
||||
GROUP_CONCAT(DISTINCT id_evento SEPARATOR ',') AS similar_ids,
|
||||
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep,
|
||||
MIN(utimestamp) AS timestamp_rep_min
|
||||
FROM $table
|
||||
MIN(utimestamp) AS timestamp_rep_min,
|
||||
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
|
||||
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario
|
||||
FROM $table te
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, evento, id_agentmodule".$groupby_extra."
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||
|
@ -95,8 +97,10 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
$sql = "SELECT *, MAX(id_evento) AS id_evento, array_to_string(array_agg(DISTINCT user_comment), '<br>') AS user_comment,
|
||||
array_to_string(array_agg(DISTINCT id_evento), ',') AS similar_ids,
|
||||
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep,
|
||||
MIN(utimestamp) AS timestamp_rep_min
|
||||
FROM $table
|
||||
MIN(utimestamp) AS timestamp_rep_min,
|
||||
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
|
||||
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario
|
||||
FROM $table te
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra".$groupby_extra."
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$pagination." OFFSET ".$offset;
|
||||
|
@ -112,8 +116,10 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
|||
id_agentmodule, COUNT(*) AS event_rep,
|
||||
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep,
|
||||
LISTAGG(id_evento, '') AS similar_ids,
|
||||
MIN(utimestamp) AS timestamp_rep_min
|
||||
FROM $table
|
||||
MIN(utimestamp) AS timestamp_rep_min,
|
||||
(SELECT owner_user FROM tevento WHERE id_evento = MAX(te.id_evento)) owner_user,
|
||||
(SELECT id_usuario FROM tevento WHERE id_evento = MAX(te.id_evento)) id_usuario
|
||||
FROM $table te
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, to_char(evento), id_agentmodule".$groupby_extra.") b
|
||||
WHERE a.id_evento=b.id_evento AND
|
||||
|
@ -1956,7 +1962,7 @@ function events_page_details ($event, $server = "") {
|
|||
$data = array();
|
||||
$data[0] = __('Instructions');
|
||||
if ($event["unknown_instructions"] != '') {
|
||||
$data[1] = $event["unknown_instructions"];
|
||||
$data[1] = str_replace("\n","<br>", io_safe_output($event["unknown_instructions"]));
|
||||
}
|
||||
else {
|
||||
$data[1] = '<i>' . __('N/A') . '</i>';
|
||||
|
@ -1968,7 +1974,7 @@ function events_page_details ($event, $server = "") {
|
|||
$data = array();
|
||||
$data[0] = __('Instructions');
|
||||
if ($event["warning_instructions"] != '') {
|
||||
$data[1] = $event["warning_instructions"];
|
||||
$data[1] = str_replace("\n","<br>", io_safe_output($event["warning_instructions"]));
|
||||
}
|
||||
else {
|
||||
$data[1] = '<i>' . __('N/A') . '</i>';
|
||||
|
@ -1980,7 +1986,7 @@ function events_page_details ($event, $server = "") {
|
|||
$data = array();
|
||||
$data[0] = __('Instructions');
|
||||
if ($event["critical_instructions"] != '') {
|
||||
$data[1] = $event["critical_instructions"];
|
||||
$data[1] = str_replace("\n","<br>", io_safe_output($event["critical_instructions"]));
|
||||
}
|
||||
else {
|
||||
$data[1] = '<i>' . __('N/A') . '</i>';
|
||||
|
|
|
@ -123,7 +123,7 @@ if (in_array('ack_utimestamp', $show_fields)) {
|
|||
}
|
||||
if (in_array('instructions', $show_fields)) {
|
||||
$table->head[$i] = __('Instructions');
|
||||
$table->align[$i] = 'left';
|
||||
$table->align[$i] = 'center';
|
||||
$i++;
|
||||
}
|
||||
if ($i != 0 && $allow_action) {
|
||||
|
@ -430,18 +430,27 @@ foreach ($result as $event) {
|
|||
if (in_array('instructions',$show_fields)) {
|
||||
switch($event['event_type']) {
|
||||
case 'going_unknown':
|
||||
$data[$i] = ui_print_truncate_text(str_replace("\n","<br>", io_safe_output($event["unknown_instructions"])));
|
||||
if(!empty($event["unknown_instructions"])) {
|
||||
$data[$i] = html_print_image('images/page_white_text.png', true, array('title' => str_replace("\n","<br>", io_safe_output($event["unknown_instructions"]))));
|
||||
}
|
||||
break;
|
||||
case 'going_up_critical':
|
||||
case 'going_down_critical':
|
||||
$data[$i] = ui_print_truncate_text(str_replace("\n","<br>", io_safe_output($event["critical_instructions"])));
|
||||
if(!empty($event["critical_instructions"])) {
|
||||
$data[$i] = html_print_image('images/page_white_text.png', true, array('title' => str_replace("\n","<br>", io_safe_output($event["critical_instructions"]))));
|
||||
}
|
||||
break;
|
||||
case 'going_down_warning':
|
||||
$data[$i] = ui_print_truncate_text(str_replace("\n","<br>", io_safe_output($event["warning_instructions"])));
|
||||
if(!empty($event["warning_instructions"])) {
|
||||
$data[$i] = html_print_image('images/page_white_text.png', true, array('title' => str_replace("\n","<br>", io_safe_output($event["warning_instructions"]))));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$data[$i] = '';
|
||||
}
|
||||
|
||||
if(!isset($data[$i])) {
|
||||
$data[$i] = '';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue