From 033bc1c48218d419d6278b1f41570ab263c0185d Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Mon, 13 Jul 2026 15:29:30 +0200 Subject: [PATCH 1/2] Aggiorna il file .gitignore per includere file di test personali e migliorare la gestione dei file ignorati --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 75c810e..c5f4110 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ - -### My Personal test file for Dev only ### /.*/ /*.bat /*.ps1 +/*.sh /*.md + +!/.gitlab !README.md !CHANGELOG.md \ No newline at end of file From 0fbfda4b815d4726350d383f57e12bca38af1ee5 Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Mon, 13 Jul 2026 16:19:28 +0200 Subject: [PATCH 2/2] v2.16.1 - Fix: filtro "Relevant only" non compariva su edit_ruleset con contesto host Le righe "no match" erano incluse in RELEVANT_SEL e risultavano rilevanti: su pagine con contesto host/service ogni riga aveva un badge, quindi non c'era mai nulla da nascondere e la barra non veniva inserita. Ora il filtro nasconde proprio le righe che non matchano. Inoltre il guard cmkFilterToggle veniva settato in cima alla funzione: un primo tentativo a vuoto bloccava per sempre i successivi. Ora viene settato solo quando la barra viene effettivamente inserita. --- README.md | 4 ++-- user_script/checkmk_swissknife.user.js | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 69df676..476cb3b 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,9 @@ Applies to: `mode=edit_ruleset` with host/service context. --- ### Ruleset Filter Toggle -After match/ineffective highlighting runs, a **"Relevant only"** button appears above the rule list. Clicking it hides all non-highlighted rows and empty folders, leaving only the rules that matter for the current context. +After match/ineffective highlighting runs, a **"Relevant only"** button appears above the rule list. Clicking it hides all `✗ no match` rows, non-highlighted rows and empty folders, leaving only the matching (or ineffective) rules for the current context. -Applies to: `mode=edit_ruleset` (when at least one highlighted row exists). +Applies to: `mode=edit_ruleset` (when at least one `✓ match` or ineffective row exists). --- diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index 455b70e..995ce39 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.16.0 +// @version 2.16.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 @@ -729,9 +729,9 @@ function addRulesetFilterToggle(doc) { if (doc.body.dataset.cmkFilterToggle === '1') return; - doc.body.dataset.cmkFilterToggle = '1'; - const RELEVANT_SEL = 'tr.cmk-sk-rule-match, tr.cmk-sk-rule-nomatch, tr.cmk-sk-ineffective'; + // Le righe "no match" NON sono rilevanti: il filtro serve proprio a nasconderle + const RELEVANT_SEL = 'tr.cmk-sk-rule-match, tr.cmk-sk-ineffective'; // No highlighted rows = no active search, toggle is useless const relevantCount = doc.querySelectorAll(RELEVANT_SEL).length; @@ -750,6 +750,10 @@ if (!irrelevantRows && !irrelevantFolders) return; + // Guard settato solo qui: se la tabella non era ancora renderizzata + // il prossimo tentativo deve poter riprovare + doc.body.dataset.cmkFilterToggle = '1'; + injectStyles(doc, 'cmk-sk-filter-toggle-styles', ` #cmk-sk-filter-bar { display: flex;