[pve-devel] [PATCH manager v2 05/10] Save the components we found via down() in a variable for later reuse.

Emmanuel Kasper e.kasper at proxmox.com
Tue Sep 12 14:44:44 CEST 2017


---
 www/manager6/form/ControllerSelector.js | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js
index 14ad574e..15023a7a 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -58,11 +58,14 @@ Ext.define('PVE.form.ControllerSelector', {
 	me.vmconfig = Ext.apply({}, vmconfig);
 
 	var clist = ['ide', 'virtio', 'scsi', 'sata'];
+	var bussel = me.down('field[name=controller]');
+	var deviceid = me.down('field[name=deviceid]');
+
 	if (autoSelect === 'cdrom') {
 	    clist = ['ide', 'scsi', 'sata'];
 	    if (!Ext.isDefined(me.vmconfig.ide2)) {
-		me.down('field[name=controller]').setValue('ide');
-		me.down('field[name=deviceid]').setValue(2);
+		bussel.setValue('ide');
+		deviceid.setValue(2);
 		return;
 	    }
 	} else  {
@@ -76,16 +79,16 @@ Ext.define('PVE.form.ControllerSelector', {
 	    if (controller === 'virtio' && me.noVirtIO) {
 		return; //continue
 	    }
-	    me.down('field[name=controller]').setValue(controller);
+	    bussel.setValue(controller);
 	    for (i = 0; i <= PVE.form.ControllerSelector.maxIds[controller]; i++) {
 		confid = controller + i.toString();
 		if (!Ext.isDefined(me.vmconfig[confid])) {
-		    me.down('field[name=deviceid]').setValue(i);
+		    deviceid.setValue(i);
 		    return false; // break
 		}
 	    }
 	});
-	me.down('field[name=deviceid]').validate();
+	deviceid.validate();
     },
 
     initComponent: function() {
-- 
2.11.0





More information about the pve-devel mailing list