Module: check_mk
Branch: master
Commit: 9a210fa2e0497ce7068f10f8264a93b398318b34
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9a210fa2e0497c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 6 10:04:21 2016 +0200
3321 FIX Globes in dashboards now correctly reflect selected WATO folder
The bug was that they always showed the stats of all hosts, not just
of the selected folder (if you are using the {{Folders}} snapin).
---
.werks/3321 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/dashboard.py | 9 ++++++---
web/plugins/dashboard/dashlets.py | 9 +++++++--
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/.werks/3321 b/.werks/3321
new file mode 100644
index 0000000..eccd641
--- /dev/null
+++ b/.werks/3321
@@ -0,0 +1,11 @@
+Title: Globes in dashboards now correctly reflect selected WATO folder
+Level: 2
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459929807
+
+The bug was that they always showed the stats of all hosts, not just
+of the selected folder (if you are using the {{Folders}} snapin).
diff --git a/ChangeLog b/ChangeLog
index 256412a..24fa9f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -166,6 +166,7 @@
* 3021 FIX: interface metrics: fixed broken interface metrics when using nagios
core...
* 3360 FIX: Fixed different exceptions in predictive monitoring GUI
* 3320 FIX: Fix bogus interfering snapins Tree of folders and Folders...
+ * 3321 FIX: Globes in dashboards now correctly reflect selected WATO folder...
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 06d5804..07be582 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -440,13 +440,14 @@ def dashlet_container_end():
html.write("</div>\n")
-def draw_dashlet_content(nr, the_dashlet, stash_html_vars=True):
+def draw_dashlet_content(nr, the_dashlet, wato_folder, stash_html_vars=True):
if stash_html_vars:
html.stash_vars()
html.del_all_vars()
try:
visuals.add_context_to_uri_vars(the_dashlet)
+ html.set_var("wato_folder", wato_folder)
dashlet_type = dashlet_types[the_dashlet['type']]
if 'iframe_render' in dashlet_type:
@@ -692,7 +693,7 @@ def draw_dashlet(name, board, nr, dashlet, wato_folder):
# The content is rendered only if it is fixed. In the
# other cases the initial (re)-size will paint the content.
if "render" in dashlet_type:
- draw_dashlet_content(nr, dashlet)
+ draw_dashlet_content(nr, dashlet, wato_folder)
elif "content" in dashlet: # fixed content
html.write(dashlet["content"])
@@ -762,7 +763,9 @@ def ajax_dashlet():
if the_dashlet['type'] not in dashlet_types:
raise MKGeneralException(_('The requested dashlet type does not
exist.'))
- draw_dashlet_content(ident, the_dashlet, stash_html_vars=False)
+
+ wato_folder = html.var("wato_folder")
+ draw_dashlet_content(ident, the_dashlet, wato_folder, stash_html_vars=False)
#.
# .--Dashboard List------------------------------------------------------.
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index 28e548b..e21b7fe 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -214,8 +214,13 @@ def render_statistics(pie_id, what, table, filter, dashlet):
pie_left_aspect = 0.5
pie_right_aspect = 0.8
- info = what == 'hosts' and 'host' or 'service'
- use_filters = visuals.filters_of_visual(dashlet, [info])
+ if what == 'hosts':
+ info = 'host'
+ infos = [ info ]
+ else:
+ info = 'service'
+ infos = [ 'host', 'service' ]
+ use_filters = visuals.filters_of_visual(dashlet, infos)
for filt in use_filters:
if filt.available() and not isinstance(filt, visuals.FilterSite):
filter += filt.filter(info)