populate vm name

This commit is contained in:
2022-12-20 17:07:58 -08:00
parent 9754351e22
commit 4484f7dc8b
2 changed files with 13 additions and 8 deletions

View File

@@ -24,21 +24,23 @@ async function populateForm (node, type, vmid) {
let config = await request(`/nodes/${node}/${type}/${vmid}/config`);
console.log(config);
addFormLine("cores", "Cores", {type: "number", value: config.data.cores, min: 1, max: 8192});
addFormLine("memory", "Memory", {type: "number", value: config.data.memory, min: 16});
addFormLine("name", "name", "Name:", {type: "text", value: config.data.name});
addFormLine("resources", "cores", "Cores:", {type: "number", value: config.data.cores, min: 1, max: 8192});
addFormLine("resources", "memory", "Memory:", {type: "number", value: config.data.memory, min: 16});
let i = 0;
while(Object.hasOwn(config.data, `sata${i}`)){
let sata = config.data[`sata${i}`];
sata = `{"${sata.replaceAll(":", '":"').replaceAll("=", '":"').replaceAll(",", '","')}"}`;
sata = JSON.parse(sata);
addFormLine(`sata${i}`, `SATA ${i}`, {type: "text", value: sata.size});
addFormLine("resources", `sata${i}`, `SATA ${i}`, {type: "text", value: sata.size});
i++;
}
}
function addFormLine (id, labelName, inputAttr) {
let form = document.querySelector("#user-configurable");
function addFormLine (fieldset, id, labelName, inputAttr) {
let form = document.querySelector(`#${fieldset}`);
let label = document.createElement("label");
label.for = id;