diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bdfea78..3c465071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * issue#458: Initialize and validate the active tab before saving view defaults, avoiding a TypeError that disables Syslog and stops processing * issue#459: Explain that SQL Expression rule previews search only queued incoming messages, so an empty preview is not mistaken for an alert-processing failure +* issue#461: Fit message previews to the available column width instead of cutting them to 100 characters * issue#456: Avoid PHP 8.6 deprecation warnings during schema checks by using object IDs for the connection cache key diff --git a/includes/functions.php b/includes/functions.php index 66532312..2d5bd930 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -8232,10 +8232,9 @@ function syslog_message_button($message, $device, $program, $facility, $severity $details = compact('device', 'program', 'facility', 'severity', 'received'); $details['message'] = (string) $message; $details['rules'] = syslog_message_rule_links($id, $source, $received, $device); - $text = title_trim((string) $message, 100); return ''; + html_escape(json_encode($details, JSON_INVALID_UTF8_SUBSTITUTE)) . '">' . html_escape($details['message']) . ''; } /** diff --git a/tests/Fixtures/compact_workspace.php b/tests/Fixtures/compact_workspace.php index 69714d26..aae83c1f 100644 --- a/tests/Fixtures/compact_workspace.php +++ b/tests/Fixtures/compact_workspace.php @@ -12,12 +12,15 @@ function html_escape_request_var($key) { return html_escape(get_request_var($key function cacti_sizeof($value) { return count($value); } function api_plugin_hook($name) {} function api_plugin_user_realm_auth($page) { return true; } +function db_fetch_assoc_prepared($sql, $params = []) { return [['id' => 1]]; } +function is_realm_allowed($realm) { return true; } +function read_config_option($name, $force = false) { return ''; } require dirname(__DIR__, 2) . '/includes/functions.php'; $saved_choices_json = '{}'; $saved_fields_json = html_escape(json_encode(['host'=>'Host','message'=>'Message','program'=>'Program','logtime'=>'Date','priority'=>'Priority'])); $saved_tree_json = html_escape(json_encode(['AND',['predicate','host','=','10.0.0.5'],['predicate','logtime','last','86400']])); $saved_searches = [['id'=>7,'name'=>'Router investigation','is_global'=>'','user'=>'tester']]; -$saved_active = 7; $saved_admin = true; +$saved_active = 7; $saved_admin = true; $saved_share = true; $username = 'tester'; $item_rows = [50=>'50',100=>'100'];$trimvals = [0=>'Fit column',75=>'75 Chars',1024=>'All Text'];$page_refresh_interval = [0=>'Paused',300=>'5 Minutes']; $source = file_get_contents(dirname(__DIR__, 2) . '/syslog.php'); $start = strpos($source, "