Module: check_mk
Branch: master
Commit: 9e493f908b92a581b995921c5765442a3c5d570b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9e493f908b92a5…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Sep 23 16:43:08 2015 +0200
#2600 Allow service regular expression filter to be negated
---
.werks/2600 | 11 +++++++++++
ChangeLog | 1 +
web/plugins/visuals/filters.py | 14 ++++++--------
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/.werks/2600 b/.werks/2600
new file mode 100644
index 0000000..7c71088
--- /dev/null
+++ b/.werks/2600
@@ -0,0 +1,11 @@
+Title: Allow service regular expression filter to be negated
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i3
+Date: 1443019197
+Class: feature
+
+This is now like the filter for the hosts. This allows you to create
+a view excludes some services by their name. Multiple names can be
+joined by vertical bars, e.g. <tt>LOG|Filesystem /tmp</tt>.
diff --git a/ChangeLog b/ChangeLog
index d64011b..14689a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -214,6 +214,7 @@
* 2512 Custom Icons/Actions: URLs target frames can now be configured...
* 2612 SEC: Fixed possible XSS on service detail page using the long service
output...
* 2613 SEC: Additional fix for refleced XSS on index page using start_url...
+ * 2600 Allow service regular expression filter to be negated...
* 2314 FIX: Availability: fixed exception when grouping by host or service group
* 2361 FIX: Fix exception for missing key 'title' in certain cases of older
customized views
* 2379 FIX: Plugin-Output: Fixed handling of URLs within output of check_http...
diff --git a/web/plugins/visuals/filters.py b/web/plugins/visuals/filters.py
index 7c75a7c..694e95e 100644
--- a/web/plugins/visuals/filters.py
+++ b/web/plugins/visuals/filters.py
@@ -58,6 +58,8 @@ class FilterText(Filter):
negate = ""
if current_value:
+ if type(current_value) == unicode:
+ current_value = current_value.encode("utf-8")
return "Filter: %s %s%s %s\n" % (self.column, negate, self.op,
lqencode(current_value))
else:
return ""
@@ -70,17 +72,13 @@ class FilterText(Filter):
class FilterUnicode(FilterText):
+ def __init__(self, *args):
+ FilterText.__init__(self, *args)
+
def _current_value(self):
htmlvar = self.htmlvars[0]
return html.var_utf8(htmlvar, "")
- def filter(self, infoname):
- current_value = self._current_value()
- if current_value:
- return "Filter: %s %s %s\n" % (self.column, self.op,
lqencode(current_value.encode('utf-8')))
- else:
- return ""
-
# filter title info column
htmlvar
declare_filter(100, FilterText("hostregex", _("Hostname"),
"host", "host_name", "host_regex", "~~"
, True),
_("Search field allowing regular expressions and partial
matches"))
@@ -91,7 +89,7 @@ declare_filter(101, FilterText("host", _("Hostname
(exact match)"),
declare_filter(102, FilterUnicode("hostalias", _("Hostalias"),
"host", "host_alias", "hostalias",
"~~", True),
_("Search field allowing regular expressions and partial
matches"))
-declare_filter(200, FilterUnicode("serviceregex", _("Service"),
"service", "service_description", "service_regex",
"~~"),
+declare_filter(200, FilterUnicode("serviceregex", _("Service"),
"service", "service_description", "service_regex",
"~~", True),
_("Search field allowing regular expressions and partial
matches"))
declare_filter(201, FilterUnicode("service", _("Service (exact
match)"), "service", "service_description",
"service", "="),