pve-manager/www/manager6/qemu/MultiHDEdit.js
Dominik Csapak 5b2e8bd4d1 ui: vm wizard: allow second iso for windows vms
Having a second CD-drive is useful for adding the virtio-win driver
ISO for new installs, and thus we change the default disk type to scsi
and network type to VirtIO.

Add special logic to the OSTypeInputPanel when 'insideWizard' is true
to add an additional checkbox + iso selector

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-11-21 09:34:41 +01:00

69 lines
1.6 KiB
JavaScript

Ext.define('PVE.qemu.MultiHDPanel', {
extend: 'PVE.panel.MultiDiskPanel',
alias: 'widget.pveMultiHDPanel',
onlineHelp: 'qm_hard_disk',
controller: {
xclass: 'Ext.app.ViewController',
// maxCount is the sum of all controller ids - 1 (ide2 is fixed in the wizard)
maxCount: Object.values(PVE.Utils.diskControllerMaxIDs)
.reduce((previous, current) => previous+current, 0) - 1,
getNextFreeDisk: function(vmconfig) {
let clist = PVE.Utils.sortByPreviousUsage(vmconfig);
return PVE.Utils.nextFreeDisk(clist, vmconfig);
},
addPanel: function(itemId, vmconfig, nextFreeDisk) {
let me = this;
return me.getView().add({
vmconfig,
border: false,
showAdvanced: Ext.state.Manager.getProvider().get('proxmox-advanced-cb'),
xtype: 'pveQemuHDInputPanel',
bind: {
nodename: '{nodename}',
},
padding: '0 0 0 5',
itemId,
isCreate: true,
insideWizard: true,
});
},
getBaseVMConfig: function() {
let me = this;
let vm = me.getViewModel();
let res = {
ide2: 'media=cdrom',
scsihw: vm.get('current.scsihw'),
ostype: vm.get('current.ostype'),
};
if (vm.get('current.ide0') === "some") {
res.ide0 = "media=cdrom";
}
return res;
},
diskSorter: {
sorterFn: function(rec1, rec2) {
let [, name1, id1] = PVE.Utils.bus_match.exec(rec1.data.name);
let [, name2, id2] = PVE.Utils.bus_match.exec(rec2.data.name);
if (name1 === name2) {
return parseInt(id1, 10) - parseInt(id2, 10);
}
return name1 < name2 ? -1 : 1;
},
},
deleteDisabled: () => false,
},
});