Repository navigation
Add legend-aligned status pills and multi-select Status filter to interfaces and dot1x views - #388
Merged
Merged
Conversation
On Cacti 1.2.32+, zebra-stripe the interfaces list and add an Issues column of clickable status pills (one per legend state, active highlighted). Clicking a pill toggles that state in a new multi-select Status filter styled like Base Cacti's Graph View Graph Templates selector. Also add a clickable status pill column to the 802.1x view after the username that drills down into the Status filter.
TheWitness
requested review from
bmfmancini and
xmacan
and
a balanced review from Copilot
October 8, 2026 23:19
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Duplicate status columns, per-row database queries, and inaccessible pill controls should be addressed before approval.
7 open findings
Avoid per-row COUNT queries for project graph checks · New Use a keyboard-accessible button for status drill-down · New Make the 802.1x drill-down keyboard accessible · New Avoid duplicate Status column and row value · New Apply status filtering only when enhanced view is enabled · New Add tests for status allowlist parsing and filtering · New Reuse the canonical device status map · New
What changed in this PR
Adds status pills and drill-down filtering to interface and 802.1x views.
Changes:
- Adds interface issue pills and multi-select filtering for Cacti 1.2.32+.
- Adds clickable 802.1x status pills.
- Introduces shared pill styling and changelog entries.
| File | Description |
|---|---|
setup.php |
Loads pill styling globally. |
mactrack_view_interfaces.php |
Adds status filtering, Issues column, and drill-down behavior. |
mactrack_view_dot1x.php |
Adds pill column and status drill-down. |
lib/mactrack_functions.php |
Implements status detection and pill rendering. |
css/mactrack_pills.css |
Defines pill presentation and colors. |
CHANGELOG.md |
Documents the features. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Project interface graph existence as a has_graphs EXISTS column in mactrack_get_records() and consume it in mactrack_int_statuses(), eliminating the per-row COUNT(*) (N+1) on the interfaces list. - Render interface and 802.1x status pills as <button type=button> so the drill-downs are keyboard/AT accessible; add button resets and a :focus-visible state to the pill CSS. - Drop the duplicate sortable Status column in the dot1x view; the status pill after the username is now the single Status column. - Only honour the statuses filter when the enhanced view is enabled, so the legacy pre-1.2.32 view is truly unchanged. - Reuse the shared \ map in the dot1x pill instead of a drifted local copy (No method vs No Method). - Add MactrackStatusTokensTest unit coverage for mactrack_parse_status_tokens().
Relocate the Issues status-pill column from the far right (after Status) to immediately after the interface Description column so the pills sit beside the port/hardware description instead of across the table.
Move the pill structure and per-state --pill colours into each theme CSS file (and the base mactrack.css) so pills follow the selected theme's status palette, matching the legend chips. Remove css/mactrack_pills.css and its always-on include in mactrack_page_head().
…om patch coverage
Add form_selectable_cell/cacti_version_compare stubs and a CACTI_VERSION define to the unit bootstrap (instead of at test-file scope), and cover mactrack_parse_status_tokens and mactrack_format_interface_row so every changed lib line is exercised.
…tubs to unit bootstrap Required by MactrackStatusPillsTest after moving these declarations out of test-file scope; without them the status-pill tests fatal on undefined symbols.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The pills have insufficient inactive-text contrast, and the 802.1x Status column loses existing sorting behavior.
12 open findings
Prevent inactive button opacity from reducing text contrast · New Preserve inactive button label contrast · New Preserve inactive button label contrast · New Prevent inactive button opacity from reducing text contrast · New Prevent inactive button opacity from reducing text contrast · New Prevent inactive button opacity from reducing text contrast · New Prevent inactive button opacity from reducing text contrast · New Prevent inactive button opacity from reducing text contrast · New Renaming status key removes column sorting · New Move guarded Cacti stub to shared test bootstrap · New Add required GPL v2 header · New Add required GPL v2 header · New
7 resolved since last review
Apply status filtering only when enhanced view is enabled Avoid duplicate Status column and row value Make the 802.1x drill-down keyboard accessible Use a keyboard-accessible button for status drill-down Avoid per-row COUNT queries for project graph checks Reuse the canonical device status map Add tests for status allowlist parsing and filtering
🧠 Review effort: Balanced
…city) and add full GPL header to unit tests
bmfmancini
approved these changes
Oct 9, 2026
bmfmancini
previously approved these changes
Oct 9, 2026
…ders - Keep pill labels at full-opacity theme foreground (color: inherit) and convey state via the border/fill only, so inactive pills meet contrast on light and dark themes; add button resets and a :focus-visible outline across all eight theme stylesheets. - Restore the dot1x Status column sort key (status/ASC) that was lost when the pill column was renamed. - Full GPL v2 headers on the new unit tests; drop the duplicate parse-token test now covered by MactrackStatusTokensTest.
bmfmancini
approved these changes
Oct 9, 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
Reworks the status presentation on the interfaces and 802.1x views and adds a legend-aligned, multi-select status filter with pill drill-downs.
Interfaces view (
mactrack_view_interfaces.php) — gated to Cacti 1.2.32+:select2-multi-count), since the existing "Filters" dropdown does not align with the legend.802.1x view (
mactrack_view_dot1x.php):Pill styling ships in a new
css/mactrack_pills.cssloaded on every MacTrack page so pills render consistently regardless of the selected theme. Status filter tokens are validated against a strict allowlist before they ever reach SQL.Related Issue
Motivation and Context
The status colours alone were hard to scan and offered no way to filter interfaces by a specific legend state. Pills make every applicable state explicit, zebra striping keeps dense lists readable, and the multi-select Status filter (plus pill drill-downs) lets operators pivot straight from a row to "show me everything in this state."
How Has This Been Tested?
php -lon every changed PHP file (clean on PHP 8.4; written to the 8.2 floor).Types of changes
Checklist: