Module: check_mk
Branch: master
Commit: c241a1b6562e71656c420f174ac37ab52d92d8c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c241a1b6562e71…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 25 10:40:18 2011 +0200
Added error handler for view update
---
web/htdocs/js/check_mk.js | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/web/htdocs/js/check_mk.js b/web/htdocs/js/check_mk.js
index d8246e0..cee3b14 100644
--- a/web/htdocs/js/check_mk.js
+++ b/web/htdocs/js/check_mk.js
@@ -608,26 +608,17 @@ function startReloadTimer(url) {
gReloadTimer = setTimeout("handleReload('" + url + "')",
Math.ceil(parseFloat(gReloadTime) * 1000));
}
+function handleContentReloadError(data, statusCode) {
+ var o = document.getElementById('data_container');
+ o.innerHTML = '<div class=error>Update failed (' + statusCode
+ + '). The shown data might be outdated</div>' +
o.innerHTML;
+ o = null;
+}
+
function handleContentReload(_unused, code) {
var o = document.getElementById('data_container');
o.innerHTML = code;
-
- // Need to fix javascript execution in innerHTML
- var aScripts = o.getElementsByTagName('script');
- for(var i in aScripts) {
- if(aScripts[i].src && aScripts[i].src !== '') {
- var oScr = document.createElement('script');
- oScr.src = aScripts[i].src;
- document.body.appendChild(oScr);
- oScr = null;
- } else {
- try {
- eval(aScripts[i].text);
- } catch(e) {
- alert(" Script error: " + aScripts[i].text);
- }
- }
- }
+ executeJS('data_container');
aScripts = null;
o = null;
@@ -662,7 +653,7 @@ function handleReload(url) {
var url = makeuri(params);
display_options = null;
- get_url(url, handleContentReload, '');
+ get_url(url, handleContentReload, '', handleContentReloadError);
url = null;
}
}