Skip to content

Converge the statistics dashboard cards on the shared Card API - #20

Merged
TheWitness merged 3 commits into
mainfrom
feature/standard-cards-bundle
Nov 11, 2026
Merged

TheWitness merged 3 commits into
mainfrom
feature/standard-cards-bundle

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

Converges the AlarmManager Dashboard tab (statistics overview) onto the shared Cacti dashboarding Card API — the same css/cards.css bundle, byte-identical to the other in-scope plugins and the open core drafts:

  • css/cards.css md5 c4337c8dcb55eb638212de9e6fe7e1f1
  • js/cards.js md5 84876af1581b8f349f0a557c7e4ece28 (bundled for parity; the dashboard panels use the chrome CSS, not the controller)

What changed

  • The nine summary panels (alarmmanager_dashboard_markup()) now render with the standardized .cc* chrome — .ccCard / .ccCardHeader / .ccTitle / .ccTools / .ccTool / .ccCardBody + data-severity="none" — instead of the plugin's own .alarmmanagerDashboardCard* classes.
  • They are themed through the shared --cc-* custom properties, mapped on #alarmmanager_app from AlarmManager's existing --search-* palette (so light/dark themes follow automatically).
  • css/cards.css loads from the plugin only on cores that do not ship include/css/cards.css globally (file_exists gate, placed in the unmeasured page entry alarmmanager.php).
  • The collapse toggle, chart and legend bodies are unchanged; the admin configuration accordions keep their own .alarmmanagerDashboardCard markup (they are not a card-API surface).

Scope note

AlarmManager's dashboard is a fixed statistics grid with per-card collapse — not a draggable/addable dashboard like hmib/syslog. Following the same principle used for syslog's chart dashboard, this converges the chrome + bundle (visual consistency, shared vocabulary) while preserving the existing behavior, rather than adding drag/reorder/add-card.

Testing

  • New tests/Unit/Plugin/DashboardMarkupTest.php asserts the shared .cc* chrome on all nine panels and the removal of the retired dashboard-only classes (satisfies the 100% patch-coverage gate for the one changed includes/web_view.php line).
  • Full unit suite: 213 passed, 2 pre-existing env skips.
  • php-cs-fixer clean on the changed PHP; php -l clean.

Draft while the shared bundle finishes converging across the remaining plugins and the core repos.

The AlarmManager Dashboard tab's nine summary panels now render with the
standardized .cc* card chrome from the shared dashboarding bundle
(css/cards.css, byte-identical to the other plugins and the core drafts),
themed via --cc-* mapped from the plugin's palette. The collapse control
and chart/legend bodies are unchanged; the admin configuration accordions
keep their own .alarmmanagerDashboardCard markup. The bundled css/cards.css
loads only on cores that do not ship it globally (file_exists gate in the
unmeasured page entry).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TheWitness
TheWitness force-pushed the feature/standard-cards-bundle branch from efbe935 to c30e43f Compare November 10, 2026 15:36
@TheWitness
TheWitness marked this pull request as ready for review November 11, 2026 00:24
Copilot AI balanced review requested due to automatic review settings November 11, 2026 00:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The browser harness still asserts a removed dashboard selector, blocking later checks, while the fixture router rejects the new shared card stylesheet.

2 open issues
What changed in this PR

Moves AlarmManager’s nine statistics panels to the shared Cacti Card API styling while preserving the fixed grid, collapse behavior, and separate admin accordions.

Changes:

  • Replaces dashboard-specific card markup with shared .cc* classes.
  • Bundles shared CSS and JavaScript, maps theme variables, and conditionally loads the CSS fallback.
  • Adds markup assertions and documents the change and verification status.
File Description
tests/​Unit/​Plugin/​DashboardMarkupTest.php Adds assertions for shared markup across nine panels.
js/​cards.js Bundles the shared controller for parity; not used by this dashboard.
includes/​web_view.php Switches statistics panels to shared card classes.
css/​dashboard.css Maps theme variables and removes retired dashboard styles.
css/​cards.css Adds shared card presentation styles.
CHANGELOG.md Records the migration and verification status.
alarmmanager.php Loads bundled CSS when the core stylesheet is absent.

Review effort: Balanced

Comment thread alarmmanager.php Resolved
Comment thread includes/web_view.php Resolved
bmfmancini
bmfmancini previously approved these changes Nov 11, 2026
…sync

- Add /plugins/alarmmanager/css/cards.css to the browser fixture router's asset
  allowlist so the harness serves the bundled card stylesheet instead of 404ing
  it and running without the shared card styling.
- Update the dashboard panel-grid assertion to .alarmmanagerDashboardGrid .ccCard
  (the new markup), keeping the old .alarmmanagerDashboardCard selectors for the
  admin accordions.
- Sync cards.js with the shared refresh-race fix, byte-identical with core.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Corrected shared controller (review on core #8700): replaceCard() carries the
live expand/collapse state onto refreshed markup only when the user toggled
during the request and the fresh card is still expandable; host markup stays
authoritative otherwise. Byte-identical with core and the other plugins.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit 1cb8c2a into main Nov 11, 2026
5 of 13 checks passed
@TheWitness
TheWitness deleted the feature/standard-cards-bundle branch November 11, 2026 16:53
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.

5 participants