Module: check_mk
Branch: master
Commit: 6a57f3d4896c4af2ec4d41001c6ec6a2ff96a638
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a57f3d4896c4a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 11 16:44:27 2014 +0100
#1761 FIX Ruleset search is now consistent for host & serviceparameters and manual
checks
---
.werks/1761 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 21 +++++++++++----------
3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/.werks/1761 b/.werks/1761
new file mode 100644
index 0000000..4acf4f7
--- /dev/null
+++ b/.werks/1761
@@ -0,0 +1,10 @@
+Title: Ruleset search is now consistent for host & serviceparameters and manual
checks
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418312629
+
+
diff --git a/ChangeLog b/ChangeLog
index cb915b2..35a6d51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
WATO:
* 1760 Added search form to manual checks page
+ * 1761 FIX: Ruleset search is now consistent for host & serviceparameters and
manual checks
1.2.6b1:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4f4010b..d5e977f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -13669,6 +13669,8 @@ def mode_ruleeditor(phase):
else:
html.write("<h3>%s: %s</h3>" % (_("Host"),
only_host))
+ search_form(_("Search for rules: "), "rulesets")
+
# Group names are separated with "/" into main group and optional
subgroup.
# Do not loose carefully manually crafted order of groups!
groupnames = []
@@ -13693,9 +13695,6 @@ def mode_ruleeditor(phase):
menu.append((url, title, icon, "rulesets", help))
render_main_menu(menu)
- html.write("<br>")
- search_form(_("Search for rules: "), "rulesets")
-
def search_form(title, mode=None):
html.begin_form("search")
html.write(title+' ')
@@ -13867,7 +13866,7 @@ def mode_rulesets(phase, group=None):
help = _("Here you can create explicit checks that are not being created by
the automatic service discovery.")
only_used = False
elif search != None:
- title = _("Rules matching ") + html.attrencode(search)
+ title = _("Rules matching") + ": " + html.attrencode(search)
help = _("All rules that contain '%s' in their name") %
html.attrencode(search)
only_used = False
else:
@@ -13905,7 +13904,7 @@ def mode_rulesets(phase, group=None):
render_folder_path(keepvarnames = ["mode", "local",
"group"])
if search != None or group == 'static':
- search_form(_("Search for rules: "), "rulesets")
+ search_form(_("Search for rules: "), group != "static" and
"rulesets")
if help != None:
help = "".join(help.split("\n", 1)[1:]).strip()
@@ -13926,7 +13925,7 @@ def mode_rulesets(phase, group=None):
# Select matching rule groups while keeping their configured order
groupnames = [ gn for gn, rulesets in g_rulespec_groups
- if only_used or search or gn == group or gn.startswith(group +
"/") ]
+ if only_used or search != None or gn == group or (group and
gn.startswith(group + "/")) ]
# In case of search we need to sort the groups since main chapters would
# appear more than once otherwise.
@@ -13961,9 +13960,11 @@ def mode_rulesets(phase, group=None):
and search not in varname:
continue
- if search != None and groupname.startswith("static/"):
- continue # search must not find these
-
+ # Show static checks rules only in on dedicated page and vice versa
+ if group != 'static' and groupname.startswith("static/"):
+ continue
+ elif group == 'static' and not
groupname.startswith("static/"):
+ continue
# Handle case where a host is specified
rulespec = g_rulespecs[varname]
@@ -13980,7 +13981,7 @@ def mode_rulesets(phase, group=None):
if only_local and num_local_rules == 0:
continue
- if only_used or search != None:
+ if group != 'static' and (only_used or search != None):
titlename = g_rulegroups[groupname.split("/")[0]][0]
else:
if '/' in groupname: