The status pills were being clipped to a fixed width because the single-class theme rules (e.g. .deviceUpFull width:14%, padding:3px) outranked the equal-specificity .thold-pill shape rule, so long labels such as 'Not Monitored' overflowed the coloured pill on the Device Status page. Element-qualify the selector (span.thold-pill) so the shape rule wins and the pill hugs its label in every theme.
Also make a second click on an already-selected status pill clear that filter (reset the Status select to All, value -1) instead of re-applying the same value. Applied to all three thold_graph.php sub-tabs (Thresholds, Device Status, Threshold Log) and the matching Thresholds console page (thold.php).
* Add clickable status pills + zebra rows to Device Status and Threshold Log pages
Mirror the Thresholds-page pill treatment on the two remaining thold_graph.php sub-views: the Device Status (hoststat) list now renders each device's status as a clickable pill and zebra-stripes its rows instead of colouring the whole row, and the Threshold Log gains a clickable Status pill column right after Type (rows zebra-striped). Clicking a pill sets the page's Status filter and auto-applies. Regenerated cacti.pot for the new Log Status header.
* Make Device Status pill filters match displayed states
Address review feedback on PR #853: the clicked status pills did not consistently filter to the state shown on the device row.
- Map the Error pill to an exact Error filter (host_status=4) instead of the aggregate Not Up (-4), and add an Error option to the Status dropdown.
- Rework the host_status WHERE clause so each state reuses the same failure-count override classification as thold_device_status_pill(): the override now uses >= (matching the pill, was >) and only reclassifies hosts to Down, so the Down filter includes overridden hosts and the Up/Unknown/Error filters exclude them.
* thold: status pills with sortable/clickable Status column and zebra rows
Replace the whole-row status colour on the Thresholds (thold.php) and Device Status (thold_graph.php) pages with a rounded status pill in a new Status column right of Name; rows now fall back to zebra striping. The column is server-side sortable by severity via a new thold_severity_sql() CASE (a faithful SQL mirror of get_thold_severity(), legend-order rank 1=Alert..7=Disabled), the Status filter gains the seven per-severity options (values 101-107 handled in thold_get_state_filter()), and clicking a pill sets that filter and reloads. Pill shape lives in a theme-agnostic css/pills.css; all colours stay theme-aware (reusing each theme's .thold<State> backgrounds, with light pill text added to the saturated classic/modern/paw themes). Adds Pest coverage for thold_severity_sql() and the severity filter branch.
* thold: regenerate cacti.pot for the status-pill i18n strings
* thold: address review - pill contrast, time_warning_low '0' parity, keyboard a11y, stronger test
Light themes (classic/modern/paw all have white/snow backgrounds) now use dark pill text instead of white, which failed 4.5:1 at 11px. thold_severity_sql() treats time_warning_low '0' as falsy (NOT IN ('','0')) to match get_thold_severity(), so the pill never disagrees with sort/filter. Pills are now focusable role=button spans with Enter/Space activation on both pages. TholdSeveritySqlTest now executes the CASE over an in-memory SQLite row and asserts the SQL rank equals get_thold_severity() across branch/boundary scenarios incl. the '0' case.
* Pin status legends to the bottom of the page (match MacTrack)
Wrap the thold, host and log legend renders in the same fixed-position footer container MacTrack uses, so the legend stays pinned to the bottom of the viewport instead of scrolling away with the list.
* Use a CSS class for the legend footer instead of inline styles
Replace the inline fixed-position wrapper around the status legend with a
plugin-specific *LegendFooter class defined in the plugin's stylesheet. The
class lays the legend out as a centered footer in normal document flow, so it
no longer sits outside flow and overlay the final rows, pagination, or action
controls at the bottom of the page.
---------
Co-authored-by: TheWitness <1439914+TheWitness@users.noreply.github.com>
* security: move filter inline onChange/onClick handlers into ready() for CSP
The threshold, notification list, notification queue, template and
device/log status filter forms still carried inline onChange/onClick
attributes on their selects and Clear/Go/Import/Export controls. Under
Cacti's Content-Security-Policy these trip the script-src-attr directive
(inline event handlers). Bind them in each view's existing
$(function(){...}) ready block instead.
Scope: thold.php, notify_queue.php, thold_templates.php, notify_lists.php,
thold_graph.php (all gate-allowlisted UI files; no measured source changed).
The cactiReturnTo() cancel buttons on the bulk-action confirmation pages are
left as-is (shared Cacti-core pattern). Regenerated locales/po/cacti.pot for
the shifted source line references.
* security: convert cactiReturnTo cancel buttons to the CSP-safe class
The confirmation pages' Cancel buttons used an inline
onClick='cactiReturnTo()' handler, which trips Cacti's Content-Security-Policy
script-src-attr directive. Switch them to the CSP-safe cactiReturnTo CSS
class (class='cactiReturnTo', plus an optional data-url when a target is
passed).
Cacti 1.2.31 and later bind this class automatically. The README documents a
one-time include/layout.js applySkin() snippet for operators still on an
earlier release - no shim is baked into the core or the plugin.
* fix: give Thresholds/Devices filter Clear buttons the id the ready() handler binds
The hosts() and tholds() filter views used name='clear' on the Clear button, but the ready() handler binds to #clear, so Clear was a no-op on those two views. Switch them to id='clear' to match the other views and the handler.
---------
Co-authored-by: TheWitness <larry@thewitness.org>
* INFO: set compat to 1.2.32
* docs: update Copilot instructions Cacti baseline to 1.2.32 (matches INFO compat)
* INFO: back off compat to 1.2.29
* Add manifest.json + upgrade-time file pruning
* Prune phpunit.xml on upgrade and ignore markdown-lint configs
phpunit.xml ships in the repo for CI but is a dev-only test artifact, so it
is removed from manifest.json 'expected', pruned from installs on upgrade
(like tests/), and excluded from the manifest drift check.
The retired markdown-lint configs (.mdlrc, .md_style.rb) are deleted, and
.md* is now ignored like .git*: protected from pruning and excluded from
drift if it reappears.
* Move thold_functions.php and thold_webapi.php into includes/; flatten css
The main threshold library becomes includes/functions.php and the web API
helper becomes includes/webapi.php; every caller (setup.php, includes/*, the
CLI/poller/notify entry points and the test suite) loads them from includes/.
Each per-theme stylesheet css/<theme>/main.css becomes css/<theme>.css so users
can drop their own css/<theme>.css into the css base, and the page_head hook
looks there. Old paths are tombstoned so existing installs drop the stale
copies on upgrade.
* Regenerate cacti.pot for the includes/ file relocations
Moving the plugin's library files into includes/ changed the source-reference
lines in the translation template; regenerate it so the 'Verify translation
template' CI check passes.
* Harden the hook-include test and make RPN integer ops explicit
The HookFunctionsIncludeTest invokes real hooks with placeholder input purely
to execute their relocated include_once lines; it now swallows engine
notices/warnings/deprecations during those calls (and restores the error
handler and config afterward) so it cannot trip the suite's failOnDeprecation
or leak state into other tests. The RPN % and ^ operators now cast their
operands to int explicitly, matching their long-standing integer-truncation
behaviour while silencing the implicit float-to-int conversion deprecation.
* Harden prune against tampered-manifest path traversal
The upgrade-time prune now rejects any tombstone containing '.'/'..' segments
(which could escape the plugin directory or resolve to its root) and treats
ancestors of whitelist entries as protected, so a tombstone on a parent
directory can no longer delete a whitelisted file beneath it.
* docs: update and align the Project Structure block
Point the structure tree at the relocated files (libraries now under
includes/, data files under docs/, stylesheets under css/) and align the
trailing '# ...' comments to a single column so they no longer drift right.
* docs/tests: standardize test header and correct manifest-contract notes
- Use the full license header (from the plugin's own setup.php) in
tests/Unit/PruneFilesTest.php instead of the abbreviated copyright banner.
- Document that the manifest drift check and the upgrade-time prune also
handle phpunit.xml and .md* files, matching the implemented behavior.
* refactor: rename prune helpers to the plugin-slug function prefix
The repository naming contract reserves the plugin_<name>_ prefix for plugin
lifecycle / hook-registration functions; all other functions use the plain
<name>_ prefix. Rename the internal upgrade helpers accordingly:
plugin_<name>_prune_files() -> <name>_prune_files()
plugin_<name>_rmtree() -> <name>_rmtree()
The call site, unit tests, and the copilot-instructions.md references are
updated to match. No behavioral change.
* chore: set the Cacti compatibility floor to 1.2.29
Align the compat metadata (and the contributor-guide references) with the
team decision to standardize the minimum supported Cacti version at 1.2.29;
the previously proposed 1.2.32 floor was not adopted.
---------
Co-authored-by: Copilot <copilot@users.noreply.github.com>
The monitored branch renders the Status column with 'center' alignment, but the not-monitored branch passed 'right' to form_selectable_cell(), so 'Not Monitored' appeared right-aligned. Use 'center' to match.
* Add PHPDoc blocks: small files batch (cli_import, poller_thold, includes/tab, includes/database, cli_thresholds, thold_notify, notify_queue)
* Add PHPDoc blocks: includes/polling.php, includes/settings.php (WIP checkpoint)
* Add PHPDoc blocks: thold_process.php, thold_daemon.php (WIP checkpoint)
* Add PHPDoc blocks: thold_webapi.php (WIP checkpoint)
* Add PHPDoc blocks: thold.php (WIP checkpoint)
* Add PHPDoc blocks: thold_graph.php (WIP checkpoint)
* Add PHPDoc blocks: notify_lists.php (WIP checkpoint)
* Add PHPDoc blocks: thold_templates.php (WIP checkpoint)
* Add PHPDoc blocks: setup.php batch 1-2 (WIP checkpoint)
* Add PHPDoc blocks: setup.php batch 3-4 (WIP checkpoint)
* Add PHPDoc blocks: setup.php batch 5 (WIP checkpoint)
* Add PHPDoc blocks: setup.php batch 6-7 (WIP checkpoint)
* Add PHPDoc blocks: setup.php complete
* Address review feedback and refresh translation template
- Fix thold_update_host_status() return type (int|null, since it
falls through with no explicit return in the normal case)
- Fix @global $device_change_fields description in
thold_config_arrays() (appends this plugin's fields, not unused)
- Fix @global $config description in thold_graph_button() (used to
build the Create Threshold link's URL)
- Fix thold_data_source_action_prepare()/thold_graphs_action_prepare()
return types (array|void; only the non-plugin_thold_create branch
returns $save)
- Fix @global $timearray description in list_tholds() (used to render
each baseline threshold's reference time range)
- Fix @global $thold_types description in thold_show_log() (used to
render each log row's type column)
- Regenerate locales/po/cacti.pot (source line references only)
- Fix .gitignore pattern for compiled .mo files (locales/LC_MESSAGES/, not locales/po/)
* test(coverage): allowlist untestable entry points touched by PHPDoc pass
This PR only adds PHPDoc blocks (no functional changes), but touching every file in the plugin newly triggers the 'Enforce coverage of changed lines' CI gate for files that were never require()'d by any test before now:
- cli_import.php, cli_thresholds.php: CLI entry points (include cli_check.php / chdir + execute at the top level).
- poller_thold.php: poller entry point, same category.
- thold.php, thold_graph.php, thold_templates.php, notify_lists.php: authenticated web entry points (chdir + include(auth.php) at the top level), like notify_queue.php/thold_notify.php already allowlisted above.
- thold_daemon.php: daemon entry point, same category as thold_process.php already allowlisted above.
- includes/settings.php, includes/tab.php: Settings-page/header-tab-bar hook callbacks, only meaningful inside a live Cacti page render.
- thold_webapi.php: web-page action handlers that read \ and the database directly.
None of these can be require()'d into the isolated unit test process, matching the existing allowlist entries' precedent exactly. Verified locally: running patch-coverage.php against the PR's actual base ref confirms all 11 files are no longer reported as unexpected-unmeasured.
* docs: add PHPDoc blocks to remaining thold_functions.php functions
* chore: refresh translation template after PHPDoc line-number shifts
* Having to add a new log class as the warning behavior was ambiguous for both Time Based and High/Low based.
* Thresholds should be at or above or at or below not above or below.
For Thold edit, added to save the threshold level enabled setting thold_per_enabled.
Added additional details for debugging.
On Thold tab, Thresholds sub tab list, excluded disabled devices (link got permission denied).
* feature: Mass Enable/Disable at Template Level
* feature: Make Enabling and Disabling a Thold Different than Enabling or Disabling a Template
* QA: Cleanup some of the state calculation logic to make similar between pages.
* feature: Allow quick links to the Threshold Template when editing a Thold
* feature#185: Baseline deviation with exact changes
* issue#586: Attempting to edit a non-existing thold template results in plugin being disabled
* issue#498: Return button in Thold templates is broken
* issue#499: In Thold Tab->Device status-> ID of device reported simply as 1K if number is above 1023