v2.12.3 - Estendi folder select enhancement al filtro Folder nelle viste di monitoraggio (wato_folder)
This commit is contained in:
parent
09d9e05b56
commit
752a32cdfe
1 changed files with 27 additions and 14 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Checkmk SwissKnife
|
// @name Checkmk SwissKnife
|
||||||
// @namespace https://luigidacunto.com/
|
// @namespace https://luigidacunto.com/
|
||||||
// @version 2.12.2
|
// @version 2.12.3
|
||||||
// @checkmk 2.3.x
|
// @checkmk 2.3.x
|
||||||
// @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
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
try { return iframe.contentDocument; } catch (e) { return null; }
|
try { return iframe.contentDocument; } catch (e) { return null; }
|
||||||
}
|
}
|
||||||
if (document.getElementById(selectId) ||
|
if (document.getElementById(selectId) ||
|
||||||
document.querySelector('select[name*="folder_path"]')) {
|
document.querySelector('select[name*="folder_path"]') ||
|
||||||
|
document.getElementById('wato_folder')) {
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -185,8 +186,8 @@
|
||||||
buildCustomSearchOverlay(iDoc, sel);
|
buildCustomSearchOverlay(iDoc, sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildCustomSearchOverlay(iDoc, sel) {
|
function buildCustomSearchOverlay(iDoc, sel, containerEl) {
|
||||||
const divContainer = iDoc.getElementById(FOLDER_DIV_ID);
|
const divContainer = containerEl || iDoc.getElementById(FOLDER_DIV_ID);
|
||||||
if (!divContainer) return;
|
if (!divContainer) return;
|
||||||
if (divContainer.querySelector('.cmk-sk-folder-overlay')) return;
|
if (divContainer.querySelector('.cmk-sk-folder-overlay')) return;
|
||||||
|
|
||||||
|
|
@ -401,6 +402,7 @@
|
||||||
divContainer.appendChild(wrapper);
|
divContainer.appendChild(wrapper);
|
||||||
divContainer.appendChild(badge);
|
divContainer.appendChild(badge);
|
||||||
|
|
||||||
|
sel.dataset.cmkEnhanced = '1';
|
||||||
injectFolderStyles(iDoc);
|
injectFolderStyles(iDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1034,18 +1036,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const sel = iDoc.getElementById(FOLDER_SELECT_ID);
|
const sel = iDoc.getElementById(FOLDER_SELECT_ID);
|
||||||
if (!sel) {
|
const selVF = iDoc.getElementById('wato_folder');
|
||||||
// La select non è presente in questa pagina: feature non applicabile, si ferma.
|
if (!sel && !selVF) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (sel && !sel.dataset.cmkEnhanced) {
|
||||||
if (!sel.classList.contains('select2-hidden-accessible')) {
|
if (!sel.classList.contains('select2-hidden-accessible')) {
|
||||||
if (++attemptsFolder < MAX_ATTEMPTS) setTimeout(tryEnhanceFolderSelect, POLL_INTERVAL_MS);
|
if (++attemptsFolder < MAX_ATTEMPTS) setTimeout(tryEnhanceFolderSelect, POLL_INTERVAL_MS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCustomSearchOverlay(iDoc, sel);
|
buildCustomSearchOverlay(iDoc, sel);
|
||||||
}
|
}
|
||||||
|
if (selVF && !selVF.dataset.cmkEnhanced) {
|
||||||
|
if (!selVF.classList.contains('select2-hidden-accessible')) {
|
||||||
|
if (++attemptsFolder < MAX_ATTEMPTS) setTimeout(tryEnhanceFolderSelect, POLL_INTERVAL_MS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
buildCustomSearchOverlay(iDoc, selVF, selVF.closest('.floatfilter') || selVF.parentElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function tryInitAccordionCounts() {
|
function tryInitAccordionCounts() {
|
||||||
const iDoc = getWatoDoc('form_edit_host');
|
const iDoc = getWatoDoc('form_edit_host');
|
||||||
|
|
@ -1135,6 +1143,11 @@
|
||||||
attemptsFolder = 0;
|
attemptsFolder = 0;
|
||||||
setTimeout(tryEnhanceFolderSelect, 300);
|
setTimeout(tryEnhanceFolderSelect, 300);
|
||||||
}
|
}
|
||||||
|
const selVF = iDoc.getElementById('wato_folder');
|
||||||
|
if (selVF && selVF.classList.contains('select2-hidden-accessible') && !selVF.dataset.cmkEnhanced) {
|
||||||
|
attemptsFolder = 0;
|
||||||
|
setTimeout(tryEnhanceFolderSelect, 300);
|
||||||
|
}
|
||||||
if (ACCORDION_MODES.has(mode)) {
|
if (ACCORDION_MODES.has(mode)) {
|
||||||
const form = iDoc.getElementById('form_edit_host');
|
const form = iDoc.getElementById('form_edit_host');
|
||||||
if (form && !form.dataset.cmkAccBadge) {
|
if (form && !form.dataset.cmkAccBadge) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue