Fix Configure in WATO menu still not appearing on searchsvc-like views

The 2.20.1 fix only patched host collection inside addViewWatoMenu, but
two gating checks upstream (the polling loop and the SPA-navigation
re-check) still required the classic td.nobr Host column before ever
calling that function, so the menu was never actually built.
This commit is contained in:
Luigi D'Acunto 2026-08-20 17:54:32 +02:00
parent 3629447279
commit f91470d103
2 changed files with 10 additions and 4 deletions

View file

@ -5,6 +5,11 @@ All notable changes to **Checkmk SwissKnife** are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.20.2] - 2026-08-20
### Fixed
- "Configure in WATO" menu still didn't appear on views without a dedicated Host column after the 2.20.1 fix: two activation checks (the initial polling loop and the SPA-navigation re-check) still required the classic `td.nobr` Host column before even attempting to build the menu. Both now also accept the `host=` fallback, so the menu actually gets built on views like "Service search".
## [2.20.1] - 2026-08-20
### Fixed

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name Checkmk SwissKnife
// @namespace https://luigidacunto.com/
// @version 2.20.1
// @version 2.20.2
// @checkmk 2.3.x - 2.4.x
// @description Collection of UI improvements for Checkmk WATO. Each fix or enhancement is added here as an independent feature.
// @author Luigi D'Acunto
@ -1639,8 +1639,9 @@
return;
}
try { if (!/\/view\.py/.test(doc.location.pathname)) return; } catch (e) { return; }
// Wait until the data table is present
if (!doc.querySelector('tr.data td.nobr a[href*="host="]')) {
// Wait until the data table is present (classic Host column, or the
// host= fallback used by views without one, e.g. searchsvc)
if (!doc.querySelector('tr.data td.nobr a[href*="host="], tr.data a[href*="host="]')) {
if (++attemptsViewWato < MAX_ATTEMPTS) setTimeout(tryAddViewWatoMenu, POLL_INTERVAL_MS);
return;
}
@ -2013,7 +2014,7 @@
const tDoc = getTargetDoc();
if (tDoc && tDoc.body && !tDoc.body.dataset.cmkViewWatoMenu) {
try {
if (/\/view\.py/.test(tDoc.location.pathname) && tDoc.querySelector('tr.data td.nobr a[href*="host="]')) {
if (/\/view\.py/.test(tDoc.location.pathname) && tDoc.querySelector('tr.data td.nobr a[href*="host="], tr.data a[href*="host="]')) {
attemptsViewWato = 0;
setTimeout(tryAddViewWatoMenu, 300);
}