fix config form icon styling

This commit is contained in:
Arthur Lu 2022-12-21 15:59:54 -08:00
parent ffd48cafad
commit 0fe83fa2b8
2 changed files with 10 additions and 4 deletions

View File

@ -40,3 +40,7 @@ legend {
position: relative;
height: 0;
}
form > img {
width: 16px;
}

View File

@ -25,7 +25,7 @@ async function populateForm (node, type, vmid) {
console.log(config);
let name = type === "qemu" ? "name" : "hostname";
addFormLine("name", "Name", {type: "text", value: config.data[name]});
addFormLine("name", null, "Name", {type: "text", value: config.data[name]});
addFormLine("resources", "images/resources/cpu.svg", "Cores", {type: "number", value: config.data.cores, min: 1, max: 8192}, "Threads");
addFormLine("resources", "images/resources/ram.svg", "Memory", {type: "number", value: config.data.memory / 1024, min: 0, step: 0.001}, "GiB");
if (type === "lxc") {
@ -57,9 +57,11 @@ async function populateForm (node, type, vmid) {
function addFormLine (fieldset, iconHref, labelText, inputAttr, unitText=null) {
let field = document.querySelector(`#${fieldset}`);
let icon = document.createElement("img");
icon.src = iconHref;
field.append(icon);
if (icon) {
let icon = document.createElement("img");
icon.src = iconHref;
field.append(icon);
}
let label = document.createElement("label");
label.innerHTML = labelText;