Add search/filter bar to large ListChoice checkbox lists

Checkmk's native checkbox-list widget renders one row per item with no
grouping or pagination, making rules like "Deploy custom files with
agent" hard to work with when only a few items need to be checked
among hundreds. Adds a search box, a live selected-count, and a
"Selected only" toggle above any such list with 15+ items.
This commit is contained in:
Luigi D'Acunto 2026-07-30 13:07:12 +02:00
parent 45d6187150
commit 69e872569c
3 changed files with 133 additions and 1 deletions

View file

@ -29,6 +29,7 @@ A [Tampermonkey](https://www.tampermonkey.net/) userscript that enhances the Che
| **Auto-check Foreign Changes** | Automatically ticks the "Activate foreign changes" checkbox on the pending changes page | `tryAutoCheckForeignActivation` |
| **Collapse All / Expand All** | Adds two buttons to the menu bar to collapse or expand all accordion sections at once | `addAccordionToggleButtons` |
| **Site Status Filters** | Adds Disabled / Online / Timeout / Not running toggle buttons below "Add connection" to quickly filter the site connections list | `addSitesFilterBar` |
| **ListChoice Filter Bar** | Adds a search box, a "N / total selected" counter and a "Selected only" toggle above large checkbox lists (e.g. "Deploy custom files with agent") | `addListChoiceFilter` |
---
@ -148,6 +149,13 @@ Only one filter can be active at a time — clicking the active button turns it
Applies to: `wato.py?mode=sites` (with or without sidebar).
---
### ListChoice Filter Bar
Checkmk's native checkbox-list widget (used by rules like "Deploy custom files with agent") renders one row per item with no grouping or pagination — some lists have 100+ entries even though a rule typically only needs 3-4 checked. Adds a search box, a live "N / total selected" counter, and a "Selected only" toggle above any such list with 15+ items. Purely visual — checkbox state and the Save button are unaffected.
Applies to: any WATO rule editor page containing a large checkbox-list value (with or without sidebar).
## How it works
The script injects enhancements at page load and re-applies them on SPA navigation (Checkmk reloads content inside an `<iframe>` without a full page reload). Each feature is independent — a feature that does not apply to the current page does nothing and stops polling.