From 0fe83fa2b80e10df8f23c6d4804b217514e22ceb Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Wed, 21 Dec 2022 15:59:54 -0800 Subject: [PATCH] fix config form icon styling --- css/form.css | 4 ++++ scripts/config.js | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/css/form.css b/css/form.css index 7ff5bc0..34d671f 100644 --- a/css/form.css +++ b/css/form.css @@ -39,4 +39,8 @@ legend { top: -0.6em; position: relative; height: 0; +} + +form > img { + width: 16px; } \ No newline at end of file diff --git a/scripts/config.js b/scripts/config.js index a6a9967..e6d7fbe 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -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;