[icinga-checkins] icinga.org: icinga-web/master: * Added 'cancelOn' parameter to Ajax requests and added beforeload to reload items ( fixes #1945)

git at icinga.org git at icinga.org
Mon Feb 20 18:48:39 CET 2012


Module: icinga-web
Branch: master
Commit: 06dbdf0b65f613afa663c4beaf14db40f38e2612
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=06dbdf0b65f613afa663c4beaf14db40f38e2612

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Mon Feb 20 18:47:48 2012 +0100

* Added 'cancelOn' parameter to Ajax requests and added beforeload to reload items (fixes #1945)

---

 app/modules/AppKit/lib/js/request/Ajax.js          |   11 +++++++++--
 .../renderer/AdvancedHostStatusColumnRenderer.js   |    4 ++++
 .../lib/js/grid/renderer/CommentColumnRenderer.js  |    4 ++++
 .../lib/js/grid/renderer/InfoIconColumnRenderer.js |    4 ++++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/app/modules/AppKit/lib/js/request/Ajax.js b/app/modules/AppKit/lib/js/request/Ajax.js
index c931c5a..62c53cb 100644
--- a/app/modules/AppKit/lib/js/request/Ajax.js
+++ b/app/modules/AppKit/lib/js/request/Ajax.js
@@ -1,9 +1,16 @@
 Ext.Ajax.request = function(o) {
+    var req = null;
     if(!o.icingaAction || !o.icingaModule) {
-        return this.directRequest(o);
+        req = this.directRequest(o);
     } else {
-        return this.dispatchRequest(o);
+        req = this.dispatchRequest(o);
     }
+    if(Ext.isObject(o.cancelOn)) {
+        o.cancelOn.component.on(o.cancelOn.event,function() {
+            Ext.data.Connection.prototype.abort.call(this,req);
+        });
+    }
+    return req;
 };
 
 Ext.Ajax.directRequest = function(o) {
diff --git a/app/modules/Cronks/lib/js/grid/renderer/AdvancedHostStatusColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/AdvancedHostStatusColumnRenderer.js
index 0ab321c..1f24ddb 100644
--- a/app/modules/Cronks/lib/js/grid/renderer/AdvancedHostStatusColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/AdvancedHostStatusColumnRenderer.js
@@ -46,6 +46,10 @@ Cronk.grid.AdvancedHostStatusColumnRenderer = new (function () {
         // REST Call
         Ext.Ajax.request({
             url: AppKit.c.path+"/web/api/json",
+            cancelOn: {
+                component: grid.getStore(),
+                event: 'beforeload'
+            },
             params: {
                 target: 'service_status_summary', 
                 "columns[0]": "host_object_id",
diff --git a/app/modules/Cronks/lib/js/grid/renderer/CommentColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/CommentColumnRenderer.js
index 8747e08..aae8519 100644
--- a/app/modules/Cronks/lib/js/grid/renderer/CommentColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/CommentColumnRenderer.js
@@ -57,6 +57,10 @@ Cronk.grid.CommentColumnRenderer = new (function () {
 
     var requestComments = function(grid,field,ids) {
         Ext.Ajax.request({
+            cancelOn: {
+                component: grid.getStore(),
+                event: 'beforeload'
+            },
             url: AppKit.c.path+"/web/api/json",
             params: {
                 target: 'comment',
diff --git a/app/modules/Cronks/lib/js/grid/renderer/InfoIconColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/InfoIconColumnRenderer.js
index 69f7705..3728cb1 100644
--- a/app/modules/Cronks/lib/js/grid/renderer/InfoIconColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/InfoIconColumnRenderer.js
@@ -66,6 +66,10 @@ Cronk.grid.InfoIconColumnRenderer = new (function () {
 			type = test[1];
 			
 			Ext.Ajax.request({
+                cancelOn: {
+                    component: this.grid.getStore(),
+                    event: 'beforeload'
+                },
 				url : AppKit.util.Config.get('path') + '/modules/appkit/dispatch',
 				params : {
 					module : 'Cronks',





More information about the icinga-checkins mailing list