Skip to content

Fit status pills to their label and clear the status filter on a second pill click - #854

Merged
TheWitness merged 1 commit into
developfrom
feature/pill-fit-and-filter-toggle
Oct 9, 2026
Merged

TheWitness merged 1 commit into
developfrom
feature/pill-fit-and-filter-toggle

Conversation

@TheWitness

@TheWitness TheWitness commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Two small follow-ups to the status-pill work (#851, #853).

Pills now fit their label

The pills were clipped to a fixed width on the Device Status page - long labels like Not Monitored overflowed the coloured pill. The cause is that each theme's single-class status rules (e.g. .deviceUpFull { width: 14%; padding: 3px; }) have the same specificity as the shared .thold-pill shape rule but load later, so they won the width/padding cascade.

Fix: element-qualify the shape rule as span.thold-pill (all pills are <span>s), raising its specificity above the single-class theme rules so the pill hugs its label in every theme. Shape-only; colours stay theme-aware.

Second click clears the filter

Clicking a status pill filters the list to that status. Now a second click on an already-selected status clears that filter (resets the Status <select> to All, value -1) instead of re-applying the same value. Applied to all three thold_graph.php sub-tabs - Thresholds, Device Status and Threshold Log - and the matching Thresholds console page (thold.php), which shares the same pill handler.

Testing / CI

  • php -l thold.php / php -l thold_graph.php - clean.
  • tests/bin/validate-manifest.php - passes (no file-set change).
  • No new translatable strings, so locales/po/cacti.pot is unchanged.
  • Changes are CSS + in-page JS only; no coverage-measured file (functions.php/polling.php/setup.php) is touched, so Pest/patch-coverage are unaffected.

…second click

The status pills were being clipped to a fixed width because the single-class theme rules (e.g. .deviceUpFull width:14%, padding:3px) outranked the equal-specificity .thold-pill shape rule, so long labels such as 'Not Monitored' overflowed the coloured pill on the Device Status page. Element-qualify the selector (span.thold-pill) so the shape rule wins and the pill hugs its label in every theme.

Also make a second click on an already-selected status pill clear that filter (reset the Status select to All, value -1) instead of re-applying the same value. Applied to all three thold_graph.php sub-tabs (Thresholds, Device Status, Threshold Log) and the matching Thresholds console page (thold.php).
@TheWitness
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 9, 2026 00:54

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.

🟢 Approval recommended

The changes consistently implement the described behavior without identified regressions.

0 open findings

What changed in this PR

Updates status pills to size correctly and allows a second click to clear an active status filter.

Changes:

  • Increases pill CSS specificity to override theme widths.
  • Toggles status filters across all relevant views.
  • Documents the changes.
File Description
thold.php Adds filter-toggle behavior.
thold_graph.php Adds toggling to all three sub-tabs.
css/​pills.css Ensures pills fit their labels.
CHANGELOG.md Records both updates.

🧠 Review effort: Balanced


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

@TheWitness
TheWitness merged commit 6bbfb58 into develop Oct 9, 2026
4 checks passed
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.

4 participants