From 85a73b3a6369f1ed75481afe6758f91066a3d5bb Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Wed, 12 Apr 2023 22:47:05 +0000 Subject: [PATCH] improve styling in config form Signed-off-by: Arthur Lu --- images/actions/delete-active.svg | 2 +- images/actions/delete-inactive.svg | 2 +- scripts/config.js | 20 ++++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/images/actions/delete-active.svg b/images/actions/delete-active.svg index bcbc96a..041a88b 100644 --- a/images/actions/delete-active.svg +++ b/images/actions/delete-active.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/images/actions/delete-inactive.svg b/images/actions/delete-inactive.svg index 49d1dbe..8741196 100644 --- a/images/actions/delete-inactive.svg +++ b/images/actions/delete-inactive.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/scripts/config.js b/scripts/config.js index ebeee0a..820f7b0 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -64,6 +64,8 @@ function addResourceLine (fieldset, iconHref, labelText, inputAttr, unitText=nul input.id = labelText; input.name = labelText; input.required = true; + input.classList.add("w3-input"); + input.classList.add("w3-border"); field.append(input); if (unitText) { @@ -147,7 +149,9 @@ function addDiskLine (fieldset, busPrefix, busName, device, diskDetails) { let active = diskMetaData[type][busPrefix].actions.includes(element) ? "active" : "inactive"; // resize action.src = `images/actions/delete-${active}.svg`; action.title = "Delete Disk"; - action.addEventListener("click", handleDiskDelete); + if (active === "active") { + action.addEventListener("click", handleDiskDelete); + } } else { let active = diskMetaData[type][busPrefix].actions.includes(element) ? "active" : "inactive"; // resize @@ -208,7 +212,7 @@ async function handleDiskAttach () { let diskImage = config.data[this.dataset.disk]; dialog.header = `Attach ${diskImage}`; - dialog.formBody = ``; + dialog.formBody = ``; dialog.callback = async (result, form) => { if (result === "confirm") { @@ -242,7 +246,7 @@ async function handleDiskResize () { document.body.append(dialog); dialog.header = `Resize ${this.dataset.disk}`; - dialog.formBody = ``; + dialog.formBody = ``; dialog.callback = async (result, form) => { if (result === "confirm") { @@ -284,11 +288,11 @@ async function handleDiskMove () { options += `"`; } }); - let select = ``; + let select = ``; dialog.formBody = ` ${select} - + `; dialog.shadowRoot.querySelector("#storage-select").selectedIndex = -1; @@ -369,9 +373,9 @@ async function handleDiskAdd () { let select = ``; dialog.formBody = ` - + ${select} - + `; dialog.shadowRoot.querySelector("#storage-select").selectedIndex = -1; @@ -419,7 +423,7 @@ async function handleCDAdd () { let storageSelect = ``; dialog.formBody = ` - + ${storageSelect} `;