Skip to content

Converge Status cards and chart Dashboards on the shared Card API - #437

Open
TheWitness wants to merge 2 commits into
developfrom
feature/standard-cards-bundle
Open

TheWitness wants to merge 2 commits into
developfrom
feature/standard-cards-bundle

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

Converges the two syslog card surfaces — the Status tab and the user chart Dashboards — onto the shared Cacti dashboarding Card API (js/cards.js + css/cards.css), the same byte-identical bundle used by the other in-scope plugins (intropage, mactrack, hmib, apcupsd) so it can be promoted into Cacti core unchanged.

This is the syslog step of the cross-plugin card standardization. The canonical bundle here matches the open core/plugin drafts:

  • js/cards.js md5 84876af1581b8f349f0a557c7e4ece28
  • css/cards.css md5 c4337c8dcb55eb638212de9e6fe7e1f1

What changed

Status tab (hmib-style status cards)

  • The Status-card controller moves out of js/functions.js into a thin js/syslog_dashboard.js adapter over the shared CactiCards controller (drag/keyboard reorder, show more/less, maximize, refresh, remove, add-from-catalogue, debounced layout save). functions.js keeps only the search/UI logic.
  • syslog.php emits the standardized .cc* chrome (.ccToolbar/.ccAdd/.ccRefresh/.ccGrid/.ccCard/.ccCardHeader/.ccDrag/.ccTitle/.ccTools/.ccTool/.ccCardBody) and data-severity; the grid id is syslog_status_grid.
  • Card content (status tables, key/value rows, notes) keeps its plugin-prefixed syslogStatus* classes per the contract (only the chrome is standardized).

Chart Dashboards (billboard.js panels)

  • Panel cards now carry the shared .cc* chrome while keeping syslogDashboardCard as a plugin marker for the continuous drag-resize (width → column span, height → chart pixels), which is preserved intentionally (no stepped ccH).

Theme + assets

  • --cc-* custom properties are bound to syslog's theme (currentColor-derived, following every Cacti theme) in css/search.css (Status) and css/dashboard.css (Dashboards); the old per-plugin chrome CSS is retired in favour of css/cards.css.
  • css/cards.css and js/cards.js load from the plugin only on cores that do not ship them globally (file_exists gate).

Testing

  • php -l + node -c clean on all changed files.
  • Full plugin Pest suite (Unit + Security): 631 passed, 2650 assertions.
  • Browser fixture tests/browser/dashboard_cards.cjs (rewritten for .cc*): Status/Dashboard chrome parity (light + dark) and panel drag/keyboard reordering pass.
  • Updated tests/Unit/PipelineHealthTest.php for the data-severity chrome.

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

The Syslog Status cards and the user chart Dashboards now use the shared
Cacti dashboarding Card API (js/cards.js + css/cards.css, kept byte-identical
across plugins so the bundle can be promoted into Cacti core unchanged). Both
render with the standardized .cc* card chrome (drag/keyboard reorder, show
more/less, maximize, refresh, remove).

The Status-tab controller moves out of js/functions.js into a thin
js/syslog_dashboard.js adapter over the shared CactiCards controller; the chart
panels adopt the same chrome while keeping their continuous drag-resize. The
plugin's bundled css/cards.css and js/cards.js load only on cores that do not
ship them globally (file_exists gate); the --cc-* theme bindings live in
css/search.css (Status) and css/dashboard.css (Dashboards).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TheWitness
TheWitness force-pushed the feature/standard-cards-bundle branch from 9422f44 to 9aea87e Compare November 10, 2026 15:06
@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
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Status cards can create unintended columns on phones, and overlapping refresh requests can let older responses overwrite newer data.

2 open issues
What changed in this PR

Standardizes Syslog’s Status cards and chart Dashboard panels on shared Cacti card styling, while moving Status interactions into an adapter over the shared controller.

Changes:

  • Adds shared card assets with fallback loading when core does not provide them.
  • Migrates both surfaces to .cc* markup while preserving chart panels’ continuous resizing.
  • Updates theme bindings, browser checks, and the pipeline-health assertion.
File Description
tests/​Unit/​PipelineHealthTest.php Checks the new severity attribute.
tests/​browser/​dashboard_cards.cjs Updates style and reorder checks for shared markup.
syslog.php Emits shared card markup and loads fallback assets.
js/​syslog_dashboard.js Adds the Status adapter and refresh/layout integration.
js/​functions.js Removes the previous Status controller.
js/​dashboard.js Migrates chart panels to shared card classes.
js/​cards.js Adds reusable card interactions and layout persistence hooks.
css/​search.css Replaces Status chrome with theme bindings.
css/​dashboard.css Adds shared theme bindings for chart panels.
css/​cards.css Defines shared card styling and state presentation.
CHANGELOG.md Documents the migration and asset-loading behavior.

Review effort: Balanced

Comment thread css/search.css Resolved
Comment thread js/syslog_dashboard.js Resolved
bmfmancini
bmfmancini previously approved these changes Nov 11, 2026
- Clamp the shared .ccW* spans at the Status grid breakpoints (.ccW5-8 at four
  columns, every card to a full row at one column) so reducing --cc-cols no
  longer leaves wide spans creating implicit columns on phones.
- Track a per-card request generation in the fetchCard helper that both the
  per-card refresh and the toolbar Refresh all pass through, resolving a
  superseded request to null so an earlier response cannot overwrite newer
  Status data.
- Sync cards.js with the shared fix that preserves the live expand/collapse
  state at swap time (refresh race), byte-identical with core.

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

Copy link
Copy Markdown

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