From ad951eed30bb5558d5dc61a451c348e179ad62d7 Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Wed, 30 Sep 2026 15:17:03 +0200 Subject: [PATCH] Color host name conditions on ruleset pages: regexes orange, existing hosts green --- CHANGELOG.md | 5 +++++ user_script/checkmk_swissknife.user.js | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6ac03c..ac2a8d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to **Checkmk SwissKnife** are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.25.0] - 2026-09-30 + +### Added +- Regexes in a rule's "Host name" condition are now shown in dark orange (readable on both light and dark themes), so they are easy to tell apart from exact host names. Exact host names that still exist in Checkmk (linked) are shown in green. + ## [2.24.1] - 2026-09-30 ### Fixed diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index ffa0cfd..df0a266 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.24.1 +// @version 2.25.0 // @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 @@ -909,6 +909,8 @@ injectStyles(doc, 'cmk-sk-missing-host-styles', ` b.cmk-sk-missing-host { color: #ff4d4d !important; text-decoration: underline wavy #ff4d4d; } + b.cmk-sk-host-regex { color: #d35400 !important; } + b.cmk-sk-host-ok, b.cmk-sk-host-ok a { color: #2ea043 !important; } `); items.forEach(li => { @@ -920,7 +922,8 @@ const before = b.previousSibling ? b.previousSibling.textContent : ''; if (/regex/.test(before)) isRegex = true; else if (!/^[\s,]*(or)?[\s,]*$/.test(before)) isRegex = false; - if (isRegex || b.querySelector('a')) return; + if (isRegex) { b.classList.add('cmk-sk-host-regex'); return; } + if (b.querySelector('a')) { b.classList.add('cmk-sk-host-ok'); return; } b.classList.add('cmk-sk-missing-host'); b.title = 'Host not found in Checkmk (deleted?)'; });