[pve-devel] [PATCH 6/6] Gui storage: change input method

Wolfgang Link w.link at proxmox.com
Mon Jan 26 12:56:43 CET 2015


change input method in Add:ZFS Storage at ZFS Pool from string to combobox.

Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
 www/manager/storage/ZFSPoolEdit.js |   37 ++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/www/manager/storage/ZFSPoolEdit.js b/www/manager/storage/ZFSPoolEdit.js
index 3ee1a7a..372f70a 100644
--- a/www/manager/storage/ZFSPoolEdit.js
+++ b/www/manager/storage/ZFSPoolEdit.js
@@ -11,17 +11,17 @@ Ext.define('PVE.storage.ZFSPoolSelector', {
 
 	var store = Ext.create('Ext.data.Store', {
 	    autoLoad: {}, // true,
-	    fields: [ 'vg', 'size', 'free' ],
+	    fields: [ 'pool', 'size', 'free' ],
 	    proxy: {
 		type: 'pve',
-		url: '/api2/json/nodes/' + me.nodename + '/scan/lvm'
+		url: '/api2/json/nodes/' + me.nodename + '/scan/zfs'
 	    }
 	});
 
 	Ext.apply(me, {
 	    store: store,
-	    valueField: 'vg',
-	    displayField: 'vg',
+	    valueField: 'pool',
+	    displayField: 'pool',
 	    queryMode: 'local',
 	    editable: false,
 	    listConfig: {
@@ -72,17 +72,30 @@ Ext.define('PVE.storage.ZFSPoolInputPanel', {
 		fieldLabel: 'ID',
 		vtype: 'StorageId',
 		allowBlank: false
-	    },
-	    {
-		xtype: me.create ? 'textfield' : 'displayfield',
-		name: 'pool',
-		height: 22, // hack: set same height as text fields
-		value: '',
-		fieldLabel: gettext('Pool'),
-		allowBlank: false
 	    }
 	];
 
+	var zfspoolnameField = Ext.createWidget(me.create ? 'textfield' : 'displayfield', {
+	    height: 22, // hack: set same height as text fields
+	    name: 'poolname',
+	    hidden: !!me.create,
+	    disabled: !!me.create,
+	    value: '',
+	    fieldLabel: gettext('ZFS Pool'),
+	    allowBlank: false
+	});
+	
+	if (me.create) {
+	    var zfspoolField = Ext.create('PVE.storage.ZFSPoolSelector', {
+		name: 'pool',
+		fieldLabel: gettext('ZFS Pool'),
+		allowBlank: false
+	    });
+	    me.column1.push(zfspoolField);
+	}
+
+	me.column1.push(zfspoolnameField);
+
 	me.column2 = [
 	    {
 		xtype: 'pvecheckbox',
-- 
1.7.10.4




More information about the pve-devel mailing list