Skip to content

Monitor: redesign status legend as theme-appropriate colour chips - #260

Merged
TheWitness merged 3 commits into
developfrom
feature/legend-theme-chips
Oct 7, 2026
Merged

TheWitness merged 3 commits into
developfrom
feature/legend-theme-chips

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Description

Redesigns the Monitor status legend to match the thold and syslog legends: instead of the old fixed-position bar whose cells reused the subtle device-tile tints, the legend now renders as an evenly sized, wrapping flex row of rounded, solid-colour chips with white text.

  • includes/controller.php now emits <div class='monitorLegend'> / <div class='monitorLegendItem …Full'> instead of the old .monitor_legend / .monitor_legend_cell markup.
  • css/monitor.css carries the chip layout and the standard solid palette, scoped under .monitorLegend .device…Full so the device tiles keep their existing tints — only the legend chips get solid colours (same technique thold uses).
  • Colours are semantic and consistent across every theme (up = green, down = red, recovering = amber, triggered = orange, acked/muted = purple/dark-red, warning = olive, alert = magenta, unknown = grey, no-availability-check = blue).
  • css/deepness.css overrides the Up chip to emerald (#1f9f6e) to harmonise with the Deepness palette, mirroring what the thold Deepness theme does.
  • Removed the now-dead per-theme .monitor_legend overrides from every theme stylesheet. Note: midwinter previously hid the legend entirely (display:none); it now shows the chip legend like the other themes.

All themes are in scope (classic, modern, paw, dark, midwinter, sunrise, paper-plane, and deepness).

Related Issue

Follows the same legend-chip treatment previously applied to thold and syslog.

Motivation and Context

A legend is a colour key, so its swatches should be solid and legible on every theme rather than inheriting the faint tile tints (which were hard to read, especially on dark themes). This brings Monitor's legend in line with the thold and syslog plugins for a consistent look across the Cacti plugin family.

How Has This Been Tested?

  • php -l clean on includes/controller.php.
  • Every edited stylesheet is brace-balanced (open == close).
  • Confirmed no stale .monitor_legend / .monitor_legend_cell CSS-class references remain (the surviving monitor_legend references are the user/config setting name that toggles the legend, which is unchanged).
  • The legend markup lives in includes/controller.php, which is already on the patch-coverage $unmeasured_allowlist; CSS files are not coverage-gated.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.

Match the thold and syslog legends: render the status key as an evenly sized, wrapping flex row of rounded, solid-colour chips with white text (controller.php now emits .monitorLegend/.monitorLegendItem instead of the old fixed-position .monitor_legend bar). Chip colours are scoped under .monitorLegend so the device tiles keep their subtle tints. The standard solid palette lives in css/monitor.css and applies to every theme; css/deepness.css overrides the Up chip to emerald to harmonise with the Deepness palette. Removed the now-dead per-theme .monitor_legend overrides (midwinter previously hid the legend via display:none; it now shows chips like the other themes).
Copilot AI balanced review requested due to automatic review settings October 7, 2026 11:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Both Up-chip colours have insufficient white-text contrast for WCAG AA compliance.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Redesigns the Monitor status legend as theme-aware, wrapping colour chips while preserving existing device-tile styling.

Changes:

  • Replaces legacy legend markup and fixed positioning.
  • Adds solid semantic colours with a Deepness-specific accent.
  • Removes obsolete theme overrides and documents the change.
File Description
includes/​controller.php Emits the new legend chip markup.
css/​monitor.css Defines shared chip layout and colours.
css/​deepness.css Adds the Deepness Up-chip accent.
css/​classic.css Removes the legacy legend override.
css/​dark.css Removes the legacy legend override.
css/​midwinter.css Enables the redesigned legend.
css/​modern.css Removes the legacy legend override.
css/​paper-plane.css Removes the legacy legend override.
css/​paw.css Removes the legacy legend override.
css/​sunrise.css Removes legacy positioning and colouring.
CHANGELOG.md Records the legend redesign.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread css/deepness.css Outdated
Comment thread css/monitor.css Outdated
TheWitness and others added 2 commits October 7, 2026 07:22
Change background color for deviceUpFull class to better match Deepness palette.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@TheWitness
TheWitness merged commit f50de0c into develop Oct 7, 2026
5 checks passed
@TheWitness
TheWitness deleted the feature/legend-theme-chips branch October 7, 2026 11:28
TheWitness added a commit that referenced this pull request Oct 7, 2026
…rflow (#261)

Three follow-ups to the legend-chip redesign (PR #260): (1) legend chips kept overflowing their rounded bounds when space was tight - added min-width:max-content (keeping white-space:nowrap) so each chip is at least as wide as its label and wraps to a new row instead of clipping. (2) device-tile status icons were coloured by the core .deviceXxx classes, which did not match the legend; monitor.css now colours .mon_icon.deviceXxx from the same solid legend palette (with !important to beat the core themes' !important rules), including the Deepness emerald Up. (3) List view now adopts the Cacti deviceStatus pill design: the status cell is wrapped in a .monitorStatus.deviceStatus pill coloured from the legend palette, and the whole-row tint was removed so only the pill is coloured. includes/render.php added to the patch-coverage allowlist (auth-gated render library, not unit-loadable, same as controller.php).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants