Module: check_mk
Branch: master
Commit: a364a3f6388c300cefb276a5b8187bdcaf371510
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a364a3f6388c30…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 17:29:33 2016 +0100
#3035 FIX Fixed broken graph preview when hovering graph icon in Check_MK Raw Edition
---
.werks/3035 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/js/checkmk.js | 32 +++++++++++++++++++-------------
web/plugins/icons/builtin.py | 2 +-
4 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/.werks/3035 b/.werks/3035
new file mode 100644
index 0000000..cb62d77
--- /dev/null
+++ b/.werks/3035
@@ -0,0 +1,9 @@
+Title: Fixed broken graph preview when hovering graph icon in Check_MK Raw Edition
+Level: 2
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453912145
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index b128181..38b3966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -275,6 +275,7 @@
* 2968 FIX: Closing quicksearch results when moving mouse out of sidebar area
* 2969 FIX: Fixed folding of sidebar in Google Chrome
* 2970 FIX: Users now allowed to modify the sidebar (e.g. guests) can now not fold
snapins anymore
+ * 3035 FIX: Fixed broken graph preview when hovering graph icon in Check_MK Raw
Edition
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 072da4d..c079ce7 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -830,24 +830,30 @@ function hover_graph(site, host_name, service)
+'&service='+encodeURIComponent(service));
if (c.indexOf('pnp4nagios') !== -1) {
- // fallback to pnp graph handling
- var c = get_url_sync(c);
- // It is possible that, if using multisite based authentication, pnp sends a 302
redirect
- // to the login page which is transparently followed by XmlHttpRequest. There is
no chance
- // to catch the redirect. So we try to check the response content. If it does not
contain
- // the expected code, simply display an error message.
- if (c.indexOf('/image?') === -1) {
- // Error! unexpected response
- c = '<div class="error"> '
- + 'ERROR: Received an unexpected response '
- + 'while trying to display the PNP-Graphs. Maybe there is a problem
with the '
- + 'authentication.</div>';
- }
+ // fallback to pnp graph handling (received an URL by the get_url_sync())
+ return fetch_pnp_hover_contents(c);
}
return c;
}
+function fetch_pnp_hover_contents(url)
+{
+ var c = get_url_sync(url);
+ // It is possible that, if using multisite based authentication, pnp sends a 302
redirect
+ // to the login page which is transparently followed by XmlHttpRequest. There is no
chance
+ // to catch the redirect. So we try to check the response content. If it does not
contain
+ // the expected code, simply display an error message.
+ if (c.indexOf('/image?') === -1) {
+ // Error! unexpected response
+ c = '<div class="error"> '
+ + 'ERROR: Received an unexpected response '
+ + 'while trying to display the PNP-Graphs. Maybe there is a problem with
the '
+ + 'authentication.</div>';
+ }
+ return c;
+}
+
//#.
//# .-Reschedule---------------------------------------------------------.
//# | ____ _ _ _ |
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index e39837a..7f41124 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -356,7 +356,7 @@ def pnp_icon(row, what):
if not metrics.cmk_graphs_possible():
# Directly ask PNP for all data, don't try to use the new graph fetching
mechanism
# to keep the number of single requests low
- hover_content_func = 'pnp_hover_contents(\'%s\')' %
pnp_popup_url(row, what)
+ hover_content_func = 'fetch_pnp_hover_contents(\'%s\')' %
pnp_popup_url(row, what)
else:
hover_content_func = 'hover_graph(\'%s\', \'%s\',
\'%s\')' % \
(row['site'], row['host_name'],
row.get('service_description', '_HOST_').replace("\\",
"\\\\"))