fix missing param in add disk handlers

This commit is contained in:
Arthur Lu 2023-01-11 02:46:25 -08:00
parent 906c292e53
commit acc6d834c4

View File

@ -71,12 +71,12 @@ async function populateForm (node, type, vmid) {
}); });
let def = diskConfig[type].prefixOrder[0]; let def = diskConfig[type].prefixOrder[0];
addDiskBus.value = def; addDiskBus.value = def;
handleDiskBusChange(); handleDiskBusChange(diskConfig);
addDiskBus.addEventListener("change", handleDiskBusChange); addDiskBus.addEventListener("change", handleDiskBusChange(diskConfig));
addDiskDevice.addEventListener("input", handleDiskDeviceChange); addDiskDevice.addEventListener("input", handleDiskDeviceChange(diskConfig));
addDiskDevice.addEventListener("focus", handleDiskDeviceChange); addDiskDevice.addEventListener("focus", handleDiskDeviceChange(diskConfig));
let addDiskStorage = document.querySelector("#add-disk #storage"); let addDiskStorage = document.querySelector("#add-disk #storage");
let addDiskSize = document.querySelector("#add-disk #size"); let addDiskSize = document.querySelector("#add-disk #size");
@ -100,7 +100,7 @@ function getNextAvaliable(entry){
return nextAvaliable; return nextAvaliable;
} }
function handleDiskBusChange () { function handleDiskBusChange (diskConfig) {
let bus = document.querySelector("#add-disk #bus").value; let bus = document.querySelector("#add-disk #bus").value;
let entry = diskConfig[type][bus]; let entry = diskConfig[type][bus];
let limit = entry.limit; let limit = entry.limit;
@ -116,7 +116,7 @@ function handleDiskBusChange () {
handleDiskDeviceChange(); handleDiskDeviceChange();
} }
function handleDiskDeviceChange () { function handleDiskDeviceChange (diskConfig) {
let value = document.querySelector("#add-disk #device").value; let value = document.querySelector("#add-disk #device").value;
let bus = document.querySelector("#add-disk #bus").value; let bus = document.querySelector("#add-disk #bus").value;
let entry = diskConfig[type][bus]; let entry = diskConfig[type][bus];