[pve-devel] [PATCH manager 04/10] ext6migrate: fix dropboxes in Storage Edit windows

Dominik Csapak d.csapak at proxmox.com
Thu Mar 10 11:46:56 CET 2016


we fix this by moving the static configuration (especially value and
displayfield) to the class definition

also we remove the scrollbar hack (it works properly now)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/storage/GlusterFsEdit.js | 22 +++++++---------------
 www/manager6/storage/IScsiEdit.js     | 23 +++++++----------------
 www/manager6/storage/LVMEdit.js       | 28 +++++++++-------------------
 www/manager6/storage/LvmThinEdit.js   | 30 +++++++-----------------------
 www/manager6/storage/NFSEdit.js       | 22 +++++++---------------
 www/manager6/storage/ZFSPoolEdit.js   | 23 +++++++----------------
 6 files changed, 44 insertions(+), 104 deletions(-)

diff --git a/www/manager6/storage/GlusterFsEdit.js b/www/manager6/storage/GlusterFsEdit.js
index 01c7ca2..26822f3 100644
--- a/www/manager6/storage/GlusterFsEdit.js
+++ b/www/manager6/storage/GlusterFsEdit.js
@@ -4,6 +4,13 @@ Ext.define('PVE.storage.GlusterFsScan', {
 
     queryParam: 'server',
 
+    valueField: 'volname',
+    displayField: 'volname',
+    matchFieldWidth: false,
+    listConfig: {
+	loadingText: 'Scanning...',
+	width: 350
+    },
     doRawQuery: function() {
     },
 
@@ -42,21 +49,6 @@ Ext.define('PVE.storage.GlusterFsScan', {
 
 	Ext.apply(me, {
 	    store: store,
-	    valueField: 'volname',
-	    displayField: 'volname',
-	    matchFieldWidth: false,
-	    listConfig: {
-		loadingText: '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));
-		    }
-		},
-		width: 350
-	    }
 	});
 
 	me.callParent();
diff --git a/www/manager6/storage/IScsiEdit.js b/www/manager6/storage/IScsiEdit.js
index 60c9b85..6d099ea 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -3,7 +3,13 @@ Ext.define('PVE.storage.IScsiScan', {
     alias: 'widget.pveIScsiScan',
 
     queryParam: 'portal',
-
+    valueField: 'target',
+    displayField: 'target',
+    matchFieldWidth: false,
+    listConfig: {
+	loadingText: gettext('Scanning...'),
+	width: 350
+    },
     doRawQuery: function() {
     },
 
@@ -42,21 +48,6 @@ Ext.define('PVE.storage.IScsiScan', {
 
 	Ext.apply(me, {
 	    store: store,
-	    valueField: 'target',
-	    displayField: 'target',
-	    matchFieldWidth: 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));
-		    }
-		},
-		width: 350
-	    }
 	});
 
 	me.callParent();
diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js
index 577f317..e7756a1 100644
--- a/www/manager6/storage/LVMEdit.js
+++ b/www/manager6/storage/LVMEdit.js
@@ -1,7 +1,10 @@
 Ext.define('PVE.storage.VgSelector', {
     extend: 'Ext.form.field.ComboBox',
     alias: 'widget.pveVgSelector',
-
+    valueField: 'vg',
+    displayField: 'vg',
+    queryMode: 'local',
+    editable: false,
     initComponent : function() {
 	var me = this;
 
@@ -20,20 +23,8 @@ Ext.define('PVE.storage.VgSelector', {
 
 	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));
-		    }
-		}
 	    }
 	});
 
@@ -46,7 +37,11 @@ Ext.define('PVE.storage.BaseStorageSelector', {
     alias: 'widget.pveBaseStorageSelector',
 
     existingGroupsText: gettext("Existing volume groups"),
-
+    queryMode: 'local',
+    editable: false,
+    value: '',
+    valueField: 'storage',
+    displayField: 'text',
     initComponent : function() {
 	var me = this;
 
@@ -78,11 +73,6 @@ Ext.define('PVE.storage.BaseStorageSelector', {
 
 	Ext.apply(me, {
 	    store: store,
-	    queryMode: 'local',
-	    editable: false,
-	    value: '',
-	    valueField: 'storage',
-	    displayField: 'text'
 	});
 
 	me.callParent();
diff --git a/www/manager6/storage/LvmThinEdit.js b/www/manager6/storage/LvmThinEdit.js
index a2c3ee7..a6f7cdb 100644
--- a/www/manager6/storage/LvmThinEdit.js
+++ b/www/manager6/storage/LvmThinEdit.js
@@ -3,6 +3,9 @@ Ext.define('PVE.storage.TPoolSelector', {
     alias: 'widget.pveTPSelector',
 
     queryParam: 'vg',
+    valueField: 'lv',
+    displayField: 'lv',
+    editable: false,
 
     doRawQuery: function() {
     },
@@ -42,19 +45,8 @@ Ext.define('PVE.storage.TPoolSelector', {
 
 	Ext.apply(me, {
 	    store: store,
-	    valueField: 'lv',
-	    displayField: 'lv',
-	    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));
-		    }
-		}
 	    }
 	});
 
@@ -66,6 +58,10 @@ Ext.define('PVE.storage.BaseVGSelector', {
     extend: 'Ext.form.field.ComboBox',
     alias: 'widget.pveBaseVGSelector',
 
+    valueField: 'vg',
+    displayField: 'vg',
+    queryMode: 'local',
+    editable: false,
     initComponent : function() {
 	var me = this;
 
@@ -84,20 +80,8 @@ Ext.define('PVE.storage.BaseVGSelector', {
 
 	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));
-		    }
-		}
 	    }
 	});
 
diff --git a/www/manager6/storage/NFSEdit.js b/www/manager6/storage/NFSEdit.js
index e9c93d0..4b50a6f 100644
--- a/www/manager6/storage/NFSEdit.js
+++ b/www/manager6/storage/NFSEdit.js
@@ -4,6 +4,13 @@ Ext.define('PVE.storage.NFSScan', {
 
     queryParam: 'server',
 
+    valueField: 'path',
+    displayField: 'path',
+    matchFieldWidth: false,
+    listConfig: {
+	loadingText: gettext('Scanning...'),
+	width: 350
+    },
     doRawQuery: function() {
     },
 
@@ -42,21 +49,6 @@ Ext.define('PVE.storage.NFSScan', {
 
 	Ext.apply(me, {
 	    store: store,
-	    valueField: 'path',
-	    displayField: 'path',
-	    matchFieldWidth: 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));
-		    }
-		},
-		width: 350
-	    }
 	});
 
 	me.callParent();
diff --git a/www/manager6/storage/ZFSPoolEdit.js b/www/manager6/storage/ZFSPoolEdit.js
index 0319299..7dcb7c0 100644
--- a/www/manager6/storage/ZFSPoolEdit.js
+++ b/www/manager6/storage/ZFSPoolEdit.js
@@ -1,7 +1,13 @@
 Ext.define('PVE.storage.ZFSPoolSelector', {
     extend: 'Ext.form.field.ComboBox',
     alias: 'widget.pveZFSPoolSelector',
-
+    valueField: 'pool',
+    displayField: 'pool',
+    queryMode: 'local',
+    editable: false,
+    listConfig: {
+	loadingText: gettext('Scanning...'),
+    },
     initComponent : function() {
 	var me = this;
 
@@ -20,21 +26,6 @@ Ext.define('PVE.storage.ZFSPoolSelector', {
 
 	Ext.apply(me, {
 	    store: store,
-	    valueField: 'pool',
-	    displayField: 'pool',
-	    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();
-- 
2.1.4





More information about the pve-devel mailing list