Skip to content

Add legend-aligned status pills and multi-select Status filter to interfaces and dot1x views - #388

Merged
TheWitness merged 10 commits into
developfrom
feature/interface-dot1x-status-pills
Oct 9, 2026
Merged

TheWitness merged 10 commits into
developfrom
feature/interface-dot1x-status-pills

Conversation

@TheWitness

Copy link
Copy Markdown
Member

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+:

  • Replaces the status-coloured rows with a zebra-striped list.
  • Adds an Issues column rendering one clickable pill per legend state (Interface Up, No Alias, Errors Present, Discards Present, No Graphs, Interface Down); the states that currently apply to each interface are highlighted, the rest show as muted outlines.
  • Adds a new Status filter built as a multi-select using Base Cacti's Graph View "Graph Templates" widget (select2-multi-count), since the existing "Filters" dropdown does not align with the legend.
  • Drill-down: clicking a pill toggles that state in the multi-select Status filter (selects it if absent, deselects it if present) and re-applies the filter.
  • On cores older than 1.2.32 the view is unchanged (status-coloured rows, no Issues column, no multi-select).

802.1x view (mactrack_view_dot1x.php):

  • Adds a Status column immediately after the username rendering the session status as a pill.
  • Drill-down: clicking the pill sets the Status filter to that session status and re-applies the filter.

Pill styling ships in a new css/mactrack_pills.css loaded 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 -l on every changed PHP file (clean on PHP 8.4; written to the 8.2 floor).
  • Manual review of the generated header/row column ordering and the select2-multi-count markup against Base Cacti's Graph View filter.

Types of changes

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

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation repository accordingly.

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
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 8, 2026 23:19

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.

🟡 Changes recommended

Duplicate status columns, per-row database queries, and inaccessible pill controls should be addressed before approval.

7 open findings
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.

Comment thread lib/mactrack_functions.php Outdated
Comment thread lib/mactrack_functions.php Outdated
Comment thread lib/mactrack_functions.php Outdated
Comment thread mactrack_view_dot1x.php Outdated
Comment thread mactrack_view_interfaces.php Outdated
Comment thread lib/mactrack_functions.php
Comment thread lib/mactrack_functions.php Outdated
- 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().
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment thread css/classic.css Outdated
Comment thread css/dark.css Outdated
Comment thread css/deepness.css Outdated
Comment thread css/mactrack.css Outdated
Comment thread css/modern.css Outdated
Comment thread css/sunrise.css Outdated
Comment thread mactrack_view_dot1x.php Outdated
Comment thread tests/Unit/MactrackStatusPillsTest.php Outdated
Comment thread tests/Unit/MactrackStatusPillsTest.php
Comment thread tests/Unit/MactrackStatusTokensTest.php
bmfmancini
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.
@TheWitness
TheWitness merged commit af3b27e into develop Oct 9, 2026
5 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.

3 participants