fix string to float conversion

This commit is contained in:
Arthur Lu 2022-12-21 01:33:37 -08:00
parent 9189d4aa0e
commit a8d66a8ae6

View File

@ -34,7 +34,7 @@ async function populateForm (node, type, vmid) {
sata = `{"${sata.replaceAll(":", '":"').replaceAll("=", '":"').replaceAll(",", '","')}"}`;
sata = JSON.parse(sata);
let sizeUnit = sata.size.includes("G") ? "GiB" : "MiB";
addFormLine("resources", `SATA ${i}`, {type: "number", value: sizeUnit === "GiB" ? (sata.size).toFixed(3) : (sata.size / 1024).toFixed(3), min: 0.016}, "GiB");
addFormLine("resources", `SATA ${i}`, {type: "number", value: sizeUnit === "GiB" ? +(sata.size).toFixed(3) : +(sata.size / 1024).toFixed(3), min: 0.016}, "GiB");
i++;
}
}