[pve-devel] r5689 - pve-manager/pve2/www/manager

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Mar 14 06:23:44 CET 2011


Author: dietmar
Date: 2011-03-14 06:23:44 +0100 (Mon, 14 Mar 2011)
New Revision: 5689

Modified:
   pve-manager/pve2/www/manager/NodeConfig.js
Log:
cancel pending refresh


Modified: pve-manager/pve2/www/manager/NodeConfig.js
===================================================================
--- pve-manager/pve2/www/manager/NodeConfig.js	2011-03-14 05:02:23 UTC (rev 5688)
+++ pve-manager/pve2/www/manager/NodeConfig.js	2011-03-14 05:23:44 UTC (rev 5689)
@@ -1141,7 +1141,7 @@
 		if (state && state.id) {
 		    self.timeframe = state.timeframe;
 		    self.rrdcffn = state.cf;
-		    self.reload.defer(10, self);
+		    self.reload_task.delay(10);
 		}
 	    }
 
@@ -1149,8 +1149,7 @@
 	
 	PVE.RRDGraph.superclass.initComponent.call(self);
 
-	self.reload = function() {
-	    //console.log("RELOAD");
+	self.reload_task = new Ext.util.DelayedTask(function() {
 	    if (self.rendered) {
 		try {
 		    var html = {
@@ -1161,23 +1160,27 @@
 		    };
 		    self.update(html);
 		} catch (e) {
-		    // console.log(e);
+		    console.log(e);
 		}
-		self.reload.defer(30000, self);
+		self.reload_task.delay(30000);
 	    } else {
-		self.reload.defer(1000, self);
+		self.reload_task.delay(1000);
 	    }
-	};
+	});
 
-	self.reload.defer(30000, self);
+	self.reload_task.delay(30000);
 
+	self.on('destroy', function() {
+	    self.reload_task.cancel();
+	});
+
 	var sp = Ext.state.Manager.getProvider();
 
 	var state_change_fn = function(prov, key, value) {
 	    if (key == stateid) {
 		self.timeframe = value.timeframe;
 		self.rrdcffn = value.cf;
-		self.reload.defer(10, self);
+		self.reload_task.delay(10);
 	    }
 	};
 



More information about the pve-devel mailing list