[pve-devel] [PATCH manager v2 6/8] use DiskStorageSelector in qemu/HDMove.js

Dominik Csapak d.csapak at proxmox.com
Fri Nov 10 14:49:25 CET 2017


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes since v1:
* added storageContent
 www/manager6/qemu/HDMove.js | 56 ++++++++-------------------------------------
 1 file changed, 10 insertions(+), 46 deletions(-)

diff --git a/www/manager6/qemu/HDMove.js b/www/manager6/qemu/HDMove.js
index 745c7911..cb50d492 100644
--- a/www/manager6/qemu/HDMove.js
+++ b/www/manager6/qemu/HDMove.js
@@ -59,54 +59,14 @@ Ext.define('PVE.window.HDMove', {
             }
         ];
 
-        me.hdstoragesel = Ext.create('PVE.form.StorageSelector', {
-                name: 'hdstorage',
-                nodename: me.nodename,
-                fieldLabel: gettext('Target Storage'),
-                storageContent: 'images',
-                autoSelect: me.insideWizard,
-                allowBlank: true,
-                disabled: false,
-                hidden: false,
-                listeners: {
-                    change: function(f, value) {
-			if (!value) { // initial store loading fires an unwanted 'change
-			    return;
-			}
-                        var rec = f.store.getById(value);
-			if (rec.data.type === 'iscsi' ||
-			    rec.data.type === 'lvm' ||
-			    rec.data.type === 'lvmthin' ||
-			    rec.data.type === 'rbd' ||
-			    rec.data.type === 'sheepdog' ||
-			    rec.data.type === 'zfs' ||
-			    rec.data.type === 'zfspool'
-                        ) {
-                            me.formatsel.setValue('raw');
-                            me.formatsel.setDisabled(true);
-                        } else {
-                            me.formatsel.setDisabled(false);
-                        }
-
-                    }
-                }
-
-	});
-
-	me.formatsel = Ext.create('PVE.form.DiskFormatSelector', {
-		name: 'diskformat',
-		fieldLabel: gettext('Format'),
-		value: 'raw',
-                disabled: true,
-                hidden: false,
-		allowBlank: false
+	items.push({
+	    xtype: 'pveDiskStorageSelector',
+	    storageLabel: gettext('Target Storage'),
+	    nodename: me.nodename,
+	    storageContent: 'images',
+	    hideSize: true
 	});
 
-
-   
-	items.push(me.hdstoragesel);
-	items.push(me.formatsel);
-
 	items.push({
 	    xtype: 'pvecheckbox',
 	    fieldLabel: gettext('Delete source'),
@@ -153,6 +113,10 @@ Ext.define('PVE.window.HDMove', {
 
 	me.callParent();
 
+	me.mon(me.formPanel, 'validitychange', function(fp, isValid) {
+	    submitBtn.setDisabled(!isValid);
+	});
 
+	me.formPanel.isValid();
     }
 });
-- 
2.11.0





More information about the pve-devel mailing list