diff --git a/CHANGELOG.md b/CHANGELOG.md index 99e2612..4c8cf02 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.1] - 2026-08-20 + +### Fixed +- "Configure in WATO" menu (host select + "Apri" button) did not appear on views without a dedicated Host column (e.g. "Service search" / `searchsvc`, grouped by service across hosts). Hostnames are now also recovered from any per-row link carrying a `host=` parameter when the classic Host column isn't present. + ## [2.20.0] - 2026-07-31 ### Added diff --git a/README.md b/README.md index b7ba75b..d094ccf 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ Adds a **Select hosts (N)** dropdown and an **Open** button to the monitoring vi - Up to 50 hosts per page (keeps URLs within safe length limits) - Deduplicates hostnames automatically (useful on service views where hosts repeat) +- Works even on views without a dedicated Host column (e.g. "Service search"), by recovering hostnames from any per-row link - **Open** button is disabled (gray) until a page is selected; turns blue when active; resets after opening - Only visible for users with WATO configuration access diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index cbac745..43114db 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.0 +// @version 2.20.1 // @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 @@ -1174,8 +1174,14 @@ const menues = doc.querySelector('#page_menu_bar td.menues'); if (!menues) return; + // Views with a dedicated Host column expose it as td.nobr. Views without one + // (e.g. searchsvc "Service search", grouped by service across hosts) still + // carry host= on other per-row links (Service, Icons, Perf-O-Meter...), so + // fall back to any link in the row when the classic column isn't there. + let hostLinks = [...doc.querySelectorAll('tr.data td.nobr a[href*="host="]')]; + if (!hostLinks.length) hostLinks = [...doc.querySelectorAll('tr.data a[href*="host="]')]; const hosts = [...new Set( - [...doc.querySelectorAll('tr.data td.nobr a[href*="host="]')] + hostLinks .map(a => { const m = a.href.match(/[?&]host=([^&]+)/); return m ? decodeURIComponent(m[1]) : null; }) .filter(Boolean) )];