Skip to content

mactrack: show MAC authorization as a themed status pill - #390

Merged
TheWitness merged 5 commits into
developfrom
feature/mac-auth-status-pill
Oct 10, 2026
Merged

TheWitness merged 5 commits into
developfrom
feature/mac-auth-status-pill

Conversation

@TheWitness

Copy link
Copy Markdown
Member

On the MacTrack MAC Addresses tab, the authorization column was plain
coloured text (<span class="deviceUp">Authorized</span> /
deviceDown "Not Authorized"). This converts it to a themed status pill
consistent with the interface and 802.1x pills:

  • Authorized → green, Unauthorized → red, per spec.
  • Colours come from new .mactrackPill.mac_authorized / .mactrackPill.mac_unauthorized
    entries in all 8 theme stylesheets, reusing each theme's existing pill
    green/red (deepness keeps its own green), so it follows the active theme.
  • Markup is produced by a new mactrack_mac_auth_pill() helper (mirrors
    mactrack_dot1x_status_pill()); both view call sites (mactrack_view_macs()
    and mactrack_view_aggregated_macs()) now call it.

The helper is unit-tested (MactrackStatusPillsTest); the two view call sites
are view glue. POT regenerated (adds "Unauthorized", drops the now-unused
"Not Authorized"); CHANGELOG updated.

Reviewers: @bmfmancini @xmacan

On the MAC Addresses tab, render the authorized column as a status pill consistent with the interface/802.1x pills: green 'Authorized' / red 'Unauthorized' via new .mactrackPill.mac_authorized/.mac_unauthorized colors in all 8 theme stylesheets. Markup is produced by a unit-tested mactrack_mac_auth_pill() helper; the two view call sites are view glue. POT + CHANGELOG updated.
@TheWitness
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 10, 2026 21:28

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

The new status button is focusable and styled as interactive but has no action.

1 open finding
What changed in this PR

Adds themed authorization status pills to MAC address views.

Changes:

  • Adds reusable authorization-pill markup and unit tests.
  • Adds green/red styling across all eight themes.
  • Updates translations and changelog.
File Description
lib/​mactrack_functions.php Adds authorization-pill helper.
mactrack_view_macs.php Uses pills in both MAC views.
tests/​Unit/​MactrackStatusPillsTest.php Tests authorized and unauthorized output.
locales/​po/​cacti.pot Updates translatable labels.
css/​classic.css Adds theme colors.
css/​dark.css Adds theme colors.
css/​deepness.css Adds theme colors.
css/​mactrack.css Adds fallback theme colors.
css/​modern.css Adds theme colors.
css/​paper-plane.css Adds theme colors.
css/​paw.css Adds theme colors.
css/​sunrise.css Adds theme colors.
CHANGELOG.md Documents the feature.

🧠 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
New first MacTrack tab presenting admin metrics as a draggable, add/remove card grid in the same layout as the syslog Status tab (self-contained bundled css/cards.css + js/cards.js, no cross-plugin dependency; theme-adaptive via currentColor). Cards: inventory, device status (bars), address/port totals, collection settings, scan runtimes + slowest devices, database table sizes, MacWatch activity, vendor breakdown. Layout persists per user (settings_user) via AJAX dash_card/dash_layout endpoints. Registers the page (Viewer realm), prepends the Dashboard tab, loads assets in page_head, adds a breadcrumb. mactrack_tabs() unit-tested; POT/manifest/CHANGELOG updated.
Fold the inventory count queries into one row query (6 raw literal admin queries, recorded in the prepared-statement baseline since they take no user input); add read_user_setting/sanitize_search_string unit-test stubs so MactrackTabsTest can exercise mactrack_tabs().
The dashboard view page runs under a live Cacti (auth + general_header) so it is not loaded by the unit suite; add it to the patch-coverage unmeasured allowlist alongside the other view pages.
Address PR review: the pill was a focusable button with no action. It now carries data-mac-authorized and, like the interface/802.1x pills, clicking it sets the Authorized filter (#authorized) to that state and re-applies the filter, so it is no longer a no-op control.
@TheWitness
TheWitness merged commit 887eb02 into develop Oct 10, 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