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

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 3 14:22:42 CEST 2011


Author: dietmar
Date: 2011-05-03 14:22:42 +0200 (Tue, 03 May 2011)
New Revision: 5896

Added:
   pve-manager/pve2/www/new/form/StorageSelector.js
Modified:
   pve-manager/pve2/www/new/Makefile.am
   pve-manager/pve2/www/new/qemu/CreateWizard.js
Log:
impl. StorageSelector.js


Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am	2011-05-03 09:03:17 UTC (rev 5895)
+++ pve-manager/pve2/www/new/Makefile.am	2011-05-03 12:22:42 UTC (rev 5896)
@@ -12,6 +12,7 @@
 	data/ResourceStore.js				\
 	form/RealmComboBox.js				\
 	form/ViewSelector.js				\
+	form/StorageSelector.js				\
 	panel/StatusPanel.js				\
 	window/LoginWindow.js				\
 	window/Wizard.js				\

Added: pve-manager/pve2/www/new/form/StorageSelector.js
===================================================================
--- pve-manager/pve2/www/new/form/StorageSelector.js	                        (rev 0)
+++ pve-manager/pve2/www/new/form/StorageSelector.js	2011-05-03 12:22:42 UTC (rev 5896)
@@ -0,0 +1,106 @@
+Ext.define('PVE.form.StorageSelector', {
+    extend: 'Ext.form.ComboBox',
+    requires: [
+	'Ext.data.Store', 
+	'PVE.RestProxy'
+    ],
+    alias: ['widget.PVE.form.StorageSelector'],
+
+    createPicker: function() {
+        var me = this,
+        picker,
+        menuCls = Ext.baseCSSPrefix + 'menu',
+        opts = Ext.apply({
+            selModel: {
+                mode: me.multiSelect ? 'SIMPLE' : 'SINGLE'
+            },
+            floating: true,
+            hidden: true,
+            ownerCt: me.ownerCt,
+            cls: me.el.up('.' + menuCls) ? menuCls : '',
+            store: me.store,
+            displayField: me.displayField,
+            focusOnToFront: false,
+            pageSize: me.pageSize
+        }, me.listConfig, me.defaultListConfig);
+
+        //picker = me.picker = Ext.create('Ext.view.BoundList', opts);
+	picker = me.picker = Ext.create('Ext.grid.Panel', opts);
+
+        me.mon(picker, {
+            itemclick: me.onItemClick,
+            refresh: me.onListRefresh,
+            scope: me
+        });
+
+        me.mon(picker.getSelectionModel(), {
+            selectionChange: me.onListSelectionChange,
+            scope: me
+        });
+
+        return picker;
+    },
+
+    initComponent: function() {
+	var me = this;
+
+	var nodename = me.nodename;
+
+	nodename = 'maui';
+
+	var store = Ext.create('Ext.data.Store', {
+	    fields: [ 'storage', 'active', 'type', 'used', 'total' ],
+	    proxy: {
+		type: 'pve',
+		url: '/api2/json/nodes/' + nodename + '/storage'
+	    },
+	    autoDestory: true
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    queryMode: 'local',
+	    allowBlank: false,
+	    forceSelection: true,
+	    editable: false,
+	    typeAhead: false, // does not work wit grid
+	    autoSelect: false, // does not work wit grid
+	    valueField: 'storage',
+	    displayField: 'storage',
+	    matchFieldWidth: false,
+            listConfig: {
+		width: 400,
+		columns: [
+		    {
+			header: 'Name',
+			dataIndex: 'storage',
+			sortable: false,
+			hideable: false,
+			flex: 1
+		    },
+		    {
+			header: 'Type',  
+			width: 60, 
+			dataIndex: 'type'
+		    },
+		    {
+			header: 'Used',  
+			width: 60, 
+			dataIndex: 'used', 
+			renderer: PVE.Utils.format_size 
+		    },
+		    {
+			header: 'Capacity',  
+			width: 60, 
+			dataIndex: 'total', 
+			renderer: PVE.Utils.format_size 
+		    }
+		]
+	    }
+ 	});
+
+        me.callParent();
+
+	store.load();
+    }
+});
\ No newline at end of file

Modified: pve-manager/pve2/www/new/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-03 09:03:17 UTC (rev 5895)
+++ pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-03 12:22:42 UTC (rev 5896)
@@ -119,6 +119,53 @@
 		    }
 		},
 		{
+		    title: 'Installation Media',
+		    items: [
+			{
+			    xtype: 'radiofield',
+			    name: 'mediaType',
+			    inputValue: 'iso',
+			    boxLabel: 'Use CD/DVD disc image file (iso)',
+			   // hideLabel: true,
+			    //checked: true
+ 
+			},
+			{
+			    xtype: 'PVE.form.StorageSelector',
+			    name: 'cdstorage',
+			    fieldLabel: 'Storage',
+			    labelAlign: 'right',
+			    //disabled: true,
+			    allowBlank: false
+			},
+			{
+			    xtype: 'textfield',
+			    name: 'cdimage',
+			    fieldLabel: 'ISO Image',
+			    labelAlign: 'right',
+			    disabled: true,
+			    allowBlank: false
+			},
+			{
+			    xtype: 'radiofield',
+			    name: 'mediaType',
+			    inputValue: 'cdrom',
+			    boxLabel: 'Use physical CD/DVD Drive',
+			   // hideLabel: true,
+			    //checked: true
+ 
+			},
+			{
+			    xtype: 'radiofield',
+			    name: 'mediaType',
+			    inputValue: 'none',
+			    boxLabel: 'Do not use any installation media',
+			   // hideLabel: true,
+			    //checked: true
+			}
+		    ]
+		},
+		{
 		    title: 'CPU',
 		    items: [
 			{
@@ -207,49 +254,6 @@
 		    ]
 		},
 		{
-		    title: 'Installation Media',
-		    items: [
-			{
-			    xtype: 'radiofield',
-			    name: 'mediaType',
-			    inputValue: 'iso',
-			    boxLabel: 'Use CD/DVD disc image file (iso)',
-			   // hideLabel: true,
-			    //checked: true
- 
-			},
-			{
-			    xtype: 'textfield',
-			    name: 'cdstorage',
-			    fieldLabel: 'Storage',
-			    allowBlank: false
-			},
-			{
-			    xtype: 'textfield',
-			    name: 'cdimage',
-			    fieldLabel: 'ISO Image',
-			    allowBlank: false
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'mediaType',
-			    inputValue: 'cdrom',
-			    boxLabel: 'Use physical CD/DVD Drive',
-			   // hideLabel: true,
-			    //checked: true
- 
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'mediaType',
-			    inputValue: 'none',
-			    boxLabel: 'Do not use any installation media',
-			   // hideLabel: true,
-			    //checked: true
-			}
-		    ]
-		},
-		{
 		    title: 'Confirm',
 		    listeners: {
 			show: function() {




More information about the pve-devel mailing list