fix variable name collision

This commit is contained in:
Arthur Lu 2023-01-10 17:05:41 -08:00
parent 0b139f37c0
commit d3c4f338cf

View File

@ -52,15 +52,15 @@ async function populateForm (node, type, vmid) {
for(let i = 0; i < diskConfig[type].prefixOrder.length; i++){ for(let i = 0; i < diskConfig[type].prefixOrder.length; i++){
let prefix = diskConfig[type].prefixOrder[i]; let prefix = diskConfig[type].prefixOrder[i];
let type = diskConfig[type][prefix]; let entry = diskConfig[type][prefix];
Object.keys(config.data).forEach(element => { Object.keys(config.data).forEach(element => {
if (element.startsWith(prefix)) { if (element.startsWith(prefix)) {
type.used[element.replace(prefix, "")] = config.data[element]; entry.used[element.replace(prefix, "")] = config.data[element];
} }
}); });
let ordered_keys = Object.keys(disks).sort((a,b) => {parseInt(a) - parseInt(b)}); // ordered integer list let ordered_keys = Object.keys(disks).sort((a,b) => {parseInt(a) - parseInt(b)}); // ordered integer list
ordered_keys.forEach(element => { ordered_keys.forEach(element => {
addDiskLine("disks", `${prefix}${element}`, disks[element].includes("media=cdrom") ? "images/resources/disk.svg" : "images/resources/drive.svg", `${type} ${element}`, type.used[element]); addDiskLine("disks", `${prefix}${element}`, disks[element].includes("media=cdrom") ? "images/resources/disk.svg" : "images/resources/drive.svg", `${entry} ${element}`, emtry.used[element]);
}); });
} }