diff --git a/CHANGELOG.md b/CHANGELOG.md index df657411..e4ea225c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * ci: Drop Ruby from the CodeQL language matrix; the plugin ships no Ruby source, so the Ruby database build failed with "no source code seen" * dev: Move the shared function and database libraries to includes/ and point the entry-point includes, coverage source, and tests at the new path * feature: Restyle the System Logs and Alert Logs severity legends as rounded, evenly spaced, solid-colour chips that line up with the Thold status legends, with theme-appropriate backgrounds loaded from a per-theme css/.css file (falling back to a theme-neutral css/legend.css) +* dev: Keep the severity-legend chips equal width (sized to the longest label) as the legend wraps responsively * dev: Measure CI coverage with xdebug instead of pcov so the plugin's own sources are instrumented (pcov auto-scopes to the Composer root and skipped cacti/plugins/, leaving the patch-coverage gate with nothing to measure) * dev: Enforce patch coverage of changed lines in CI and remove the inert COMPOSER_ROOT_VERSION env from the Pest step * feature: Add a Syslog-owned durable replication outbox for configured Remote Data Collectors; processed events are delivered idempotently to the Main Collector for centralized viewing, retained through outages, and retried during recovery, while intentionally discarded records remain unreplicated diff --git a/css/classic.css b/css/classic.css index 7eee6b3c..b47d85d8 100644 --- a/css/classic.css +++ b/css/classic.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/dark.css b/css/dark.css index e8692ed9..28788de1 100644 --- a/css/dark.css +++ b/css/dark.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/deepness.css b/css/deepness.css index e8692ed9..28788de1 100644 --- a/css/deepness.css +++ b/css/deepness.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/legend.css b/css/legend.css index a627d08f..f313d9c6 100644 --- a/css/legend.css +++ b/css/legend.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/midwinter.css b/css/midwinter.css index 1febac31..78fe9898 100644 --- a/css/midwinter.css +++ b/css/midwinter.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/modern.css b/css/modern.css index 3ded6964..c73080ed 100644 --- a/css/modern.css +++ b/css/modern.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/paper-plane.css b/css/paper-plane.css index 089d85ad..3c6ecfd2 100644 --- a/css/paper-plane.css +++ b/css/paper-plane.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/paw.css b/css/paw.css index 07d1b4c3..733b69ab 100644 --- a/css/paw.css +++ b/css/paw.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/css/sunrise.css b/css/sunrise.css index 00432e34..10dcc8ae 100644 --- a/css/sunrise.css +++ b/css/sunrise.css @@ -32,6 +32,7 @@ .syslogLegend .syslogLegendItem { flex: 1 1 0; + min-width: var(--syslog-chip-min, max-content); text-align: center; white-space: nowrap; padding: 4px 6px; diff --git a/includes/functions.php b/includes/functions.php index 0cb4d129..299c9252 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -747,16 +747,30 @@ function syslog_include_js(): void { function syslog_syslog_legend(): void { html_start_box('', '100%', '', '3', 'center', ''); + $items = [ + 'logEmergency' => __('Emergency', 'syslog'), + 'logCritical' => __('Critical', 'syslog'), + 'logAlert' => __('Alert', 'syslog'), + 'logError' => __('Error', 'syslog'), + 'logWarning' => __('Warning', 'syslog'), + 'logNotice' => __('Notice', 'syslog'), + 'logInfo' => __('Info', 'syslog'), + 'logDebug' => __('Debug', 'syslog'), + ]; + + $chip_min = 0; + + foreach ($items as $label) { + $chip_min = max($chip_min, mb_strlen($label)); + } + print ''; - print '
'; - print '
' . __('Emergency', 'syslog') . '
'; - print '
' . __('Critical', 'syslog') . '
'; - print '
' . __('Alert', 'syslog') . '
'; - print '
' . __('Error', 'syslog') . '
'; - print '
' . __('Warning', 'syslog') . '
'; - print '
' . __('Notice', 'syslog') . '
'; - print '
' . __('Info', 'syslog') . '
'; - print '
' . __('Debug', 'syslog') . '
'; + print '
'; + + foreach ($items as $class => $label) { + print '
' . $label . '
'; + } + print '
'; print ''; @@ -774,11 +788,25 @@ function syslog_syslog_legend(): void { function syslog_log_legend(): void { html_start_box('', '100%', '', '3', 'center', ''); + $items = [ + 'logAlert' => __('Alert', 'syslog'), + 'logWarning' => __('Warning', 'syslog'), + 'logInfo' => __('Informational', 'syslog'), + ]; + + $chip_min = 0; + + foreach ($items as $label) { + $chip_min = max($chip_min, mb_strlen($label)); + } + print ''; - print '
'; - print '
' . __('Alert', 'syslog') . '
'; - print '
' . __('Warning', 'syslog') . '
'; - print '
' . __('Informational', 'syslog') . '
'; + print '
'; + + foreach ($items as $class => $label) { + print '
' . $label . '
'; + } + print '
'; print ''; diff --git a/tests/Unit/SyslogLegendTest.php b/tests/Unit/SyslogLegendTest.php index 91fdef98..a1485e62 100644 --- a/tests/Unit/SyslogLegendTest.php +++ b/tests/Unit/SyslogLegendTest.php @@ -41,7 +41,7 @@ $output = ob_get_clean(); expect($output)->toContain(''); - expect($output)->toContain('
'); + expect($output)->toContain('
'); + expect($output)->toContain('