Module: check_mk
Branch: master
Commit: 6a711d207039f8880f4c55af229791a986619717
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a711d207039f8…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Apr 3 12:31:46 2014 +0200
Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled by filter)
---
.werks/779 | 8 ++++++++
ChangeLog | 3 +++
web/plugins/views/builtin.py | 2 +-
web/plugins/views/datasources.py | 2 +-
web/plugins/views/filters.py | 18 ++++++++++++++++++
5 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/.werks/779 b/.werks/779
new file mode 100644
index 0000000..434df67
--- /dev/null
+++ b/.werks/779
@@ -0,0 +1,8 @@
+Title: Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled by
filter)
+Level: 1
+Component: multisite
+Version: 1.2.5i3
+Date: 1396521054
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 7b48ed2..9411296 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
Checks & Agents:
* 0149 cisco_secure: New check for Port Security on Cisco swichtes
+ Multisite:
+ * 0779 Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled
by filter)
+
Livestatus:
* 0747 FIX: livestatus table hostsbygroup: fixed bug with group_authorization
strict...
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index ff6df5c..2103533 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -924,7 +924,7 @@ multisite_builtin_views.update({
('hg_num_services_unknown', None),
('hg_num_services_pending', None)],
'public': True,
- 'show_filters': ['hostgroupnameregex'],
+ 'show_filters': ['hostgroupnameregex',
'hostgroupvisibility'],
'sorters': [],
'title': _('Hostgroups (Summary)'),
'topic': _('Hostgroups') },
diff --git a/web/plugins/views/datasources.py b/web/plugins/views/datasources.py
index 2991264..775555f 100644
--- a/web/plugins/views/datasources.py
+++ b/web/plugins/views/datasources.py
@@ -118,7 +118,7 @@ multisite_datasources["servicesbyhostgroup"] = {
multisite_datasources["hostgroups"] = {
"title" : _("Hostgroups"),
"table" : "hostgroups",
- "infos" : [ "hostgroup" ],
+ "infos" : [ "hostgroup", "hostgroups" ],
"keys" : [ "hostgroup_name" ],
"idkeys" : [ "site", "hostgroup_name" ],
}
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index e3a839d..08100b5 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -52,6 +52,21 @@ class FilterText(Filter):
def heading_info(self, infoname):
return html.var(self.htmlvars[0])
+
+
+class FilterHostgroupVisibility(Filter):
+ def __init__(self, name, title):
+ Filter.__init__(self, name, title, "hostgroups", [
"hostgroupshowempty" ], [])
+
+ def display(self):
+ html.checkbox("hostgroupshowempty", False, label="Show empty
groups")
+
+ def filter(self, infoname):
+ if html.var("hostgroupshowempty"):
+ return ""
+ else:
+ return "Filter: num_hosts > 0"
+
# filter title info column
htmlvar
declare_filter(100, FilterText("hostregex", _("Hostname"),
"host", "host_name", "host", "~~"),
_("Search field allowing regular expressions and partial
matches"))
@@ -74,6 +89,9 @@ declare_filter(202, FilterText("service_display_name",
_("Service alternative di
declare_filter(101, FilterText("hostgroupnameregex",
_("Hostgroup"), "hostgroup", "hostgroup_name",
"hostgroup_name", "~~"),
_("Search field allowing regular expressions and
partial matches on the names of hostgroups"))
+declare_filter(102, FilterHostgroupVisibility("hostgroupvisibility",
_("Empty Hostgroup Visibilitiy")),
+ _("You can enable this checkbox to show empty
hostgroups"))
+
declare_filter(101, FilterText("servicegroupnameregex",
_("Servicegroup"), "servicegroup", "servicegroup_name",
"servicegroup_name", "~~"),
_("Search field allowing regular expression and partial
matches"))