Commit Graph
13 Commits
Author SHA1 Message Date
alcatron 14dc5eb7cc Add a preference for always-visible graph action icons (#8744)
* Add optional always-visible graph action icons

* Close visible graph submenus with Escape after Safari mouse clicks

* Document graph action display preference (#8744)

* Fix refreshed graph action labels and submenu stacking

* Refresh realtime action names and repair browser test setup
2026-11-17 12:02:28 -05:00
fb354dbf5e feature: add a shared dashboarding Card API (chrome + chart widgets) to core (#8683)
* feature: add a shared dashboarding Card API (chrome + chart widgets) to core (#8680)

* feature: add a shared dashboarding Card API to core

Ship the shared card chrome used by the dashboarding plugins as core assets:
include/js/cards.js (the window.CactiCards controller) and
include/css/cards.css (the themeable .cc* markup contract). Both are loaded by
the common page header (lib/html.php) so any plugin or core page can render a
draggable, reorderable grid of cards without bundling its own copy.

The files are byte-identical to the copies currently vendored in the intropage
and mactrack plugins; those plugins load the core copy on Cacti 1.2.32+ and
fall back to their bundled copy on older cores.

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

* test(security): refresh the sink inventory baseline

The tracked sink baseline had drifted against the current 1.2.x tree: many
source files changed line numbers (and a few redirect sinks) since it was last
regenerated, so the 'sink and architectural hotspot guard' failed for every PR
branched off current 1.2.x. Regenerate it with
tests/security/build_sink_inventory.sh. No new sinks are introduced by the Card
API (cards.js/cards.css are not PHP and add no tracked sinks); this is a
line-number/ordering resync of pre-existing entries.

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

* fix(ui): harden the CactiCards controller per review feedback

- dragReference: resolve the pointer row before comparing horizontal
  centres so dragging over a later card no longer snaps the insertion
  point to the start of the row
- replaceCard: re-resolve the target by card id when the captured node
  was already swapped out, so overlapping refresh/resize responses no
  longer throw on a detached node (and resize still saves layout)
- normalizeState: sync the documented data-expandable/data-expanded
  attributes with the .ccCardExpandable/.ccCardExpanded classes used for
  CSS clipping and serialize(), bridging the cards.css selector mismatch
- dragstart: only enter reorder mode when the card itself is the armed
  drag source, ignoring native drags bubbling from body links/images
- dragend: disarm card.draggable on every drag end since native DnD
  suppresses the mouseup cleanup path

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

* feature: add shared card-widget chart primitives to the Card API

Extend the Card API with a small, JS-free chart-primitive library so any plugin
- including third-party panels surfaced inside another plugin such as Intropage
- can draw rich card bodies with no plugin-specific stylesheet or JavaScript:

- include/css/card-widgets.css: the themeable .cc* primitives (semicircular
  gauge, usage/distribution bars, min/avg/max bullet, stacked proportion bar,
  stat tiles), coloured from currentColor and the shared --cc-sev-* properties.
  Loaded by the common page header alongside cards.css.
- lib/html.php: card_gauge(), card_bar(), card_bullet(), card_stackbar() and
  card_stat() render helpers (plus card_severity()) that emit exactly that
  markup. Available wherever global.php is loaded (web and poller).

These consolidate the near-identical gauge/bullet/bar/stack widgets currently
duplicated across the hmib, apcupsd and mactrack dashboards.

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

---------

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

* Fix typo in comment about DOM behaviour

* fix(ci): number and reorder CHANGELOG entries and inventory cards.js

- Move the two Card API feature entries into the 1.3.0-dev feature block and
  number them (#8683) so .github/scripts/check-changelog.py accepts them
  (security->issue->feature ordering, traceable PR number).
- Register include/js/cards.js in build/legacy-js.json applicationFiles so the
  JavaScript contracts library inventory recognises the new core script.

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

* test(cards): cover the card helper CSS and PHP for the changed-line gates

- Add Playwright coverage fixtures to develop-theme-correctness.spec.ts that
  render every selector in include/css/cards.css and include/css/card-widgets.css
  (triggering the handle/tool hover and active states), so the develop theme
  correctness changed-CSS-line gate reaches 100 percent.
- Add tests/fixtures/Core/CardWidgetMarkup.php, a changed-line coverage probe
  that loads card_severity/card_gauge/card_bar/card_stat/card_stackbar/card_bullet
  in isolation and exercises every branch; register it in run_pr_change_tests.sh.
- Assign-then-return in card_gauge/card_stat/card_bullet (matching card_bar and
  card_stackbar) so Xdebug attributes the return to a covered line; no output
  change.

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

* fix(cards): harden refresh/resize ordering, async remove, and toggle focus

Address review feedback on the CactiCards controller:

- Share a per-card-id request generation between refreshCard and resizeCard
  (startRequest/requestSuperseded) and discard a superseded response before
  replacing markup, so a slow refresh can no longer revert a newer grow/shrink.
- Await onRemoveCard: only drop the live card and persist the layout once the
  host Promise fulfils, leaving the card and saved layout intact on rejection
  (and re-resolving the node by id before removal).
- Transfer keyboard focus to the revealed counterpart when expand/collapse is
  activated from the keyboard, since cards.css hides the activated button.

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

* feature(ui): add gauge ticks, bullet avg marker and pill severities to card-widgets

Extend the shared Card API chart-widget library with .ccGaugeTick (gauge
min/max ticks), .ccBulletAvgMarker (a dashed historical-average marker on the
min/avg/max bullet) and .ccPill--up/--warn/--down/--none (status-pill severity
colours), all themed from the existing --cc-sev-* custom properties. This lets
converging plugin dashboards draw their richer card bodies from the shared .cc*
contract. Mirrors the 1.2.x change in #8684.

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

* fix(cards): skip adding a card id already on the grid

Converge the controller: a second add of the same card can resolve while the
first is still pending (the option stays selectable until the debounced
catalogue sync), so skip ids already present to avoid appending a duplicate the
server then dedupes. Brings the develop controller to the shared baseline that
the 1.2.x PR and every plugin bundle now carry.

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

* Darken Card API severity pills to meet WCAG 4.5:1 contrast

The .ccPill--up/--warn/--down fallback backgrounds rendered 11px text at
3.51:1 (warn) to below the 4.5:1 WCAG AA threshold, and .ccPill--none used
currentColor as a background that resolved to white (invisible on light
themes). Mix each severity hue 70% with black for >=4.5:1 contrast with the
white label, and give --none a translucent currentColor wash that inherits
the theme foreground. Render the severity pill variants in the theme-
correctness fixture so the changed .cc* rules satisfy the CSS-line gate.

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

* Preserve live card expand/collapse state across a Card API refresh

replaceCard() now carries the live card's current expand/collapse state onto the
fresh markup at swap time, so expanding or collapsing a card while its refresh
(or resize) response is in flight is no longer reverted. Applies to the per-card
refresh, resize and the plugins' Refresh-all paths, which all swap through
replaceCard(). Adds an e2e test that drives the controller through a refresh
landing mid-toggle, covering the changed line.

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

* Only preserve a live card toggle when the user changed it mid-refresh

Mirror the 1.2.x review fix (#8700): replaceCard() carries the live expand/
collapse state onto fresh markup only when the user toggled during the request
(live differs from the state captured when the request started) and the fresh
card is still expandable; direct callers with no captured state keep host markup
authoritative (normalizeState contract). refreshCard() passes its captured
state; resizeCard() captures it before onResize(). Adds a second e2e case
asserting refreshed markup drives expansion when the user did not toggle.

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

---------

Co-authored-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-11 11:46:03 -05:00
Thomas Vincent 62063a29e0 fix(theme): [develop] correct CSS cascade, invalid values and responsive selectors (#8293)
* fix(themes): correct CSS cascade, font fallbacks and responsive selectors

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(themes): remove validated empty and redundant CSS rules

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* style(css): remove reviewed inactive rules and redundant separators

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* style(themes): consolidate two reviewed duplicate selectors

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(themes): remove identical whitespace declaration after consolidation

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* fix(theme): keep context menu fallbacks in Cacti overrides

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(theme): measure native CSS and header coverage

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: retain bootstrap coverage and validate request dispatch

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: synchronize native coverage fixture dispatch

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: measure coverage at the exact PR revision

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test: cover Midwinter and graph heading CSS repairs in Chromium

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: take the theme coverage base from the merge commit parent

- github.event.pull_request.base.sha can predate the develop tip the checkout was merged onto, which counted develop's own CSS lines as the PR's.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 22:51:15 -04:00
TheWitness 356f4ae813 fix(graphs): tree content reveal, filter dialog columns, single-column centering (#8365)
* fix(graphs): reveal graph content area after tree branch loads

The jstree select_node handler hides .cactiGraphContentArea (#navigation_right) before loading a branch's graphs via AJAX to avoid flashing the previous branch, but the only re-show was coupled to a window resize event that does not fire after the AJAX load. On themes that hide .cactiGraphContentArea by default (e.g. Deepness) the content area stayed display:none and the graphs/filters were invisible. Re-show it on loadUrl completion.

* fix(filter): keep the Edit Filter dialog columns from collapsing

The modern filter Edit dialog is created with jQuery UI width:'auto'. Its body is a table-based label/field grid, which jQuery UI measures at min-content, collapsing the dialog content to a sliver and pushing the fields off to the right. Floor the content min-width so the columns lay out. Validated in Deepness and Dark.

* fix(graphs): centre single-column graphs in the graph view

graphWrapperOuter > div:first-child is width:fit-content inside a (full-width for one column) flex wrapper, so the graph rendered flush-left. Add auto horizontal margins so it centres; the absolutely-positioned drilldown toggle continues to track the graph.

* fix(graphs): don't re-show content area on aborted branch load

A superseding tree branch click aborts the in-flight loadUrl; its .always() must not re-show the content area the new selection just hid, or stale graphs flash while the new branch loads. Skip completions whose textStatus is 'abort'.
2026-10-14 17:16:42 -04:00
TheWitnessandTheWitness 8acc5ec916 feature: theme-aware graph drilldown action menu (per-theme CSS palette) (#8355)
Label the open graph drilldown strip (layout.js labelGraphDrilldownIcons), shorten the action titles, and restyle the strip as a table menu. Each theme's main.css declares the --cacti-dd-* custom properties (foreground, hamburger/panel backgrounds, hairline border, hover accent) that include/css/graph_drilldown.css consumes via var() with a dark fallback, so each theme gets an appropriate light or dark look with its own accent and the hamburger reads correctly on light themes. Themes without a block (e.g. midwinter) use the dark fallback. Regenerates the affected locales/po/cacti.pot entries for the shortened titles.

Co-authored-by: TheWitness <1439914+TheWitness@users.noreply.github.com>
2026-10-13 12:33:14 -04:00
TheWitnessandThomas Vincent f39e74c65c Graph drilldown: keep hamburger fixed, icons reachable, hide on graph leave (#8315)
* Graph drilldown: keep hamburger fixed, icons reachable, hide on graph leave

The action-icon strip now slides down below the hamburger (flex column) instead
of the hamburger dropping to the bottom of the icons. Closing is driven by
leaving the whole graph rather than the small icon strip, so the mouse can move
from the hamburger onto the icons without the strip closing. Leaving the graph
also blurs the hamburger so it no longer lingers after interacting with it.

* changelog: graph drilldown interaction fixes (#8315)

* Graph drilldown: tolerate tooltip-induced mouseleave, drop hamburger title

A native tooltip appearing over a drilldown icon fires a spurious mouseleave on
the graph (relatedTarget null), which closed the strip. Defer the close and
re-check the graph is genuinely not hovered first, so the icon tooltips no longer
destabilize it. Also drop the hamburger's redundant title (its aria-label stays).

* Graph drilldown: widen the close grace period to 500ms

* Graph drilldown: tie hamburger visibility to the graph image

Reveal the hamburger while the pointer is over the graph image (or the toggle
overlaid on it) rather than anywhere in the graph cell, so moving off the image
hides it after the grace period.  Entering a different graph now immediately
hides and closes any other graph's open strip.

* Graph drilldown: lift the open graph so its strip clears thumbnails below

With thumbnails a short graph's open icon strip overflows onto the graph below;
sibling graphs paint in DOM order, so that graph rendered on top of the strip,
making the icons unclickable and stealing the hover (which closed the strip).
Raise the open graph (.graphDrillActive, position:relative; z-index) so its
overflowing strip stays on top and the graph beneath is not hovered.

* Graph drilldown: reveal via :focus-visible and stop blurring to preserve keyboard focus

* fix(ui): preserve graph action focus during pointer navigation

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(ui): cover graph drilldown interactions and gate PR coverage

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* ci: measure committed PR changes on a policy-compliant runner

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Co-authored-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-12 06:29:12 -04:00
TheWitness e25a67c31f Common graph drilldown hamburger toggle across all themes (#8308)
* Graph drilldown: common hamburger toggle across all themes

The graph action icons were revealed by hovering to the right of the graph, implemented per-theme (dark/midwinter/sunrise main.js) and always-on elsewhere.

Hide the icons by default behind a small fa-bars hamburger overlaid on the graph's top-right. Clicking it opens the icon strip, which stays until a second click, leaving the strip, or an outside click. The behaviour is now centralized in include/layout.js (initGraphDrilldown) and include/css/graph_drilldown.css, and the per-theme hover JS is removed.

* changelog: 8308 feature fragment

* Graph drilldown: address review (a11y, positioning, spikekill, POT)

- Anchor the toggle to the shrink-wrapped graph holder (width:fit-content) so the hamburger sits on the graph's top-right, not the full-width column edge.

- Keep the hamburger focusable while visually hidden (opacity instead of display:none); reveal on hover, keyboard focus, open, and hover-less devices.

- Expose aria-expanded on the toggle and update it in every open/close path; add aria-haspopup/aria-label.

- Close any open SpikeKill submenu (spikeKillClose) when the strip closes or switches, matching the removed per-theme handlers.

- Remove the now-duplicate Midwinter top-right ellipsis pseudo-element.

- Add the new 'Graph Actions' msgid to locales/po/cacti.pot.
2026-10-11 17:20:06 -04:00
Browniebraun d703edb6e6 Latest State of MidWinter Refactoring (#7043)
* support dynamic resizable rrdgraph

* introducing the newest version of navigationBox including plugin support. This allows reusable navigation Boxes e.g. different trees and so on.
2026-04-13 19:31:05 +02:00
Mark B d6ed3002ef Fix for CVE-2026-1513 (#6585) 2026-01-30 10:32:39 -05:00
TheWitness 08a84f7e7e QA: Add missing jquery.contextMenu.css file 2025-12-19 12:10:00 -05:00
MSS 3a734bf3ed billboard.js and billboard.css to be updated to version 3.14.3 #6165 (#6166)
* Update billboard.css to version 3.14.3

Update billboard.css to version 3.14.3

* Update billboard.js to version 3.14.3

Update billboard.js to version 3.14.3

* Update CHANGELOG

billboard.js and billboard.css to be updated to version 3.14.3 #6165
2025-03-07 06:23:04 -05:00
TheWitness 1d61fb23e6 QA: Move billboard.css to a common css file. 2024-11-26 11:30:19 -05:00
Mark Brugnoli-Vinten 545a786483 Update styling locations for themes 2023-01-08 22:07:10 +00:00