Module: check_mk
Branch: master
Commit: 50b04e8240189032b01272552db44488da1431b0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=50b04e82401890…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 3 10:06:46 2016 +0100
Fix adding graphs to dashboards
---
web/htdocs/dashboard.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index caed08f..9472325 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -1248,6 +1248,24 @@ def popup_add_dashlet(dashboard_name, dashlet_type, context,
params):
# Exceptions do not work here.
return
+ if dashlet_type == "pnpgraph":
+ # Context will always be None here, but the graph reference (in params)
+ # will contain it. Example:
+
+ # params = [ 'template', {'service_description': 'CPU
load', 'site': 'mysite',
+ # 'graph_index': 0, 'host_name':
'server123'}])
+ graph_info = params[1]
+ if params[0] == "template":
+ context = {
+ "host" : graph_info["host_name"]
+ }
+ if graph_info.get("service_description") != "_HOST_":
+ context["service"] =
graph_info["service_description"]
+ params = {
+ "source" : graph_info["graph_index"] + 1
+ }
+
+
load_dashboards(lock=True)
if dashboard_name not in available_dashboards: