Module: check_mk
Branch: master
Commit: 4b01135599c9c1507e059e24c8c128e3ca45b912
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4b01135599c9c1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 22 13:55:23 2016 +0100
It is now possible to explicitly search for enabled/disabled and ineffective/effective
rules
Change-Id: I638a2f6739e2ea0fd5ddab206a974ac46a492c4a
---
web/htdocs/valuespec.py | 4 +++-
web/htdocs/wato.py | 14 ++++++++++----
web/htdocs/watolib.py | 4 ++--
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 91c797a..260b9ac 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -30,7 +30,9 @@
# and rename to better name
# - Consolidate RadioChoice and DropdownChoice to use same class
# and rename to better name
-# - Checkbox -> rename to Boolean
+# - Checkbox
+# -> rename to Boolean
+# -> Add alternative rendering "dropdown"
import math, os, time, re, sre_constants, urlparse, forms, tempfile
import base64
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index eb1dac4..2749b18 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -12857,13 +12857,19 @@ class ModeRuleSearch(WatoMode):
("rule_hosttags", HostTagCondition(
title = _("Used host tags"))
),
- ("rule_disabled", FixedValue(False,
+ ("rule_disabled", DropdownChoice(
title = _("Disabled"),
- totext = _("Search for disabled rules"),
+ choices = [
+ (True, _("Search for disabled rules")),
+ (False, _("Search for enabled rules")),
+ ],
)),
- ("rule_ineffective", FixedValue(False,
+ ("rule_ineffective", DropdownChoice(
title = _("Ineffective"),
- totext = _("Search for ineffective rules (not matching any host
or service)"),
+ choices = [
+ (True, _("Search for ineffective rules (not matching any
host or service)")),
+ (False, _("Search for effective rules")),
+ ],
)),
],
)
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 776fc0f..9f7a1df 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -6770,10 +6770,10 @@ class Rule(object):
def matches_search(self, search_options):
- if "rule_disabled" in search_options and not self.is_disabled():
+ if "rule_disabled" in search_options and
search_options["rule_disabled"] != self.is_disabled():
return False
- if "rule_ineffective" in search_options and not self.is_ineffective():
+ if "rule_ineffective" in search_options and
search_options["rule_ineffective"] != self.is_ineffective():
return False
if not match_search_expression(search_options, "rule_description",
self.description()):