[pve-devel] r5915 - in pve-manager/pve2/www/new: . form qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Fri May 6 10:13:48 CEST 2011


Author: dietmar
Date: 2011-05-06 10:13:48 +0200 (Fri, 06 May 2011)
New Revision: 5915

Added:
   pve-manager/pve2/www/new/form/BusTypeSelector.js
   pve-manager/pve2/www/new/form/DiskFormatSelector.js
   pve-manager/pve2/www/new/form/NetworkCardSelector.js
Modified:
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/qemu/CreateWizard.js
Log:
factor out combobox code


Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	2011-05-06 06:30:32 UTC (rev 5914)
+++ pve-manager/pve2/www/new/Makefile.am	2011-05-06 08:13:48 UTC (rev 5915)
@@ -11,6 +11,9 @@
 	data/ObjectStore.js				\
 	data/ResourceStore.js				\
 	form/ComboGrid.js				\
+	form/NetworkCardSelector.js			\
+	form/DiskFormatSelector.js			\
+	form/BusTypeSelector.js				\
 	form/RealmComboBox.js				\
 	form/ViewSelector.js				\
 	form/NodeSelector.js				\

Added: pve-manager/pve2/www/new/form/BusTypeSelector.js
===================================================================
--- pve-manager/pve2/www/new/form/BusTypeSelector.js	                        (rev 0)
+++ pve-manager/pve2/www/new/form/BusTypeSelector.js	2011-05-06 08:13:48 UTC (rev 5915)
@@ -0,0 +1,27 @@
+Ext.define('PVE.form.BusTypeSelector', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: ['widget.PVE.form.BusTypeSelector'],
+  
+    initComponent: function() {
+	var me = this;
+
+	var store = Ext.create('Ext.data.ArrayStore', {
+	    model: 'KeyValue',
+            data : [ 
+		['ide', 'IDE'], 
+		['virtio', 'VIRTIO'],
+		['scsi', 'SCSI']
+	    ]
+        });
+
+	Ext.apply(me, {
+	    store: store,
+	    queryMode: 'local',
+	    editable: false,
+	    displayField: 'value',
+	    valueField: 'key'
+	});
+
+	me.callParent();
+    }
+});

Added: pve-manager/pve2/www/new/form/DiskFormatSelector.js
===================================================================
--- pve-manager/pve2/www/new/form/DiskFormatSelector.js	                        (rev 0)
+++ pve-manager/pve2/www/new/form/DiskFormatSelector.js	2011-05-06 08:13:48 UTC (rev 5915)
@@ -0,0 +1,27 @@
+Ext.define('PVE.form.DiskFormatSelector', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: ['widget.PVE.form.DiskFormatSelector'],
+  
+    initComponent: function() {
+	var me = this;
+
+	var store = Ext.create('Ext.data.ArrayStore', {
+	    model: 'KeyValue',
+            data : [ 
+		['raw', 'Raw disk image (raw)'], 
+		['qcow2', 'QEMU image format (qcow2)'],
+		['vmdk', 'VMware image format (vmdk)']
+	    ]
+        });
+
+	Ext.apply(me, {
+	    store: store,
+	    queryMode: 'local',
+	    editable: false,
+	    displayField: 'value',
+	    valueField: 'key'
+	});
+
+	me.callParent();
+    }
+});

Added: pve-manager/pve2/www/new/form/NetworkCardSelector.js
===================================================================
--- pve-manager/pve2/www/new/form/NetworkCardSelector.js	                        (rev 0)
+++ pve-manager/pve2/www/new/form/NetworkCardSelector.js	2011-05-06 08:13:48 UTC (rev 5915)
@@ -0,0 +1,27 @@
+Ext.define('PVE.form.NetworkCardSelector', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: ['widget.PVE.form.NetworkCardSelector'],
+  
+    initComponent: function() {
+	var me = this;
+
+	var store = Ext.create('Ext.data.ArrayStore', {
+	    model: 'KeyValue',
+            data : [ 
+		['rtl8139', 'Realtec RTL8139'], 
+		['e1000', 'Intel E1000'],
+		['virtio', 'VirtIO (paravirtualized)']
+	    ]
+        });
+
+	Ext.apply(me, {
+	    store: store,
+	    queryMode: 'local',
+	    editable: false,
+	    displayField: 'value',
+	    valueField: 'key'
+	});
+
+	me.callParent();
+    }
+});

Modified: pve-manager/pve2/www/new/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-06 06:30:32 UTC (rev 5914)
+++ pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-06 08:13:48 UTC (rev 5915)
@@ -1,4 +1,3 @@
-
 Ext.define('PVE.qemu.CreateWizard', {
     extend: 'PVE.window.Wizard',
     requires: [    
@@ -9,33 +8,6 @@
     initComponent: function() {
 	var me = this;
 
-	cardTypeStore = Ext.create('Ext.data.ArrayStore', {
-            fields: ['key'],
-            data : [ 
-		['rtl8139'], 
-		['e1000'],
-		['virtio']
-	    ]
-        });
-
-	diskTypeStore = Ext.create('Ext.data.ArrayStore', {
-            fields: ['key', 'value'],
-            data : [ 
-		['ide', 'IDE'], 
-		['virtio', 'VIRTIO'],
-		['scsi', 'SCSI']
-	    ]
-        });
-
-	diskFormatStore = Ext.create('Ext.data.ArrayStore', {
-            fields: ['key'],
-            data : [ 
-		['raw'], 
-		['qcow2'],
-		['vmdk']
-	    ]
-        });
-
 	var nextvmid = PVE.data.ResourceStore.findNextVMID();
 
 	var cdfilesel = Ext.create('PVE.form.FileSelector', {
@@ -236,27 +208,17 @@
 			    allowBlank: false
 			},
 			{
-			    xtype: 'combobox',
+			    xtype: 'PVE.form.BusTypeSelector',
 			    name: 'controller',
 			    fieldLabel: 'Controller',
-			    store: diskTypeStore,
-			    queryMode: 'local',
-			    editable: false,
 			    value: 'ide',
-			    displayField: 'value',
-			    valueField: 'key',
 			    allowBlank: false
 			},
 			{
-			    xtype: 'combobox',
+			    xtype: 'PVE.form.DiskFormatSelector',
 			    name: 'diskformat',
 			    fieldLabel: 'Image format',
-			    store: diskFormatStore,
-			    queryMode: 'local',
-			    editable: false,
 			    value: 'raw',
-			    displayField: 'key',
-			    valueField: 'key',
 			    allowBlank: false
 			}
 		    ],
@@ -321,15 +283,10 @@
 			    allowBlank: false
 			},
 			{
-			    xtype: 'combobox',
+			    xtype: 'PVE.form.NetworkCardSelector',
 			    name: 'netcard',
 			    fieldLabel: 'Network card',
-			    store: cardTypeStore,
-			    queryMode: 'local',
-			    editable: false,
 			    value: 'rtl8139',
-			    displayField: 'key',
-			    valueField: 'key',
 			    allowBlank: false
 			},
 			{




More information about the pve-devel mailing list