fix proc type selector issue in config,
update account resource table with new API format
This commit is contained in:
parent
8fdd970a44
commit
0bb82dc81a
@ -40,16 +40,18 @@ function buildResourceTable(resources, tableid) {
|
||||
if (resources instanceof Object) {
|
||||
let table = document.querySelector(tableid);
|
||||
let tbody = table.querySelector("tbody");
|
||||
Object.keys(resources.avail).forEach((element) => {
|
||||
let row = tbody.insertRow();
|
||||
let key = row.insertCell();
|
||||
key.innerText = `${element}`;
|
||||
let used = row.insertCell();
|
||||
used.innerText = `${parseNumber(resources.used[element], resources.units[element])}`;
|
||||
let val = row.insertCell();
|
||||
val.innerText = `${parseNumber(resources.avail[element], resources.units[element])}`;
|
||||
let total = row.insertCell();
|
||||
total.innerText = `${parseNumber(resources.max[element], resources.units[element])}`;
|
||||
Object.keys(resources.resources).forEach((element) => {
|
||||
if (resources.resources[element].display) {
|
||||
let row = tbody.insertRow();
|
||||
let key = row.insertCell();
|
||||
key.innerText = `${element}`;
|
||||
let used = row.insertCell();
|
||||
used.innerText = `${parseNumber(resources.used[element], resources.resources[element])}`;
|
||||
let val = row.insertCell();
|
||||
val.innerText = `${parseNumber(resources.avail[element], resources.resources[element])}`;
|
||||
let total = row.insertCell();
|
||||
total.innerText = `${parseNumber(resources.max[element], resources.resources[element])}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function populateResources() {
|
||||
addResourceLine("resources", "images/resources/cpu.svg", "input", "Processors Amount", "cores", { type: "number", value: config.data.cores, min: 1, max: 8192 }, "Cores");
|
||||
addResourceLine("resources", "images/resources/ram.svg", "input", "Memory", "ram", { type: "number", value: config.data.memory, min: 16, step: 1 }, "MiB");
|
||||
if (type === "lxc") {
|
||||
addResourceLine("resources", "images/resources/swap.svg", "Swap", "swap", { type: "number", value: config.data.swap, min: 0, step: 1 }, "MiB");
|
||||
addResourceLine("resources", "images/resources/swap.svg", "input", "Swap", "swap", { type: "number", value: config.data.swap, min: 0, step: 1 }, "MiB");
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,10 +83,10 @@ function addResourceLine(fieldset, iconHref, type, labelText, id, attributes, un
|
||||
}
|
||||
else if (type === "select") {
|
||||
let select = document.createElement("select");
|
||||
select.value = attributes.value;
|
||||
for (let option of attributes.options) {
|
||||
select.append(new Option(option));
|
||||
}
|
||||
select.value = attributes.value;
|
||||
select.id = id;
|
||||
select.name = id;
|
||||
select.required = true;
|
||||
@ -688,12 +688,14 @@ async function handleFormExit() {
|
||||
node: node,
|
||||
type: type,
|
||||
vmid: vmid,
|
||||
proctype: document.querySelector("#proctype").value,
|
||||
cores: document.querySelector("#cores").value,
|
||||
memory: document.querySelector("#ram").value
|
||||
}
|
||||
if (type === "lxc") {
|
||||
body.swap = document.querySelector("#Swap").value;
|
||||
body.swap = document.querySelector("#swap").value;
|
||||
}
|
||||
else if (type === "qemu") {
|
||||
body.proctype = document.querySelector("#proctype").value;
|
||||
}
|
||||
let result = await requestAPI("/instance/resources", "POST", body);
|
||||
if (result.status === 200) {
|
||||
|
Loading…
Reference in New Issue
Block a user