generalize disk populating
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
cd028002a0
commit
6adf04efe8
@ -44,9 +44,16 @@ async function populateForm (node, type, vmid) {
|
||||
for(let j = 0; j < diskPrefixes.length; j++){
|
||||
let prefix = diskPrefixes[j];
|
||||
let type = diskTypes[j];
|
||||
|
||||
Object.keys(config.data).forEach(element => {
|
||||
if (element.startsWith(prefix)) {
|
||||
addDiskLine("disks", element, "images/resources/disk.svg", `${type} ${element.replace(prefix, "")}`, config.data[element]);
|
||||
}
|
||||
})
|
||||
|
||||
let i = 0;
|
||||
while(Object.hasOwn(config.data, `${prefix}${i}`)){
|
||||
addDiskLine("disks", `${prefix}${i}`, "images/resources/disk.svg", `${type} ${i}`, config.data[`${prefix}${i}`]);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user