Module: check_mk
Branch: master
Commit: 27a51bbdafdb70265ddd4f4761a0d1cff547ccd8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=27a51bbdafdb70…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 22 14:02:41 2016 +0100
It is now possible to explicitly search for used/unused and deprecated/not deprecated
rulesets
Change-Id: I538bea63af2ede481853989fc79c7c5891a432a5
---
web/htdocs/wato.py | 19 ++++++++++++++-----
web/htdocs/watolib.py | 4 ++--
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2749b18..522b3c5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11880,16 +11880,19 @@ class ModeRuleEditor(WatoMode):
html.context_button(_("Used Rulesets"), folder_preserving_link([
("mode", "rulesets"),
- ("search_p_ruleset_used_USE", "on")
+ ("search_p_ruleset_used", "0"),
+ ("search_p_ruleset_used_USE", "on"),
]), "usedrulesets")
html.context_button(_("Ineffective rules"), folder_preserving_link([
("mode", "rulesets"),
+ ("search_p_rule_ineffective", "0"),
("search_p_rule_ineffective_USE", "on")]
), "rulesets_ineffective")
html.context_button(_("Deprecated Rulesets"), folder_preserving_link([
("mode", "rulesets"),
+ ("search_p_ruleset_deprecated", "0"),
("search_p_ruleset_deprecated_USE", "on")
]), "rulesets_deprecated")
@@ -12820,13 +12823,19 @@ class ModeRuleSearch(WatoMode):
size = 60,
mode = RegExpUnicode.infix,
)),
- ("ruleset_deprecated", FixedValue(False,
+ ("ruleset_deprecated", DropdownChoice(
title = _("Deprecated"),
- totext = _("Search for deprecated rulesets"),
+ choices = [
+ (True, _("Search for deprecated rulesets")),
+ (False, _("Search for not deprecated rulesets")),
+ ],
)),
- ("ruleset_used", FixedValue(False,
+ ("ruleset_used", DropdownChoice(
title = _("Used"),
- totext = _("Search for rulesets that have rules
configured"),
+ choices = [
+ (True, _("Search for rulesets that have rules
configured")),
+ (False, _("Search for rulesets that don't have rules
configured")),
+ ],
)),
("rule_description", RegExpUnicode(
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 9f7a1df..fc7ae4e 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -6325,10 +6325,10 @@ class Ruleset(object):
def matches_search(self, search_options):
- if "ruleset_deprecated" in search_options and not
self.is_deprecated():
+ if "ruleset_deprecated" in search_options and
search_options["ruleset_deprecated"] != self.is_deprecated():
return False
- if "ruleset_used" in search_options and
self.is_empty_in_folder(Folder.current()):
+ if "ruleset_used" in search_options and
search_options["ruleset_used"] == self.is_empty_in_folder(Folder.current()):
return False
if "ruleset_group" in search_options \