diff --git a/CHANGELOG.md b/CHANGELOG.md index 3850236..b6ac03c 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.24.1] - 2026-09-30 + +### Fixed +- Missing-host highlighting no longer flags regexes that follow a comma or an "or" in a "Host name matches one of regex A, B or C" condition as host names. + ## [2.24.0] - 2026-09-28 ### Added diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index be03dc0..ffa0cfd 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.0 +// @version 2.24.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 @@ -913,10 +913,14 @@ items.forEach(li => { if (!li.textContent.trim().startsWith('Host name')) return; + let isRegex = false; li.querySelectorAll('b').forEach(b => { - // Text right before each tells regex ("matches regex", "one of regex") from exact name ("is", "is not") + // Text right before each tells regex ("matches regex", "one of regex") from exact name ("is", "is not"). + // A bare "," / " or " separator continues the previous mode: "matches regex A or B" → B is a regex too. const before = b.previousSibling ? b.previousSibling.textContent : ''; - if (/regex/.test(before) || b.querySelector('a')) return; + if (/regex/.test(before)) isRegex = true; + else if (!/^[\s,]*(or)?[\s,]*$/.test(before)) isRegex = false; + if (isRegex || b.querySelector('a')) return; b.classList.add('cmk-sk-missing-host'); b.title = 'Host not found in Checkmk (deleted?)'; });