From f97ea33ba863178f0b7023658d6c2eca2c0ba24e Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Wed, 17 Jun 2026 18:25:53 +0200 Subject: [PATCH] v2.9.9 - Generalizza rilevamento hostname in addInventoryButtons Sostituisce il selettore fisso a[href*="view_name=hoststatus"] con ricerca generica su a[href*="host="] + URLSearchParams.get('host'), in modo che i tre pulsanti compaiano su qualsiasi vista view.py con una colonna host indipendentemente dal view_name usato nel link. --- user_script/checkmk_swissknife.user.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index 9b6e9e8..04a4a4a 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.9.8 +// @version 2.9.9 // @description Raccolta di miglioramenti all'interfaccia di Checkmk WATO. Ogni fix o enhancement viene aggiunto qui come feature indipendente. // @author Luigi D'Acunto // @homepageURL https://git.luigidacunto.com/tools/checkmk-swissknife @@ -874,10 +874,11 @@ const CLIP_SVG = ''; hostCells.forEach(td => { - const link = td.querySelector('a[href*="view_name=hoststatus"]'); - if (!link) return; - const params = new URLSearchParams(link.getAttribute('href').split('?')[1] || ''); - const hostname = params.get('host'); + let hostname = null; + for (const a of td.querySelectorAll('a[href*="host="]')) { + const h = new URLSearchParams(a.getAttribute('href').split('?')[1] || '').get('host'); + if (h) { hostname = h; break; } + } if (!hostname) return; const shortname = hostname.split('.')[0];