From f91470d103a8d80ca068a1e2aecfa1ef162ed9ea Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Thu, 20 Aug 2026 17:54:32 +0200 Subject: [PATCH] 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. --- CHANGELOG.md | 5 +++++ user_script/checkmk_swissknife.user.js | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c8cf02..bf17d74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index 43114db..a53d0b2 100644 --- a/user_script/checkmk_swissknife.user.js +++ b/user_script/checkmk_swissknife.user.js @@ -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); }