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) {
|
if (resources instanceof Object) {
|
||||||
let table = document.querySelector(tableid);
|
let table = document.querySelector(tableid);
|
||||||
let tbody = table.querySelector("tbody");
|
let tbody = table.querySelector("tbody");
|
||||||
Object.keys(resources.avail).forEach((element) => {
|
Object.keys(resources.resources).forEach((element) => {
|
||||||
let row = tbody.insertRow();
|
if (resources.resources[element].display) {
|
||||||
let key = row.insertCell();
|
let row = tbody.insertRow();
|
||||||
key.innerText = `${element}`;
|
let key = row.insertCell();
|
||||||
let used = row.insertCell();
|
key.innerText = `${element}`;
|
||||||
used.innerText = `${parseNumber(resources.used[element], resources.units[element])}`;
|
let used = row.insertCell();
|
||||||
let val = row.insertCell();
|
used.innerText = `${parseNumber(resources.used[element], resources.resources[element])}`;
|
||||||
val.innerText = `${parseNumber(resources.avail[element], resources.units[element])}`;
|
let val = row.insertCell();
|
||||||
let total = row.insertCell();
|
val.innerText = `${parseNumber(resources.avail[element], resources.resources[element])}`;
|
||||||
total.innerText = `${parseNumber(resources.max[element], resources.units[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/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");
|
addResourceLine("resources", "images/resources/ram.svg", "input", "Memory", "ram", { type: "number", value: config.data.memory, min: 16, step: 1 }, "MiB");
|
||||||
if (type === "lxc") {
|
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") {
|
else if (type === "select") {
|
||||||
let select = document.createElement("select");
|
let select = document.createElement("select");
|
||||||
select.value = attributes.value;
|
|
||||||
for (let option of attributes.options) {
|
for (let option of attributes.options) {
|
||||||
select.append(new Option(option));
|
select.append(new Option(option));
|
||||||
}
|
}
|
||||||
|
select.value = attributes.value;
|
||||||
select.id = id;
|
select.id = id;
|
||||||
select.name = id;
|
select.name = id;
|
||||||
select.required = true;
|
select.required = true;
|
||||||
@ -688,12 +688,14 @@ async function handleFormExit() {
|
|||||||
node: node,
|
node: node,
|
||||||
type: type,
|
type: type,
|
||||||
vmid: vmid,
|
vmid: vmid,
|
||||||
proctype: document.querySelector("#proctype").value,
|
|
||||||
cores: document.querySelector("#cores").value,
|
cores: document.querySelector("#cores").value,
|
||||||
memory: document.querySelector("#ram").value
|
memory: document.querySelector("#ram").value
|
||||||
}
|
}
|
||||||
if (type === "lxc") {
|
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);
|
let result = await requestAPI("/instance/resources", "POST", body);
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
|
Loading…
Reference in New Issue
Block a user