Module: check_mk
Branch: master
Commit: 7394d401656bebecf1239f9b9a88d57224210513
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7394d401656beb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 27 12:42:27 2010 +0100
Fixed reloading button animation in Chrome (Changed request to async mode)
---
.bugs/10 | 11 ++++++++---
ChangeLog | 1 +
web/htdocs/js/check_mk.js | 24 ++++++++++++++++--------
web/plugins/views/painters.py | 2 +-
4 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/.bugs/10 b/.bugs/10
index 3306b0b..a3023ff 100644
--- a/.bugs/10
+++ b/.bugs/10
@@ -1,10 +1,15 @@
Title: Multisite mit Chrome kompatible machen
Component: multisite
+State: done
+Class: bug
+Date: 2010-12-21 11:01:49
Benefit: 1
-State: open
Cost: 2
-Date: 2010-12-21 11:01:49
-Class: bug
+Fun: 0
Bekannte Probleme:
* reschedule Knopf wird nicht animiert
+
+2010-12-27 12:41:36: changed state open -> done
+Animated gif images are stopped duing sync ajax requests in chrome. So the reloading
image is not rotating.
+Switched the request to async ajax request.
diff --git a/ChangeLog b/ChangeLog
index 130dc30..4abb610 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
and services
* Sidebar: Fixed snapin movement to the bottom of the snapin list in Opera
* Sidebar: Fixed scroll position saving in Opera
+ * Fixed reloading button animation in Chrome (Changed request to async mode)
Checks & Agents:
* Fixed problem with OnlyFrom: in Linux agent (df didn't work properly)
diff --git a/web/htdocs/js/check_mk.js b/web/htdocs/js/check_mk.js
index ee8528f..ded9a04 100644
--- a/web/htdocs/js/check_mk.js
+++ b/web/htdocs/js/check_mk.js
@@ -204,15 +204,12 @@ function render_pnp_graphs(container, site, host, service, pnpview,
base_url, pn
// Everything else:
// <undefined> - Unknown format. Simply echo.
-function performAction(oLink, action, type, site, name1, name2) {
- var oImg = oLink.childNodes[0];
- oImg.src = 'images/icon_reloading.gif';
-
+function actionResponseHandler(oImg, code) {
var validResponse = true;
- var response =
get_url_sync('nagios_action.py?action='+action+'&site='+site+'&host='+name1+'&service='+name2);
+ var response = null;
try {
- response = eval(response);
+ response = eval(code);
} catch(e) {
validResponse = false;
}
@@ -231,7 +228,18 @@ function performAction(oLink, action, type, site, name1, name2) {
oImg.title = 'Invalid response: ' + response;
}
- validResponse = null;
- response = null;
+ response = null;
+ validResponse = null;
+ oImg = null;
+}
+
+function performAction(oLink, action, type, site, name1, name2) {
+ var oImg = oLink.childNodes[0];
+ oImg.src = 'images/icon_reloading.gif';
+
+ // Chrome is not animating the gif during sync ajax request
+ // So better use the async request here
+
get_url('nagios_action.py?action='+action+'&site='+site+'&host='+name1+'&service='+name2,
+ actionResponseHandler, oImg);
oImg = null;
}
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index e4c90a4..6031e20 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -259,7 +259,7 @@ def paint_icons(what, row): # what is "host" or
"service"
name2 = row['service_description']
output += '<a href=\"#\" onclick="performAction(this,
\'reschedule\', \'%s\', \'%s\', \'%s\',
\'%s\');">' \
'<img class=icon title="Reschedule an immediate check of
this %s" ' \
- 'src="images/icon_reload.gif"></a>' % (what,
row["site"], row["host_name"], name2, what)
+ 'src="images/icon_reload.gif" /></a>' %
(what, row["site"], row["host_name"], name2, what)
return "icons", output