mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-06-13 00:39:04 +00:00

uses the MultiDiskPanel as base and implements the necessary functions/variables this allows now to create a vm also without any disk Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Tested-by: Lorenz Stechauner <l.stechauner@proxmox.com> Tested-by: Aaron Lauterer <a.lauterer@proxmox.com>
63 lines
1.5 KiB
JavaScript
63 lines
1.5 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();
|
|
|
|
return {
|
|
ide2: 'media=cdrom',
|
|
scsihw: vm.get('current.scsihw'),
|
|
ostype: vm.get('current.ostype'),
|
|
};
|
|
},
|
|
|
|
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,
|
|
},
|
|
});
|