]> git.proxmox.com Git - pve-manager.git/commitdiff
Do not use 'autoselect' as a boolean when preselecting a bus
authorEmmanuel Kasper <e.kasper@proxmox.com>
Mon, 2 Oct 2017 08:37:30 +0000 (10:37 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 19 Oct 2017 09:46:23 +0000 (11:46 +0200)
The bus selector is displayed when we add a Hard Disk or CD Drive.
When it is displayed, we *always* preselect the next available
slot on the controller of our choice.
So this test is not needed.

We keep the test on the string value of 'autoselect' to select
a bus position when adding a CD Drive.

Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/form/ControllerSelector.js
www/manager6/qemu/HDEdit.js

index 002134efdd2ab5c89ba36d7b61d9442e746bfaa0..045e7d0d85fee9740190f5826afa8e97ad289ddd 100644 (file)
@@ -58,37 +58,36 @@ Ext.define('PVE.form.ControllerSelector', {
        var me = this;
 
        me.vmconfig = Ext.apply({}, vmconfig);
-       if (autoSelect) {
-           var clist = ['ide', 'virtio', 'scsi', 'sata'];
-           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);
-                   return;
-               }
-           } else  {
-               // in most cases we want to add a disk to the same controller
-               // we previously used
-               clist = me.sortByPreviousUsage(me.vmconfig, clist);
+
+       var clist = ['ide', 'virtio', 'scsi', 'sata'];
+       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);
+               return;
            }
+       } else  {
+           // in most cases we want to add a disk to the same controller
+           // we previously used
+           clist = me.sortByPreviousUsage(me.vmconfig, clist);
+       }
 
-           Ext.Array.each(clist, function(controller) {
-               var confid, i;
-               if ((controller === 'virtio' && me.noVirtIO) ||
+       Ext.Array.each(clist, function(controller) {
+           var confid, i;
+           if ((controller === 'virtio' && me.noVirtIO) ||
                    (controller === 'scsi' && me.noScsi)) {
-                   return; //continue
-               }
-               me.down('field[name=controller]').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);
-                       return false; // break
-                   }
+               return; //continue
+           }
+           me.down('field[name=controller]').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);
+                   return false; // break
                }
-           });
-       }
+           }
+       });
        me.down('field[name=deviceid]').validate();
     },
 
index e7535f50d9a96c2357d8e32d1f00b907e8446d0f..8a415d8b1fb057a03df73c405abf928647fe11ea 100644 (file)
@@ -140,7 +140,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
        me.vmconfig = vmconfig;
 
        if (me.bussel) {
-           me.bussel.setVMConfig(vmconfig, true);
+           me.bussel.setVMConfig(vmconfig);
        }
        if (me.unusedDisks) {
            var disklist = [];