Module: check_mk
Branch: master
Commit: 76cfaab71492eac7f3cfc30c7aa90794500ef1c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=76cfaab71492ea…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 8 17:10:37 2017 +0200
4666 FIX Fixed ineffective rulesets page showing empty rulesets
Change-Id: If51629457ef2fa64e1a96c7a154d0679f3d74f7c
---
.werks/4666 | 10 ++++++++++
web/htdocs/watolib.py | 12 +++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.werks/4666 b/.werks/4666
new file mode 100644
index 0000000..f96dd8f
--- /dev/null
+++ b/.werks/4666
@@ -0,0 +1,10 @@
+Title: Fixed ineffective rulesets page showing empty rulesets
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1494256201
+Class: fix
+
+
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index ec684c9..db5e09a 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -6665,11 +6665,17 @@ class Ruleset(object):
if rule.matches_search(search_options):
self.search_matching_rules.append(rule)
- if not self.search_matching_rules:
- return self.matches_fulltext_search(search_options)
- else:
+ # Show all rulesets where at least one rule matched
+ if self.search_matching_rules:
return True
+ # e.g. in case ineffective rules are searched and no fulltext
+ # search is filled in: Then don't show empty rulesets.
+ if not search_options.get("fulltext"):
+ return False
+
+ return self.matches_fulltext_search(search_options)
+
def has_rule_search_options(self, search_options):
return bool([ k for k in search_options.keys() if k == "fulltext" or
k.startswith("rule_") ])