diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 7d0cb36bad..f34a8f6239 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6462,7 +6462,12 @@ function event_print_graph( $color[] = '#82b92f'; } } else { - $interval_length = (int) ($period / $num_intervals); + if ($num_intervals > 0) { + $interval_length = (int) ($period / $num_intervals); + } else { + $interval_length = 0; + } + $intervals = []; $intervals[0] = $start_utimestamp; for ($i = 0; $i < $num_intervals; $i++) { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 5c9a7e90fc..3ea3e8a740 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7170,31 +7170,16 @@ function ui_print_comments($comment, $truncate_limit=255) } // Only show the last comment. If commment its too long,the comment will short with ... - // If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes. + // Forced time commentary to use copact date for optimize space in table. // Else show comments hours ago if ($comment['action'] != 'Added comment') { $comment['comment'] = $comment['action']; } + $comment['comment'] = io_safe_output($comment['comment']); + $short_comment = substr($comment['comment'], 0, 20); - if ($config['prominent_time'] == 'timestamp') { - $comentario = ''.date($config['date_format'], $comment['utimestamp']).' ('.$comment['id_user'].'): '.$comment['comment'].''; - - if (strlen($comentario) > '200px' && $truncate_limit >= 255) { - $comentario = ''.date($config['date_format'], $comment['utimestamp']).' ('.$comment['id_user'].'): '.$short_comment.'...'; - } - } else { - $rest_time = (time() - $comment['utimestamp']); - $time_last = (($rest_time / 60) / 60); - - $comentario = ''.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'  Hours  ('.$comment['id_user'].'): '.$comment['comment'].''; - - if (strlen($comentario) > '200px' && $truncate_limit >= 255) { - $comentario = ''.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'  Hours  ('.$comment['id_user'].'): '.$short_comment.'...'; - } - } - - $comentario = io_safe_output($comentario); + $comentario = $comment['comment']; if (strlen($comentario) >= $truncate_limit) { $comentario = ui_print_truncate_text( @@ -7209,6 +7194,12 @@ function ui_print_comments($comment, $truncate_limit=255) ); } + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$comment['comment'].''; + + if (strlen($comentario) > '200px' && $truncate_limit >= 255) { + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px; display: contents;', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$short_comment.'...'; + } + return $comentario; } diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 1a66ba7174..78286c79f9 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -108,6 +108,35 @@ td > input[id^="checkbox-multi"] { height: 2.5em; } +.info_table.events tr > td span:not(.invisible) { + display: block; + overflow: hidden; + text-overflow: ellipsis; + max-height: 6em; + line-height: 2em; +} + +.info_table.events tr > td span:not(.invisible) { + display: block; + overflow: hidden; + text-overflow: ellipsis; + max-height: 6em; + line-height: 1.5em; +} + +th.column-estado { + padding: 0px 0px 0px 12px !important; + max-width: fit-content; +} + +.content-status { + margin: 0 auto; + max-width: fit-content; +} +table#table_events > tbody > tr > td.column-estado { + padding: 0px !important; + text-align: center; +} .sorting_desc { background: url(../../images/sort_down_green.png) no-repeat; background-position-x: left; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 17a81caf4e..6d969481a3 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -547,6 +547,45 @@ if (is_ajax() === true) { ); } + if (empty($tmp->tags) === false) { + $tmp->tags = ui_print_truncate_text( + $tmp->tags, + 30, + false, + true, + false, + '…', + true, + true, + ); + } + + if (empty($tmp->event_custom_id) === false) { + $tmp->event_custom_id = ui_print_truncate_text( + $tmp->event_custom_id, + 30, + false, + true, + false, + '…', + true, + true, + ); + } + + if (empty($tmp->module_custom_id) === false) { + $tmp->module_custom_id = ui_print_truncate_text( + $tmp->module_custom_id, + 30, + false, + true, + false, + '…', + true, + true, + ); + } + if (empty($tmp->comments) === false) { $tmp->comments = ui_print_comments($tmp->comments, 20); } @@ -887,14 +926,14 @@ if (is_ajax() === true) { true, [ 'title' => __('Unknown'), - 'class' => 'forced-title', + 'class' => 'forced-title main_menu_icon', ] ); $state = 0; break; } - $draw_state = '
'; + $draw_state = '
'; $draw_state .= ''; @@ -1187,10 +1226,10 @@ if (is_ajax() === true) { } $tmp->custom_data = $custom_data_str; - if (strlen($tmp->custom_data) >= 20) { + if (strlen($tmp->custom_data) >= 50) { $tmp->custom_data = ui_print_truncate_text( $tmp->custom_data, - 20, + 50, false, true, false, @@ -1220,15 +1259,18 @@ if (is_ajax() === true) { ); } - $data = array_values( - array_filter( - $data, - function ($item) { - return (bool) (array) $item; - } - ) - ); - $count = count($data); + if (isset($data) === true) { + $data = array_values( + array_filter( + $data, + function ($item) { + return (bool) (array) $item; + } + ) + ); + $count = count($data); + } + // RecordsTotal && recordsfiltered resultados totales. echo json_encode( [ @@ -2573,7 +2615,7 @@ try { if ($evento_id !== false) { $fields[$evento_id] = [ 'text' => 'evento', - 'class' => 'mw250px', + 'class' => 'mw180px', ]; } @@ -2582,23 +2624,24 @@ try { $fields[$comment_id] = ['text' => 'user_comment']; } - - foreach ($fields as $key => $field) { - if (is_array($field) === false) { - $fields[$key] = [ - 'text' => $field, - 'class' => 'mw100px', - ]; - } + $estado = array_search('estado', $fields); + if ($estado !== false) { + $fields[$estado] = [ + 'text' => $fields[$estado], + 'class' => 'column-estado', + ]; } + + + // Always add options column. $fields = array_merge( $fields, [ [ 'text' => 'options', - 'class' => 'table_action_buttons mw120px', + 'class' => 'table_action_buttons mw100px', ], [ 'text' => 'm',