Skip to content

Add standard Cacti search filter to the Maintenance Schedules list - #69

Merged
TheWitness merged 4 commits into
developfrom
feature/schedules-search-filter
Sep 29, 2026
Merged

TheWitness merged 4 commits into
developfrom
feature/schedules-search-filter

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Summary

The main Maintenance Schedules table (the General tab) was the only list in the plugin without a search filter. This adds a standard Cacti search filter modeled on cdef.php from 1.2.x: a Search box, a rows-per-page selector, Go/Clear buttons, pagination, and sortable columns.

Searching hostnames and descriptions

A schedule row itself only carries a name, so to make the search useful it also matches the hostname/description of the devices a schedule covers:

  • Thold devices — core host table (hostname, description)
  • Servcheck tests — plugin_servcheck_test (hostname, display_name)

Both are joined through plugin_maint_hosts, and each source is only queried when its plugin is enabled (api_plugin_is_enabled('thold') / api_plugin_is_enabled('servcheck')), so nothing breaks when those plugins are absent. Webseer was intentionally left out — it has no hostname/description columns. All queries use prepared statements, matching the rest of the file.

Scope

  • Only schedules() (the General tab) is touched. The Thold/WebSeer/Servcheck sub-tabs already had their own filters and are unchanged.
  • Filter state is stored under a dedicated session key (sess_maint_schedules) so it doesn't collide with the device tab's sess_maint.

Notes

  • Regenerated locales/po/cacti.pot via locales/build_gettext.sh for the two genuinely new strings (Schedules, The name of this Maintenance Schedule.); the remaining pot churn is deterministic string-order output from that script. Translation .po files were left to Weblate.
  • php -l clean.

The main Maintenance Schedules table (the General tab) was the only list
in the plugin without a search filter. Add a simple cdef.php-style filter
(Search box, rows selector, Go/Clear, pagination and sortable columns).

Because a schedule row itself only carries a name, the search also matches
the hostname/description of any Thold device (core host table) or Servcheck
test (plugin_servcheck_test) the schedule covers, joined through
plugin_maint_hosts. Each association source is only queried when its plugin
is enabled.

Regenerated locales/po/cacti.pot for the two new strings.
Copilot AI balanced review requested due to automatic review settings September 29, 2026 04:46

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.

Copilot review overview

🟡 Changes recommended

The search value must be URL-encoded to preserve names containing URL-special characters.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds standard filtering, pagination, and sorting to the General maintenance schedule list.

Changes:

  • Adds schedule and associated-device search.
  • Adds row selection, pagination, and sortable columns.
  • Updates translations and changelog.
File Description
maint.php Implements filtering and list navigation.
locales/​po/​cacti.pot Adds new translatable strings.
CHANGELOG.md Documents the feature.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread maint.php Resolved
@TheWitness
TheWitness merged commit f73d5aa into develop Sep 29, 2026
3 checks passed
@TheWitness
TheWitness deleted the feature/schedules-search-filter branch October 20, 2026 17:33
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