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

@ -1,7 +1,7 @@
// ==UserScript==
// @name Checkmk SwissKnife
// @namespace https://luigidacunto.com/
// @version 2.15.1
// @version 2.15.2
// @checkmk 2.3.x
// @description Collection of UI improvements for Checkmk WATO. Each fix or enhancement is added here as an independent feature.
// @author Luigi D'Acunto
@ -1052,11 +1052,11 @@
const WATO_PAGE_SIZE = 50;
// 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.
// Without sidebar: the "pending changes" shortcut only appears for WATO admins.
// With sidebar: outer document has wato.py links in Setup nav.
// Without sidebar: any wato.py link in the page suffices (incl. injected Extra column buttons).
function hasWatoAccess(doc) {
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;
}