[pve-devel] [PATCH pve-manager 3/3] move component properties to prototype body

Emmanuel Kasper e.kasper at proxmox.com
Mon Feb 29 16:29:37 CET 2016


this is needed for 'displayField'

also remove redundant truthiness test which is also
taking place at the beginning of setNodeName()
---
 www/manager6/form/BridgeSelector.js | 66 +++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 36 deletions(-)

diff --git a/www/manager6/form/BridgeSelector.js b/www/manager6/form/BridgeSelector.js
index 945a2d2..72cbfea 100644
--- a/www/manager6/form/BridgeSelector.js
+++ b/www/manager6/form/BridgeSelector.js
@@ -4,6 +4,35 @@ Ext.define('PVE.form.BridgeSelector', {
 
     bridgeType: 'any_bridge', // bridge, OVSBridge or any_bridge
 
+    store: {
+	fields: [ 'iface', 'active', 'type' ],
+	filterOnLoad: true,
+	sorters: [
+	    {
+		property : 'iface',
+		direction: 'ASC'
+	    }
+	]
+    },
+    valueField: 'iface',
+    displayField: 'iface',
+    listConfig: {
+	columns: [
+	    {
+		header: gettext('Bridge'),
+		dataIndex: 'iface',
+		hideable: false,
+		flex: 1
+	    },
+	    {
+		header: gettext('Active'),
+		width: 60,
+		dataIndex: 'active',
+		renderer: PVE.Utils.format_boolean
+	    }
+	]
+    },
+
     setNodename: function(nodename) {
 	var me = this;
 
@@ -28,44 +57,9 @@ Ext.define('PVE.form.BridgeSelector', {
 	var nodename = me.nodename;
 	me.nodename = undefined; 
 
-	var store = Ext.create('Ext.data.Store', {
-	    fields: [ 'iface', 'active', 'type' ],
-	    filterOnLoad: true,
-	    sorters: [
-		{
-		    property : 'iface',
-		    direction: 'ASC'
-		}
-	    ]
-	});
-
-	Ext.apply(me, {
-	    store: store,
-	    valueField: 'iface',
-	    displayField: 'iface',
-            listConfig: {
-		columns: [
-		    {
-			header: gettext('Bridge'),
-			dataIndex: 'iface',
-			hideable: false,
-			flex: 1
-		    },
-		    {
-			header: gettext('Active'),  
-			width: 60, 
-			dataIndex: 'active', 
-			renderer: PVE.Utils.format_boolean
-		    }
-		]
-	    }
-	});
-
         me.callParent();
 
-	if (nodename) {
-	    me.setNodename(nodename);
-	}
+	me.setNodename(nodename);
     }
 });
 
-- 
2.1.4





More information about the pve-devel mailing list