Module: check_mk
Branch: master
Commit: 50138777e1b3aa0b02829bddea1336ecea4f1802
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=50138777e1b3aa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 2 09:50:56 2015 +0100
Dashboard: Fixed glitches in new style graph scaling when moving graphs
---
web/htdocs/metrics.py | 17 +++++++++------
web/plugins/dashboard/dashlets.py | 43 +------------------------------------
2 files changed, 11 insertions(+), 49 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 24e61e0..12b96c1 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -1273,12 +1273,14 @@ def page_show_graph():
# height: title height
size = (int(((float(html.var("width")) - 49 - 5)/html_size_per_ex)),
int((float(html.var("height")) - 23)/html_size_per_ex))
- font_size = 11
- show_legend = True
+ font_size = 11
+ show_legend = True
+ graph_id_prefix = "dashlet_" + html.var("id")
else:
- size = (30, 10)
- font_size = 8
- show_legend = False
+ size = (30, 10)
+ font_size = 8
+ show_legend = False
+ graph_id_prefix = "hover"
if new_style_graphs_possible():
# FIXME HACK TODO We don't have the current perfata and check command
@@ -1302,7 +1304,7 @@ def page_show_graph():
# Render all graphs (e.g. for the hover menu)
htmlcode = render_time_graph(row, start_time, end_time, size=(30, 10),
font_size=8, show_legend=False,
show_controls=False,
- graph_id_prefix="hover")
+ resizable=False,
graph_id_prefix=graph_id_prefix)
else:
# render specific graph (e.g. for the dashlet)
perf_data_string, check_command, graph_templates =
find_possible_graphs(row)
@@ -1317,7 +1319,8 @@ def page_show_graph():
htmlcode = render_graph_html(row["site"], host_name,
service, perf_data_string,
check_command, graph_template,
start_time, end_time, size=size,
- show_controls=False, show_legend=False)
+ show_controls=False, show_legend=False,
+ resizable=False,
graph_id_prefix=graph_id_prefix)
if htmlcode:
html.write(htmlcode)
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index 161fd3c..660aa89 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -330,48 +330,6 @@ if (has_canvas_support()) {
# | Renders a single performance graph |
# '----------------------------------------------------------------------'
-def make_graph_url(dashlet, what):
- host = dashlet['context'].get('host')
- if not host:
- raise MKUserError('host', _('Missing needed host parameter.'))
-
- service = dashlet['context'].get('service')
- if not service:
- service = "_HOST_"
-
- # When the site is available via URL context, use it. Otherwise it is needed
- # to check all sites for the requested host
- if html.has_var('site'):
- site = html.var('site')
- else:
- html.live.set_prepend_site(True)
- query = "GET hosts\nFilter: name = %s\nColumns: name" % lqencode(host)
- site = html.live.query_column(query)[0]
- html.live.set_prepend_site(False)
-
- if not site:
- base_url = defaults.url_prefix
- else:
- base_url = html.site_status[site]["site"]["url_prefix"]
-
- # New graphs which have been added via "add to visual" option don't
have a timerange
- # configured. So we assume the default timerange here by default.
- timerange = dashlet.get('timerange', '1')
-
- # When the new style graphs can be rendered and this is not host graph, first
- # try the new style graphing system for rendering the dashlets graph
- import metrics
- if metrics.new_style_graphs_possible() and service != "_HOST_":
- return
"show_graph.py?site=%s&host_name=%s&service=%s&source=%s&timerange=%s&what=dashlet"
% \
- (site, host, service, dashlet['source'], timerange)
-
- # Fallback to PNP graph handling
- base_url += "pnp4nagios/index.php/"
- var_part =
"?host=%s&srv=%s&source=%d&view=%s&theme=multisite" % \
- (pnp_cleanup(dashlet['context']['host']),
pnp_cleanup(service),
- dashlet['source'], timerange)
- return base_url + what + var_part
-
def dashlet_graph(nr, dashlet):
html.write('<div id="dashlet_graph_%d"></div>' % (nr))
@@ -463,6 +421,7 @@ function dashboard_render_graph(nr, site, host_name, service, source,
timerange)
+"&timerange="+encodeURIComponent(timerange)
+"&width="+c_w
+"&height="+c_h
+ +"&id="+nr
+"&what=dashlet", {
response_handler : handle_dashboard_render_graph_response,
handler_data : nr,