fix disk populating bugs

This commit is contained in:
Arthur Lu 2023-01-11 03:00:01 -08:00
parent cdb06ce8cc
commit ec1426f0c1

View File

@ -73,12 +73,11 @@ async function populateForm (node, type, vmid) {
diskConfig[type].prefixOrder.forEach(element => { diskConfig[type].prefixOrder.forEach(element => {
addDiskBus.add(new Option(diskConfig[type][element].name, element)); addDiskBus.add(new Option(diskConfig[type][element].name, element));
}); });
let def = diskConfig[type].prefixOrder[0]; addDiskBus.value = diskConfig[type].prefixOrder[0];
addDiskBus.value = def;
handleDiskBusChange(diskConfig); handleDiskBusChange(diskConfig);
addDiskBus.addEventListener("change", handleDiskBusChange()); addDiskBus.addEventListener("change", handleDiskBusChange());
let addDiskDevice = document.querySelector("#add-disk #device");
addDiskDevice.addEventListener("input", handleDiskDeviceChange()); addDiskDevice.addEventListener("input", handleDiskDeviceChange());
addDiskDevice.addEventListener("focus", handleDiskDeviceChange()); addDiskDevice.addEventListener("focus", handleDiskDeviceChange());