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.
This commit is contained in:
parent
dfd83f78a3
commit
f97ea33ba8
1 changed files with 6 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Checkmk SwissKnife
|
// @name Checkmk SwissKnife
|
||||||
// @namespace https://luigidacunto.com/
|
// @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.
|
// @description Raccolta di miglioramenti all'interfaccia di Checkmk WATO. Ogni fix o enhancement viene aggiunto qui come feature indipendente.
|
||||||
// @author Luigi D'Acunto
|
// @author Luigi D'Acunto
|
||||||
// @homepageURL https://git.luigidacunto.com/tools/checkmk-swissknife
|
// @homepageURL https://git.luigidacunto.com/tools/checkmk-swissknife
|
||||||
|
|
@ -874,10 +874,11 @@
|
||||||
const CLIP_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
const CLIP_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
||||||
|
|
||||||
hostCells.forEach(td => {
|
hostCells.forEach(td => {
|
||||||
const link = td.querySelector('a[href*="view_name=hoststatus"]');
|
let hostname = null;
|
||||||
if (!link) return;
|
for (const a of td.querySelectorAll('a[href*="host="]')) {
|
||||||
const params = new URLSearchParams(link.getAttribute('href').split('?')[1] || '');
|
const h = new URLSearchParams(a.getAttribute('href').split('?')[1] || '').get('host');
|
||||||
const hostname = params.get('host');
|
if (h) { hostname = h; break; }
|
||||||
|
}
|
||||||
if (!hostname) return;
|
if (!hostname) return;
|
||||||
const shortname = hostname.split('.')[0];
|
const shortname = hostname.split('.')[0];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue