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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 27 11:01:40 CEST 2017


Looks OK, useful even if we remove the fast path
I mentioned in my other mail.

Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>

On 09/26/2017 02:17 PM, Emmanuel Kasper wrote:
> ---
>   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() {
> 





More information about the pve-devel mailing list