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; position: relative;
height: 0; height: 0;
} }
form > img {
width: 16px;
}

View File

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