Repository navigation
fix: dashboard fixes (Status column, Refresh without reload, RRD matching, Fleet Power range) and a Run Graph Automation action - #56
Merged
Conversation
… without a page reload
- Centre the Status header and pills in the UPSes card; the rule has to
outrank .apcupsdDashTable th/td { text-align: left }.
- Changing the Refresh dropdown no longer forces a full page reload. The
preference is saved, then the running timer is swapped for the new
interval (or stopped for No Refresh) in place. Both grids expose their
refresh URL as data-refresh-page so this also works when the page was
loaded with refresh off. A failed save reverts the dropdown and shows
the error on the status line.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Refresh changes can misapply overlapping saves, leave the visible picker stale after failure, and disable browser auto-logout.
3 open findings
What changed in this PR
Improves Fleet Dashboard alignment and lets both dashboards change refresh intervals without reloading.
Changes:
- Centres Status headers and pills.
- Applies refresh intervals in place, with save-failure handling.
- Updates regression checks and the changelog.
| File | Description |
|---|---|
| tests/Unit/EstimatedWattsTest.php | Checks Status alignment markup and CSS. |
| tests/Unit/DashboardRefreshTest.php | Checks refresh URLs and timer-update code. |
| js/apcupsd_dashboard.js | Updates timers and handles preference-save responses. |
| includes/dashboard.php | Adds refresh URLs and column alignment classes. |
| css/apcupsd.css | Centres Status cells and headers. |
| CHANGELOG.md | Documents both dashboard changes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…et and gauge text - Match the Device Package's real data source names (batt_volts, line_volts, output_volts, batt_charge) so Battery, Line and Output Voltage find an RRD. - Read the profile's consolidation functions first and, without a MIN or MAX archive (many RRDs have no MIN), bound the window by its averages instead of leaving the lower bound blank. One shared apcupsd_dashboard_rrd_stats() now serves the UPS bullets, UPS gauges and the fleet aggregates. - Bullets label the track ends with the axis (0 .. scale) and list the known now/min/avg/max readings; unknown ones are left out instead of N/A. Gauge captions do the same. - Fleet Power gets min/max ticks and a min/avg/max caption from each UPS's load RRD scaled by its constant nominal power; UPSes without history count at their latest estimate so the range matches the total shown. - Debug log lines say why a reading has no RRD history. - NutWiringTest requires nut.php itself instead of relying on test order. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a bulk action that runs Cacti's graph automation (the same as the Devices page's Apply Automation Rules) for the Cacti Device linked to each selected UPS, so a device that never got its graphs, and so has no RRD history for the dashboards, can be given them without leaving the plugin. - Offered only to users with the Sites/Devices/Data realm (core's realm for the equivalent device action) and refused server side otherwise. - Skips and reports a UPS that has no Cacti Device yet; the device id is looked up from the UPS id with a prepared query. - Documented in the README and CHANGELOG, with translatable strings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Turning Refresh off now puts Cacti's browser auto-logout timer back. The original settings are remembered when the script loads, before the dashboard overrides them, and restored (and re-armed) for No Refresh; a page reload used to do this. - A failed save rolls the dropdown back through its Select2 / selectmenu widget (a namespaced trigger, so the save handler does not run again). - Saves are serialized: one in flight, a choice made meanwhile is sent when it settles, and only a value that was actually saved updates the timer and the rollback state. - Print the dashboard script before the script that starts the refresh, so its functions exist when Cacti runs ajax-loaded scripts in order; before, the first ajax visit fell back to the full-page timer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bmfmancini
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Dashboard fixes found while reviewing the UPS and Fleet dashboards.
.apcupsdDashTable th, .apcupsdDashTable td { text-align: left }.refreshFunctionpath and the Cacti 1.2.x own-timer path. A failed save reverts the dropdown and shows the error. Both grids expose their refresh URL asdata-refresh-page.batt_volts/line_volts/output_volts/batt_chargeunder other names, so Battery, Line and Output Voltage never found an RRD even with graphs present. The RRD profile's consolidation functions are now read first; when an RRD has no MIN or MAX archive the window is bounded by its averages instead of leaving a bound blank. One sharedapcupsd_dashboard_rrd_stats()serves the UPS bullets, UPS gauges and the fleet aggregates.APCUPSD, debug verbosity) say why a reading has no RRD history.NutWiringTestrequiresnut.phpitself instead of depending on test order.Note
Min/avg/max come from the device's RRD files and the current value from the database. A device with no graphs has no RRD files, so it has no history to show (the readings then show just the current value). That turned out to be the cause of the blank bounds that prompted part of this work; the data source name matching and the no-MIN fallback are real fixes for devices that do have graphs.
Testing
DashboardRrdStatsTest(data source matching against the package's real names, series and stats including no-MIN and no-MAX archives, fleet power range, bullet and gauge text), plus updatedEstimatedWattsTestandDashboardRefreshTest.check-i18n-potandvalidate-manifestpass.