[pve-devel] [PATCH 5/6] Gui storage: copy selector methode

Wolfgang Link w.link at proxmox.com
Mon Jan 26 12:35:13 CET 2015


from LVMEdit.js to ZFSPoolEdit.js

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

diff --git a/www/manager/storage/ZFSPoolEdit.js b/www/manager/storage/ZFSPoolEdit.js
index 60d52dc..3ee1a7a 100644
--- a/www/manager/storage/ZFSPoolEdit.js
+++ b/www/manager/storage/ZFSPoolEdit.js
@@ -1,3 +1,46 @@
+Ext.define('PVE.storage.ZFSPoolSelector', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: 'widget.pveZFSPoolSelector',
+
+    initComponent : function() {
+	var me = this;
+
+	if (!me.nodename) {
+	    me.nodename = 'localhost';
+	}
+
+	var store = Ext.create('Ext.data.Store', {
+	    autoLoad: {}, // true,
+	    fields: [ 'vg', 'size', 'free' ],
+	    proxy: {
+		type: 'pve',
+		url: '/api2/json/nodes/' + me.nodename + '/scan/lvm'
+	    }
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    valueField: 'vg',
+	    displayField: 'vg',
+	    queryMode: 'local',
+	    editable: false,
+	    listConfig: {
+		loadingText: gettext('Scanning...'),
+		listeners: {
+		    // hack: call setHeight to show scroll bars correctly
+		    refresh: function(list) {
+			var lh = PVE.Utils.gridLineHeigh();
+			var count = store.getCount();
+			list.setHeight(lh * ((count > 10) ? 10 : count));
+		    }
+		}
+	    }
+	});
+
+	me.callParent();
+    }
+});
+
 Ext.define('PVE.storage.ZFSPoolInputPanel', {
     extend: 'PVE.panel.InputPanel',
 
-- 
1.7.10.4




More information about the pve-devel mailing list