Skip to content

Monitor: Rows filter, servcheck status, Tiles sizing, device-detail panels, dashboard properties & grouping cards - #272

Merged
TheWitness merged 6 commits into
developfrom
feature/servcheck-hover-rows-and-tiles
Oct 10, 2026
Merged

TheWitness merged 6 commits into
developfrom
feature/servcheck-hover-rows-and-tiles

Conversation

@TheWitness

@TheWitness TheWitness commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR extends the Monitor dashboard across several areas. Each feature is realm/permission-gated and schema-aware where it integrates with other plugins.

1. Rows filter → List view only

Pagination (the Rows/Devices count) now applies only to the List view; all other views show every matching device, and the Rows dropdown is hidden on non-list pages (with a hidden fallback input so the saved value survives a view switch).

2. plugin_servcheck integration + distinct status

  • Hover tooltip now detects a triggered/failing service check on a device (matched by hostname/ipaddress, schema-aware across servcheck v0.3 lastcheck/failures and v0.4 last_check/last_result), promoting an otherwise-Up device and adding a glyph linking to the failing check. Realm-gated behind servcheck_test.php.
  • A distinct Service Check Failed device status (code 10) with its own legend chip, tile/list colour and status-filter coverage, driven by a realm-gated checkServchecks() host set (mirrors checkTholds()).

3. Tiles & Time sizing

*_tilesadt tiles use min-height + box-sizing: border-box so a tile's bounding box grows to contain the glyph, hostname and uptime instead of overflowing neighbours.

4. List-view Actions column + device detail dialog

A non-sortable Actions column (first column) opens a modal of intropage-style cards for one device:

  • Host Information (description, hostname, status pill, site, device template, location, SNMP uptime/contact)
  • Data Collection timing (availability method, ping min/avg/cur/max, availability %, total/failed polls, last fail)
  • Service Checks (servcheck, realm-gated, schema-aware; Not-tested/OK/Failing/Disabled states)
  • Thresholds (thold, gated behind the thold_graph.php realm)
  • Syslog (last hour, realm-gated, loads syslog's own DB connection)
  • Device Links (edit device, view graphs, "Open Actual Device" with bracketed IPv6)

Security scope: the ajax_hostpanel and ajax_status endpoints enforce is_device_allowed(), so a user cannot pull details for a device omitted from their board. Each plugin card is additionally gated behind that plugin's realm.

5. Dashboard restructure

plugin_monitor_dashboards now stores filter state as a JSON properties column instead of a raw url. The upgrade migrates each legacy url into the properties structure and drops the url column. Dashboards are loaded/applied from the structure; URLs are constructed client-side from the restored filter vars.

6. Grouping card panels

The Site and Device Template groupings render as a responsive full-width grid of card panels (up to ~8 columns, shrinking on narrower screens). Each title is coloured by the group's worst device status. Cards are draggable; the order is persisted in the dashboard's properties.cardorder (or the per-user monitor_cardorder setting) and reapplied on render.

Testing

  • php -l clean across all changed PHP.
  • Pest unit tests added for the servcheck helpers (getHostTriggeredServchecks, checkServchecks), the status-filter wiring, and the dashboard url→properties migration; harness-validated the panel cards, grouping colorization/ordering, schema-aware states, and IPv6 link bracketing.
  • locales/po/cacti.pot regenerated for the new strings.
  • CI (CodeQL + PHP 8.2/8.3/8.4 integration incl. 100% changed-line coverage gate) green.

… Time tile box

Rows filter now only paginates/shows on the List view; non-list views show all devices. Add plugin_servcheck hover status + glyph alongside thold/syslog. Fix Tiles & Time tiles overflowing their bounding box via min-height.
@TheWitness
TheWitness requested review from bmfmancini and xmacan and a balanced review from Copilot October 10, 2026 21:43

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 servcheck query is incompatible with the latest release and status promotion bypasses its authorization realm.

4 open findings
What changed in this PR

Updates dashboard pagination, adds servcheck hover integration, and fixes Tiles & Time overflow.

Changes:

  • Restricts pagination controls to List view.
  • Adds failing servcheck status and history links.
  • Allows Tiles & Time boxes to expand with content.
File Description
includes/​render.php Limits pagination to List view.
includes/​functions.php Queries failing service checks.
includes/​controller.php Updates filters and servcheck hover UI.
css/​monitor.css Replaces fixed tile heights with minimum heights.
CHANGELOG.md Documents the changes.

🧠 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 includes/functions.php Outdated
Comment thread includes/controller.php Outdated
Comment thread includes/controller.php
Comment thread includes/functions.php
- getHostTriggeredServchecks adapts to servcheck v0.3 (lastcheck/failures) and v0.4 (last_check/last_result) schemas and guards a missing table

- Gate the hover status promotion behind the servcheck_test.php realm, matching the glyph link

- Regenerate locales/po/cacti.pot for 'View Failing Service Check'

- Add unit coverage for the servcheck helper (disabled/empty/missing-table exits, bound params, v0.3 & v0.4 predicates)
… panels

- Add status 10 (Service Check Failed) with legend chip, tile/list colour and status-filter coverage via a realm-gated, schema-aware checkServchecks() host set

- Add a non-sortable Actions column to the List view opening a modal of intropage-style cards: host info, data collection timing, service checks, thresholds, last-hour syslog, and device links

- Regenerate cacti.pot; add unit coverage for checkServchecks() and the servcheck status filter

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.

Comment thread includes/controller.php Outdated
Comment thread includes/controller.php Outdated
Comment thread includes/controller.php Outdated
Comment thread includes/controller.php Outdated
Comment thread includes/render.php
…anels

- Restructure plugin_monitor_dashboards to a JSON properties column; migrate the legacy url into it and drop the url column on upgrade; load/save dashboards via the structure

- Render Site and Device Template groupings as a responsive grid of draggable card panels, titles coloured by each group's worst device status, with per-dashboard/per-user persisted ordering

- Add unit coverage for the url->properties migration and db stubs
…, thold realm

- Enforce is_device_allowed() on ajax_hostpanel and ajax_status so a user cannot pull details for a device off their board

- Gate the Thresholds card behind thold's thold_graph.php realm

- Select the schema-specific servcheck check time (lastcheck/last_check) and use it so never-run v0.3 checks report Not tested

- Bracket IPv6 literals in the Open Actual Device link

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 host-panel endpoint bypasses device authorization, and persistence and display defects remain.

6 open findings
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Incorrect uptime field casing omits SNMP uptime

includes/​controller.php:1446

The Cacti host field is snmp_sysUpTimeInstance (capital T in UpTime), and PHP array keys are case-sensitive. The current key therefore never exists on the fetched host row, so the new Host Information panel always omits SNMP uptime.

🧠 Review effort: Balanced

Comment thread includes/controller.php
Comment thread CHANGELOG.md
Comment thread includes/controller.php Outdated
@TheWitness TheWitness changed the title Monitor: list-only Rows filter, servcheck hover integration, Tiles & Time box fix Monitor: Rows filter, servcheck status, Tiles sizing, device-detail panels, dashboard properties & grouping cards Oct 10, 2026
- Save/read grouping card order via the dashboard only when the user owns it; shared/read-only dashboards and no-dashboard fall back to the per-user monitor_cardorder setting so reorders persist

- Read the posted order through get_nfilter_request_var() instead of \ directly

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.

🔵 Needs a closer look

Filter persistence, service-check state rendering, SNMP uptime display, storage capacity, and keyboard accessibility remain unresolved.

0 open findings

6 resolved since last review
Previously missed (5)

In code that hasn't changed since last review

Medium severity Persist template and rfilter dashboard properties

includes/​controller.php:932

The properties payload omits the active template and rfilter values even though both are posted by saveFilter()/saveNewDashboard(). A dashboard saved for one device template or search therefore reloads without that filter (and can retain the prior session value instead), so these filter variables need to be persisted with the rest.

Medium severity Use correct snmp_sysUpTimeInstance key

includes/​controller.php:1471

This uses snmp_sysUptimeInstance, but the host row exposes Cacti's snmp_sysUpTimeInstance key (as used by the existing tooltip and poller code). Because PHP array keys are case-sensitive, the condition is always false and the promised SNMP Uptime row never renders.

Medium severity Treat v0.3 failures as failing when not triggered

includes/​controller.php:1555

On the v0.3 schema, $has_result is false and this condition only checks triggered, so a test with failures > 0 but not yet triggered is displayed as OK. The v0.3 predicates in getHostTriggeredServchecks() and checkServchecks() classify that same state as failing; include failures > 0 when last_result is unavailable so the panel agrees with the device status.

Medium severity Prevent card order properties column overflow

includes/​database.php:101

cardorder contains every site/template group ID and both grouping arrays can accumulate in one JSON document, but varchar(4096) imposes a small fixed ceiling. With a few hundred groups the update in saveCardOrder() exceeds this column and order persistence fails or truncates the properties, including saved filters. Use a text-capable column consistently in both the table definition and migration add-column call.

Medium severity Make ordering controls keyboard accessible

js/​monitor.js:366

The new ordering interaction is only exposed through jQuery UI Sortable with an <i> drag handle, which is neither focusable nor keyboard-operable. Keyboard-only users cannot perform the same reorder action. Add semantic focusable controls and keyboard move behavior (with an announced position change), while retaining drag-and-drop as the pointer interaction.

🧠 Review effort: Balanced

@TheWitness
TheWitness merged commit 11c7e46 into develop Oct 10, 2026
6 checks passed
@TheWitness
TheWitness deleted the feature/servcheck-hover-rows-and-tiles branch October 10, 2026 23:13
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