Module: check_mk
Branch: master
Commit: 53a567a36379826f433d0f692dc6f2d0c98a0c7a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=53a567a3637982…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Oct 26 12:03:41 2017 +0200
5419 Graphs can now be exported as PNG from the graph context menu
Change-Id: I673fb912188476b38bccf3119453ea0d374d3819
---
.werks/5419 | 10 ++++++++++
web/htdocs/js/checkmk.js | 4 ++--
web/htdocs/visuals.py | 6 +++++-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.werks/5419 b/.werks/5419
new file mode 100644
index 0000000..b525a98
--- /dev/null
+++ b/.werks/5419
@@ -0,0 +1,10 @@
+Title: Graphs can now be exported as PNG from the graph context menu
+Level: 1
+Component: metrics
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1509012187
+Class: feature
+
+
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index afcbab8..f60ca18 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -3269,13 +3269,13 @@ function pagetype_add_to_container(page_type, page_name)
});
}
-function graph_export()
+function graph_export(page)
{
var request = {
"specification":
popup_data[2]["definition"]["specification"],
"data_range": popup_data[2]["data_range"],
};
- location.href = "graph_export.py?request=" +
encodeURIComponent(JSON.stringify(request));
+ location.href = page + ".py?request=" +
encodeURIComponent(JSON.stringify(request));
}
//#.
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 19308f4..1b01ed6 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -1575,10 +1575,14 @@ def ajax_popup_add():
html.close_li()
html.open_li()
- html.open_a(href="javascript:graph_export()")
+
html.open_a(href="javascript:graph_export(\"graph_export\")")
html.img(src="images/icon_download.png")
html.write(_("Export as JSON"))
html.close_a()
+ html.open_a(href="javascript:graph_export(\"graph_image\")")
+ html.img(src="images/icon_download.png")
+ html.write(_("Export as PNG"))
+ html.close_a()
html.close_li()
html.close_ul()