[pve-devel] r4897 - in pve-manager/pve2/www/manager: . data

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Jul 14 12:28:06 CEST 2010


Author: dietmar
Date: 2010-07-14 10:28:06 +0000 (Wed, 14 Jul 2010)
New Revision: 4897

Added:
   pve-manager/pve2/www/manager/data/UpdateStore.js
Modified:
   pve-manager/pve2/www/manager/Makefile.am
   pve-manager/pve2/www/manager/PVECache.js
Log:
namespace cleanups


Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am	2010-07-14 10:22:13 UTC (rev 4896)
+++ pve-manager/pve2/www/manager/Makefile.am	2010-07-14 10:28:06 UTC (rev 4897)
@@ -3,10 +3,11 @@
 JSSRC= 				                 	\
 	../ext/extjs/examples/ux/MultiSelect.js	 	\
 	../ext/extjs/examples/ux/BufferView.js 		\
+	PVEUtils.js 					\
 	data/ObjectReader.js				\
 	data/ObjectStore.js				\
+	data/UpdateStore.js				\
 	grid/ObjectView.js				\
-	PVEUtils.js 					\
 	PVECache.js 					\
 	Workspace.js 					\
 	window/LoginWindow.js				\

Modified: pve-manager/pve2/www/manager/PVECache.js
===================================================================
--- pve-manager/pve2/www/manager/PVECache.js	2010-07-14 10:22:13 UTC (rev 4896)
+++ pve-manager/pve2/www/manager/PVECache.js	2010-07-14 10:28:06 UTC (rev 4897)
@@ -1,60 +1,5 @@
 Ext.ns("PVE");
 
-PVE.UpdateStore = Ext.extend(Ext.data.JsonStore, {
-
-    constructor: function(config) {
-	var that = this;
-
-	var load_task;
-
-	var run_load_task = function(delay) {
-	    if (!load_task) {
-		load_task = new Ext.util.DelayedTask(function() {
-		    //console.log("LOAD " + that.itype);
-		    that.load();
-		});
-	    }
-	    
-	    load_task.delay(delay === undefined ? that.interval : delay);
-	};
-
-        config = config || {};
-
-	if (!config.interval)
-	    config.interval = 3000;
-	    
-	if (!config.itype)
-	    throw "no itype specifued";
-
-	Ext.apply(config, {
-	    root: 'data',
-
-	    startUpdate: function() {
-		run_load_task(10);
-	    },
-
-	    listeners: {
-		beforeload: function() {
-		    if (!PVE.Utils.authOK()) {
-			run_load_task(1000);
-			return false;
-		    }
-		},
-		load: function() {
-		    run_load_task();
-		},
-		exception: function() {
-		    // fixme: what to do here ?
-		    //console.log("got load expection");
-		    run_load_task();
-		}
-	    }
-	});
-
-	PVE.UpdateStore.superclass.constructor.call(that, config);
-    }
-});
-
 PVE.SearchStore = Ext.extend(Ext.data.Store, {
 
     constructor: function(config) {
@@ -337,7 +282,7 @@
 	    var fields = PVE.Utils.get_field_defaults(['name', 'storage', 'cpu', 'maxcpu',
 						       'mem', 'maxmem', 'uptime']);
 
-	    var store = new PVE.UpdateStore({
+	    var store = new PVE.data.UpdateStore({
 		itype: 'node',
 		idProperty: 'name',
 		autoDestroy: false,
@@ -353,7 +298,7 @@
 
 	    var fields = PVE.Utils.get_field_defaults(['id', 'name', 'node', 'storage', 'cpu', 'maxcpu',
 						       'mem', 'maxmem', 'disk', 'maxdisk']);
-	    var store = new  PVE.UpdateStore({
+	    var store = new  PVE.data.UpdateStore({
 		itype: 'vm',
 		idProperty: 'id',
 		autoDestroy: false,
@@ -369,7 +314,7 @@
 
 	    var fields = PVE.Utils.get_field_defaults(['name', 'storage', 'node', 'shared', 'disk', 'maxdisk']);
 
-	    var store = new  PVE.UpdateStore({
+	    var store = new  PVE.data.UpdateStore({
 		itype: 'storage',
 		idProperty: 'name',
 		autoDestroy: false,

Added: pve-manager/pve2/www/manager/data/UpdateStore.js
===================================================================
--- pve-manager/pve2/www/manager/data/UpdateStore.js	                        (rev 0)
+++ pve-manager/pve2/www/manager/data/UpdateStore.js	2010-07-14 10:28:06 UTC (rev 4897)
@@ -0,0 +1,56 @@
+Ext.ns("PVE.data");
+
+PVE.data.UpdateStore = Ext.extend(Ext.data.JsonStore, {
+
+    constructor: function(config) {
+	var self = this;
+
+	var load_task;
+
+	var run_load_task = function(delay) {
+	    if (!load_task) {
+		load_task = new Ext.util.DelayedTask(function() {
+		    //console.log("LOAD " + self.itype);
+		    self.load();
+		});
+	    }
+	    
+	    load_task.delay(delay === undefined ? self.interval : delay);
+	};
+
+        config = config || {};
+
+	if (!config.interval)
+	    config.interval = 3000;
+	    
+	if (!config.itype)
+	    throw "no itype specifued";
+
+	Ext.apply(config, {
+	    root: 'data',
+
+	    startUpdate: function() {
+		run_load_task(10);
+	    },
+
+	    listeners: {
+		beforeload: function() {
+		    if (!PVE.Utils.authOK()) {
+			run_load_task(1000);
+			return false;
+		    }
+		},
+		load: function() {
+		    run_load_task();
+		},
+		exception: function() {
+		    // fixme: what to do here ?
+		    //console.log("got load expection");
+		    run_load_task();
+		}
+	    }
+	});
+
+	PVE.data.UpdateStore.superclass.constructor.call(self, config);
+    }
+});



More information about the pve-devel mailing list