From ea474ecd89d639e5f97cd0ea06e9de2cfca631d8 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 4 Dec 2023 15:05:01 +0100 Subject: [PATCH 1/3] #12566 changes in events table --- pandora_console/include/functions_ui.php | 23 ++++++--------------- pandora_console/operation/events/events.php | 14 +++---------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 5c9a7e90fc..3f9146e7d9 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7170,32 +7170,21 @@ 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'].''; + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px', 'prominent' => 'compact']).' ('.$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.'...'; - } + if (strlen($comentario) > '200px' && $truncate_limit >= 255) { + $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$short_comment.'...'; } - $comentario = io_safe_output($comentario); - if (strlen($comentario) >= $truncate_limit) { $comentario = ui_print_truncate_text( $comentario, diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index be5f6047e3..e019d12ab1 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -899,7 +899,7 @@ if (is_ajax() === true) { true, [ 'title' => __('Unknown'), - 'class' => 'forced-title', + 'class' => 'forced-title main_menu_icon', ] ); $state = 0; @@ -1199,10 +1199,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, @@ -2595,14 +2595,6 @@ try { } - foreach ($fields as $key => $field) { - if (is_array($field) === false) { - $fields[$key] = [ - 'text' => $field, - 'class' => 'mw100px', - ]; - } - } // Always add options column. $fields = array_merge( From 1a9bdf97d17e5ab425e06bcf9747b43c2514e5d7 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Mon, 11 Dec 2023 17:01:40 +0100 Subject: [PATCH 2/3] #12566 changes in view events --- pandora_console/include/functions_events.php | 7 +++- pandora_console/include/functions_ui.php | 12 ++++--- pandora_console/include/styles/events.css | 21 ++++++++++++ pandora_console/operation/events/events.php | 34 +++++++++++++------- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 013698b33d..2436558967 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6420,7 +6420,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 3f9146e7d9..3ea3e8a740 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7179,11 +7179,7 @@ function ui_print_comments($comment, $truncate_limit=255) $comment['comment'] = io_safe_output($comment['comment']); $short_comment = substr($comment['comment'], 0, 20); - $comentario = ''.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px', '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', 'prominent' => 'compact']).' ('.$comment['id_user'].'): '.$short_comment.'...'; - } + $comentario = $comment['comment']; if (strlen($comentario) >= $truncate_limit) { $comentario = ui_print_truncate_text( @@ -7198,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..24d64ce05d 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -108,6 +108,27 @@ 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; +} + +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 e019d12ab1..eaf3066e4d 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -906,7 +906,7 @@ if (is_ajax() === true) { break; } - $draw_state = '
'; + $draw_state = '
'; $draw_state .= ''; @@ -1232,15 +1232,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( [ @@ -2585,7 +2588,7 @@ try { if ($evento_id !== false) { $fields[$evento_id] = [ 'text' => 'evento', - 'class' => 'mw250px', + 'class' => 'mw180px', ]; } @@ -2594,6 +2597,15 @@ try { $fields[$comment_id] = ['text' => 'user_comment']; } + $estado = array_search('estado', $fields); + if ($estado !== false) { + $fields[$estado] = [ + 'text' => $fields[$estado], + 'class' => 'column-estado', + ]; + } + + // Always add options column. From fed0d92805f0dc73e064aac9b84468bb9d77d3b3 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Wed, 13 Dec 2023 19:53:14 +0100 Subject: [PATCH 3/3] #12566 fixed colums module_custom_id and event_custom_id length_ --- pandora_console/include/styles/events.css | 8 ++++ pandora_console/operation/events/events.php | 41 ++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 24d64ce05d..78286c79f9 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -116,6 +116,14 @@ td > input[id^="checkbox-multi"] { 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; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index eaf3066e4d..66a33e6a0e 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); } @@ -2614,7 +2653,7 @@ try { [ [ 'text' => 'options', - 'class' => 'table_action_buttons mw120px', + 'class' => 'table_action_buttons mw100px', ], [ 'text' => 'm',