Repository navigation
Theme the syslog severity legends as rounded, solid-colour chips - #385
Merged
Merged
Conversation
Restyle the System Logs and Alert Logs legends to match the Thold status legends: rounded, evenly spaced, solid-colour severity chips. Move the two legend renderers into functions.php (so they are unit-testable) emitting .syslogLegend/.syslogLegendItem markup, and have syslog_include_js() load a per-theme css/<theme>.css legend palette with a css/syslog.css fallback. Ship light (classic, modern, paw) and dark (dark, midwinter, sunrise, paper-plane) palettes, plus the base fallback palette in syslog.css.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The fallback loads email-oriented global CSS into web pages, and several light-theme chip colors have insufficient text contrast.
Review effort: Balanced
Findings: 5
Open (6)
What changed in this PR
Restyles Syslog severity legends as theme-aware chips and moves rendering into shared, testable functions.
Changes:
- Adds flex-based legend markup and per-theme palettes.
- Adds sanitized theme stylesheet selection with fallback behavior.
- Adds unit coverage and changelog documentation.
| File | Description |
|---|---|
functions.php |
Renders legends and selects theme CSS. |
syslog.php |
Removes relocated legend functions. |
css/syslog.css |
Adds fallback legend styling. |
css/classic.css |
Adds classic-theme palette. |
css/dark.css |
Adds dark-theme palette. |
css/midwinter.css |
Adds midwinter palette. |
css/modern.css |
Adds modern-theme palette. |
css/paper-plane.css |
Adds paper-plane palette. |
css/paw.css |
Adds paw-theme palette. |
css/sunrise.css |
Adds sunrise palette. |
tests/Unit/SyslogLegendTest.php |
Tests markup and stylesheet selection. |
CHANGELOG.md |
Documents the feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
added 5 commits
October 6, 2026 13:27
Relocate the shared Syslog function library to includes/functions.php and load it once via a top-level require in setup.php (removing the two redundant lazy include_once calls in syslog_connect()/syslog_poller_bottom()). Update every entry-point include, the 33 test loaders, IncludePathNormalizationTest, CsrfPurgeTest's sandbox layout, and fix the library's internal __DIR__ paths to dirname(__DIR__). Point phpunit.xml coverage source at includes/functions.php, and move the unloadable web/CLI entry points out of <source> into the patch-coverage allowlist.
Revert the top-level require_once added to setup.php (it pulled functions.php into every page that loads the plugin's setup.php for hook registration). Restore the original on-demand include_once of the library inside syslog_connect() and syslog_poller_bottom() at the new includes/ path. Those two lines run only in a live Cacti/poller process and cannot be unit-covered, so setup.php moves out of phpunit.xml <source> into the patch-coverage allowlist; SetupSmallHelpersTest still exercises its pure helpers.
Darken the light-theme warning (#b5730e -> #9c5d0a) and info (#3f8f4a -> #2f7d3a) chips so white label text meets WCAG AA 4.5:1. Replace the email-oriented syslog.css web fallback with a new legend-only css/legend.css so themes without a dedicated palette (carrot, cacti) no longer inherit syslog.css's global body/table/th rules; syslog.css returns to report/email styling only. Add the full GPL v2 header to every new css file.
The plugin ships no Ruby source, so 'codeql database finalize' for Ruby failed with 'no source code seen'. Analyze only the languages actually present (javascript-typescript, python).
xmacan
previously approved these changes
Oct 6, 2026
database.php is a pure library (function definitions only, no top-level execution), so it joins includes/functions.php. Update every entry-point include, phpunit.xml coverage source, and IncludePathNormalizationTest at the new path. The move is a 100%-identical rename (gate-excluded); the touched entry points and setup.php are already in the patch-coverage allowlist.
xmacan
approved these changes
Oct 6, 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.


Description
Restyle the System Logs and Alert Logs severity legends so they line up with the Thold status legends (PR Cacti/plugin_thold#831): rounded corners, even spacing, and solid, opaque theme-appropriate background colours instead of flat, edge-to-edge table cells.
Changes:
.syslogLegendflex row of.syslogLegendItemchips. Each chip keeps the samelog*severity class the result rows use (logEmergency,logWarning, …), so the active theme's legend stylesheet supplies the background colour.syslog_include_js()loads a per-theme legend palette fromcss/<theme>.csswhen one exists, and falls back tocss/syslog.cssotherwise. The theme name comes fromget_selected_theme()and is sanitised before it ever reaches the filesystem (path-traversal hardening).css/<theme>.cssfile for every packaged Cacti theme — light palette forclassic,modern,paw; dark palette fordark,midwinter,sunrise,paper-plane. The base light palette also lives incss/syslog.cssas the fallback for themes that ship no dedicated file (e.g.carrot,cacti).syslog.phpweb entry point into the unit-testablefunctions.php(their call sites insyslog.phpare unchanged), matching the Thold legend layout and keeping them within the plugin's coverage model.No translatable strings were added or removed (only moved between files), so
locales/po/cacti.potneeds no regeneration.Related Issue
Follow-on styling parity with Cacti/plugin_thold#831 (rounded, solid-colour status legend chips).
Motivation and Context
The syslog legends were rendered as plain full-width table cells, which did not match the newer Thold status legends and did not adapt their chip colours to light vs dark themes. This brings the two plugins' status keys into visual alignment and makes each severity recognisable on every packaged theme.
How Has This Been Tested?
php -lon the changed PHP files.tests/Unit/SyslogLegendTest.php(Pest) asserts: one chip per severity for both legends with the correctlog*class and label; the theme stylesheet is linked when the theme ships one; thesyslog.cssfallback is used otherwise; and the theme name is sanitised against path traversal.check-i18n-pot.phpgate reports no required.potupdate.Types of changes
Checklist: