populate cores and memory in config
This commit is contained in:
parent
727c23cec3
commit
bd81fdb8e6
@ -13,4 +13,30 @@ async function init () {
|
|||||||
async function populateForm (node, type, vmid) {
|
async function populateForm (node, type, vmid) {
|
||||||
let config = await request(`/nodes/${node}/${type}/${vmid}/config`);
|
let config = await request(`/nodes/${node}/${type}/${vmid}/config`);
|
||||||
console.log(config);
|
console.log(config);
|
||||||
|
|
||||||
|
addFormLine("cores", {innerText: "Cores:"}, {type: "number", value: config.data.cores, min: 1, max: 8192});
|
||||||
|
addFormLine("memory", {innerText: "Memory"}, {type: "number", value: config.data.memory, min: 16});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addFormLine (id, labelAttr, inputAttr) {
|
||||||
|
let labelWrapperDiv = document.createElement("div");
|
||||||
|
let label = document.createElement("label");
|
||||||
|
label.for = id;
|
||||||
|
for (k in labelAttr) {
|
||||||
|
label.k = labelAttr.k;
|
||||||
|
}
|
||||||
|
labelWrapperDiv.append(label);
|
||||||
|
let labelContainer = document.querySelector("#labels");
|
||||||
|
labelContainer.append(labelWrapperDiv);
|
||||||
|
|
||||||
|
let inputWrapperDiv = document.createElement("div");
|
||||||
|
let input = document.createElement("input");
|
||||||
|
input.id = id;
|
||||||
|
input.name = id;
|
||||||
|
for (k in inputAttr) {
|
||||||
|
input.k = inputAttr.k;
|
||||||
|
}
|
||||||
|
inputWrapperDiv.append(input);
|
||||||
|
let inputContainer = document.querySelector("#inputs");
|
||||||
|
inputContainer.append(inputWrapperDiv);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user