feat: estesi accordion badge anche alla pagina bulkedit
Aggiunta costante ACCORDION_MODES (Set con 'edit_host' e 'bulkedit') per centralizzare il guard URL. I badge di conteggio checkbox e valori ereditati ora si attivano su entrambe le pagine di modifica host, singola e massiva. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
953cad326c
commit
b775467d91
1 changed files with 10 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Checkmk SwissKnife
|
||||
// @namespace https://luigidacunto.com/
|
||||
// @version 2.3
|
||||
// @version 2.4
|
||||
// @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
|
||||
|
|
@ -43,6 +43,9 @@
|
|||
catch (e) { return ''; }
|
||||
}
|
||||
|
||||
// Pagine che supportano gli accordion badge (stessa struttura form_edit_host + table.nform)
|
||||
const ACCORDION_MODES = new Set(['edit_host', 'bulkedit']);
|
||||
|
||||
// Inietta CSS nel documento target (una sola volta, deduplica per id)
|
||||
function injectStyles(iDoc, id, css) {
|
||||
if (iDoc.getElementById(id)) return;
|
||||
|
|
@ -557,8 +560,8 @@
|
|||
if (++attemptsAcc < MAX_ATTEMPTS) setTimeout(tryInitAccordionCounts, POLL_INTERVAL_MS);
|
||||
return;
|
||||
}
|
||||
// Guard URL: attiva solo sulla pagina edit_host
|
||||
if (getPageMode(iDoc) !== 'edit_host') return;
|
||||
// Guard URL: attiva solo sulle pagine con accordion supportati
|
||||
if (!ACCORDION_MODES.has(getPageMode(iDoc))) return;
|
||||
if (!initAccordionCheckedCounts(iDoc)) {
|
||||
if (++attemptsAcc < MAX_ATTEMPTS) setTimeout(tryInitAccordionCounts, POLL_INTERVAL_MS);
|
||||
}
|
||||
|
|
@ -571,9 +574,9 @@
|
|||
attemptsAcc = 0;
|
||||
// Folder select: si auto-ferma se non trova l'elemento, schedula sempre.
|
||||
setTimeout(tryEnhanceFolderSelect, 800);
|
||||
// Accordion: solo su edit_host. Se mode è vuoto (iframe non ancora caricato)
|
||||
// si schedula comunque: tryInitAccordionCounts farà il guard URL.
|
||||
if (!mode || mode === 'edit_host') {
|
||||
// Accordion: solo sulle pagine in ACCORDION_MODES. Se mode è vuoto (iframe non ancora
|
||||
// caricato) si schedula comunque: tryInitAccordionCounts farà il guard URL.
|
||||
if (!mode || ACCORDION_MODES.has(mode)) {
|
||||
setTimeout(tryInitAccordionCounts, 800);
|
||||
}
|
||||
}
|
||||
|
|
@ -594,7 +597,7 @@
|
|||
attemptsFolder = 0;
|
||||
setTimeout(tryEnhanceFolderSelect, 300);
|
||||
}
|
||||
if (mode === 'edit_host') {
|
||||
if (ACCORDION_MODES.has(mode)) {
|
||||
const form = iDoc.getElementById('form_edit_host');
|
||||
if (form && !form.dataset.cmkAccBadge) {
|
||||
attemptsAcc = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue