[pve-devel] r6207 - in pve-manager/pve2/www/manager: node window

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Jun 30 10:01:24 CEST 2011


Author: dietmar
Date: 2011-06-30 10:01:24 +0200 (Thu, 30 Jun 2011)
New Revision: 6207

Modified:
   pve-manager/pve2/www/manager/node/DNSEdit.js
   pve-manager/pve2/www/manager/node/NetworkEdit.js
   pve-manager/pve2/www/manager/node/TimeEdit.js
   pve-manager/pve2/www/manager/window/Edit.js
Log:
facort out load() code


Modified: pve-manager/pve2/www/manager/node/DNSEdit.js
===================================================================
--- pve-manager/pve2/www/manager/node/DNSEdit.js	2011-06-30 07:50:05 UTC (rev 6206)
+++ pve-manager/pve2/www/manager/node/DNSEdit.js	2011-06-30 08:01:24 UTC (rev 6207)
@@ -12,11 +12,6 @@
 	var nodename = me.pveSelNode.data.node;
 	if (!nodename) 
 	    throw "no node name specified";
-
-	//fieldDefaults: {
-	//	labelWidth: 130,
-	//	anchor: '100%'
-        //  },
 	
 	me.items = [
 	    {
@@ -58,15 +53,6 @@
 
 	me.callParent();
 
-	me.down('form').load({
-	    method: 'GET',
-	    failure: function(form, action) {
-		var msg = PVE.Utils.extractFormActionError(action);
-		Ext.Msg.alert("Load failed", msg, function() {
-		    me.close();
-		});
-	    }
-	});
-
+	me.load();
     }
 });

Modified: pve-manager/pve2/www/manager/node/NetworkEdit.js
===================================================================
--- pve-manager/pve2/www/manager/node/NetworkEdit.js	2011-06-30 07:50:05 UTC (rev 6206)
+++ pve-manager/pve2/www/manager/node/NetworkEdit.js	2011-06-30 08:01:24 UTC (rev 6207)
@@ -129,14 +129,7 @@
 	if (create) {
 	    me.down('field[name=iface]').setValue(me.iface_default);
 	} else {
-	    me.down('form').load({
-		method: 'GET',
-		failure: function(form, action) {
-		    var msg = PVE.Utils.extractFormActionError(action);
-		    Ext.Msg.alert("Load failed", msg, function() {
-			me.close();
-		    });
-		},
+	    me.load({
 		success: function(form, action) {
 		    if (action.result.data.type !== me.iftype) {
 			var msg = "Got unexpected device type";
@@ -148,6 +141,5 @@
 		}
 	    });
 	}
-
     }
 });

Modified: pve-manager/pve2/www/manager/node/TimeEdit.js
===================================================================
--- pve-manager/pve2/www/manager/node/TimeEdit.js	2011-06-30 07:50:05 UTC (rev 6206)
+++ pve-manager/pve2/www/manager/node/TimeEdit.js	2011-06-30 08:01:24 UTC (rev 6207)
@@ -34,15 +34,6 @@
 
 	me.callParent();
 
-	me.down('form').load({
-	    method: 'GET',
-	    failure: function(form, action) {
-		var msg = PVE.Utils.extractFormActionError(action);
-		Ext.Msg.alert("Load failed", msg, function() {
-		    me.close();
-		});
-	    }
-	});
-
+	me.load();
     }
 });

Modified: pve-manager/pve2/www/manager/window/Edit.js
===================================================================
--- pve-manager/pve2/www/manager/window/Edit.js	2011-06-30 07:50:05 UTC (rev 6206)
+++ pve-manager/pve2/www/manager/window/Edit.js	2011-06-30 08:01:24 UTC (rev 6207)
@@ -3,6 +3,21 @@
 
     resizable: false,
 
+    load: function(options) {
+	var me = this;
+
+	var newopts = Ext.apply({}, options, {
+	    method: 'GET',
+	    failure: function(form, action) {
+		var msg = PVE.Utils.extractFormActionError(action);
+		Ext.Msg.alert("Load failed", msg, function() {
+		    me.close();
+		});
+	    }
+	});
+        me.down('form').load(newopts);
+    },
+
     initComponent : function() {
 	var me = this;
 




More information about the pve-devel mailing list