populate vm name
This commit is contained in:
parent
9754351e22
commit
4484f7dc8b
@ -12,9 +12,12 @@
|
||||
<div class="center-div">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>Change Configuration</legend>
|
||||
<div class="labels-inputs" id="user-configurable">
|
||||
</div>
|
||||
<legend>Name</legend>
|
||||
<div class="labels-inputs" id="name"></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Resources</legend>
|
||||
<div class="labels-inputs" id="resources"></div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div class="btn-group" id="form-actions">
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user