v2.15.2 - Fix: menu WATO assente su view.py senza sidebar quando non ci sono pending changes

hasWatoAccess ora cerca qualsiasi link wato.py nel documento, non solo
mode=changelog. I link mode=inventory iniettati dalla colonna Extra
garantiscono la detection anche con pending changes vuoti.
README: aggiunta tabella panoramica feature con nomi, descrizioni e funzioni.
This commit is contained in:
Luigi D'Acunto 2026-07-01 19:12:59 +02:00
parent 4ed487ceab
commit 3ce0287433
2 changed files with 19 additions and 4 deletions

View file

@ -15,6 +15,21 @@ A [Tampermonkey](https://www.tampermonkey.net/) userscript that enhances the Che
## Features ## Features
| Feature | Description | Code function |
|---------|-------------|---------------|
| **Folder Path Search** | Replaces the folder dropdown with a searchable overlay — type any path segment to filter instantly | `initSelect2Enhanced` |
| **Accordion Badge Counts** | Shows inline counters in each accordion header: enabled checkboxes (orange), inherited values (blue), differing values vs folder default (red) | `initAccordionCheckedCounts` |
| **Ineffective Rule Highlight** | Replaces the hard-to-spot hyphen icon on ineffective rules with a visible ⚠ badge and amber row border | `highlightIneffectiveRules` |
| **Rule Match Status** | Colors each rule row green (match) or dimmed (no match) when a ruleset is opened with host/service context | `highlightRuleMatchStatus` |
| **Relevant Only Filter** | Adds a "Relevant only" toggle above the rule list to hide all non-matching and non-highlighted rows | `addRulesetFilterToggle` |
| **Extra Column — Host Actions** | Inserts an Extra column in monitoring tables with per-host buttons: Service Discovery, copy FQDN, copy short hostname, copy IP | `addInventoryButtons` |
| **Monitor Button in WATO Folder** | Adds a green eye icon next to each active host in WATO folder listings to open its monitoring view in a new tab | `addWatoFolderMonitorButtons` |
| **Configure in WATO Menu** | Adds a host-selector dropdown and Open button to the monitoring view menu bar for bulk-opening hosts in WATO | `addViewWatoMenu` |
| **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` |
---
### Folder Path Search ### Folder Path Search
Replaces the default WATO folder dropdown with a searchable overlay. Type any segment of the folder path to filter — separators `>`, ``, and `/` are treated as equivalent. Replaces the default WATO folder dropdown with a searchable overlay. Type any segment of the folder path to filter — separators `>`, ``, and `/` are treated as equivalent.

View file

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Checkmk SwissKnife // @name Checkmk SwissKnife
// @namespace https://luigidacunto.com/ // @namespace https://luigidacunto.com/
// @version 2.15.1 // @version 2.15.2
// @checkmk 2.3.x // @checkmk 2.3.x
// @description Collection of UI improvements for Checkmk WATO. Each fix or enhancement is added here as an independent feature. // @description Collection of UI improvements for Checkmk WATO. Each fix or enhancement is added here as an independent feature.
// @author Luigi D'Acunto // @author Luigi D'Acunto
@ -1052,11 +1052,11 @@
const WATO_PAGE_SIZE = 50; const WATO_PAGE_SIZE = 50;
// True if the current user has WATO access (admin/configuration role). // True if the current user has WATO access (admin/configuration role).
// With sidebar: the outer document has a wato.py link in the Setup navigation. // With sidebar: outer document has wato.py links in Setup nav.
// Without sidebar: the "pending changes" shortcut only appears for WATO admins. // Without sidebar: any wato.py link in the page suffices (incl. injected Extra column buttons).
function hasWatoAccess(doc) { function hasWatoAccess(doc) {
if (document !== doc && document.querySelector('a[href*="wato.py"]')) return true; if (document !== doc && document.querySelector('a[href*="wato.py"]')) return true;
if (doc.querySelector('a[href*="wato.py"][href*="mode=changelog"]')) return true; if (doc.querySelector('a[href*="wato.py"]')) return true;
return false; return false;
} }