Repository navigation
syslog: equal-width severity-legend chips via CSS grid + longest-label seed - #390
Merged
Merged
Conversation
…l seed Brings the System Logs and Alert Logs severity legends in line with the thold/monitor/servcheck/mactrack legends. syslog_syslog_legend() and syslog_log_legend() now emit --syslog-chip-min (calc(longest-label ch + 1.5rem)), and .syslogLegend is a grid (repeat(auto-fit, minmax(var(--syslog-chip-min), 1fr))) across all nine theme stylesheets instead of flex: 1 1 0 (which only equalised chips within a wrapped line). Tests assert the exact chip-min value.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Translated labels remain unescaped, and translated-label sizing lacks direct test coverage.
3 open findings
What changed in this PR
Updates Syslog severity legends to use equal-width CSS grid chips sized from the longest translated label.
Changes:
- Computes and emits a minimum chip width for both legends.
- Applies grid layout across all theme stylesheets.
- Adds rendering assertions and a changelog entry.
| File | Description |
|---|---|
includes/functions.php |
Calculates chip width and renders legend items. |
tests/Unit/SyslogLegendTest.php |
Tests generated legend sizing markup. |
css/classic.css |
Adds grid-based legend layout. |
css/dark.css |
Adds grid-based legend layout. |
css/deepness.css |
Adds grid-based legend layout. |
css/legend.css |
Updates the fallback legend layout. |
css/midwinter.css |
Adds grid-based legend layout. |
css/modern.css |
Adds grid-based legend layout. |
css/paper-plane.css |
Adds grid-based legend layout. |
css/paw.css |
Adds grid-based legend layout. |
css/sunrise.css |
Adds grid-based legend layout. |
CHANGELOG.md |
Documents the legend update. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…slated labels Review follow-up (#390): use [] short-array syntax for the new legend item collections to match the rest of the file; add a test that overrides __() so a short English label ('Error') has the longest translation, proving --syslog-chip-min is sized from the emitted (translated) output rather than the English source.
Defence-in-depth: wrap the legend chip display text in html_escape() so markup or HTML entities in a translated label cannot alter the legend DOM. Applied consistently across the thold/monitor/servcheck/mactrack/syslog fleet legends. The chip-min sizing still measures the unescaped label length, so layout is unchanged. Resolves the review note on #390.
xmacan
previously approved these changes
Oct 7, 2026
Resolve legend conflicts: keep the CSS-grid equal-width approach (drop develop's leftover flex:1 1 0 / min-width on .syslogLegendItem), keep escaped chip labels in functions.php, keep the PR's exact calc() legend tests, and retain develop's new changelog entries.
xmacan
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Brings syslog's System Logs and Alert Logs severity legends in line with the thold / monitor / servcheck / mactrack chip legends — equal-width chips sized to the longest label, laid out as a CSS grid.
Previously
.syslogLegenduseddisplay: flexwith.syslogLegendItem { flex: 1 1 0 }and no chip-min seeding at all, so the chips were neither sized to the longest label nor equal width across wrapped rows (each flex line distributes free space independently, stretching a partial final row).Change
includes/functions.php—syslog_syslog_legend()andsyslog_log_legend()now build their chip set as an array, compute the longest label, and emit<div class="syslogLegend" style="--syslog-chip-min: calc(<N>ch + 1.5rem)">. Same chips, same classes, same order.css/*.css(9 theme stylesheets) —.syslogLegend→display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--syslog-chip-min, 8ch), 1fr)), and dropflex: 1 1 0from.syslogLegendItem. Grid tracks are shared across all rows, so every chip is the same width;auto-fitstill lets the chips fill the width on a single row.tests/Unit/SyslogLegendTest.php— assert the exactcalc(<N>ch + 1.5rem)value for both legends.CHANGELOG.md— dev note.Matches the exact formula used by the other four plugin legends (
repeat(auto-fit, minmax(var(--<plugin>-chip-min, 8ch), 1fr))+calc(<longest mb_strlen>ch + 1.5rem)).Testing
php -lclean onincludes/functions.phpand the test.