Module: check_mk
Branch: master
Commit: 9b658649e2ed1a34fbf21e523ba4a8c75f9ebc98
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9b658649e2ed1a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Sep 26 09:46:17 2013 +0200
New filters: Host state type and Service state type
---
ChangeLog | 1 +
web/plugins/views/filters.py | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 98893f9..4dce63f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -182,6 +182,7 @@
to configure the interval of sidebar popup notification updates e.g. via
WATO Global Settings.
* New option for painting timestamp: as Unix Epoch time
+ * New filters: Host state type and Service state type
* FIX: better error message in case of exception in SNMP handling
* FIX: Inventory screen: Now shows custom checks
* FIX: Fixed locking problem of multisite pages related to user loading/saving
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index 739dcce..958e950 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -286,6 +286,8 @@ class FilterHostState(Filter):
declare_filter(115, FilterHostState())
+
+
class FilterTristate(Filter):
def __init__(self, name, title, info, column, deflt = -1):
self.column = column
@@ -316,6 +318,25 @@ class FilterTristate(Filter):
else:
return self.filter_code(infoname, False)
+
+class FilterStateType(FilterTristate):
+ def __init__(self, info, column, title, deflt = -1):
+ FilterTristate.__init__(self, column, title, info, None, deflt)
+
+ def display(self):
+ current = html.var(self.varname)
+ html.begin_radio_group(horizontal = True)
+ for value, text in [("0", _("SOFT")), ("1",
_("HARD")), ("-1", _("(ignore)"))]:
+ checked = current == value or (current in [ None, ""] and
int(value) == self.deflt)
+ html.radiobutton(self.varname, value, checked, text + "
")
+ html.end_radio_group()
+
+ def filter_code(self, infoname, positive):
+ return "Filter: state_type = %d\n" % int(positive)
+
+declare_filter(116, FilterStateType("host", "host_state_type",
_("Host state type")))
+declare_filter(217, FilterStateType("service", "service_state_type",
_("Service state type")))
+
class FilterNagiosFlag(FilterTristate):
def __init__(self, info, column, title, deflt = -1):
FilterTristate.__init__(self, column, title, info, column, deflt)