From 134431d88c7c9b063f362cc9f773a1e3a20f085a Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 14 Feb 2023 20:05:56 +0000 Subject: [PATCH] remove handler for inactive buttons, change delete icon Signed-off-by: Arthur Lu --- images/actions/delete-active.svg | 2 +- images/actions/delete-inactive.svg | 2 +- .../detach_attach-inactive.svg} | 0 scripts/config.js | 22 +++++++++---------- 4 files changed, 12 insertions(+), 14 deletions(-) rename images/{blank.svg => actions/detach_attach-inactive.svg} (100%) diff --git a/images/actions/delete-active.svg b/images/actions/delete-active.svg index f336ecd..bcbc96a 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 831a08c..49d1dbe 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/images/blank.svg b/images/actions/detach_attach-inactive.svg similarity index 100% rename from images/blank.svg rename to images/actions/detach_attach-inactive.svg diff --git a/scripts/config.js b/scripts/config.js index 5a90007..adfa2ba 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -137,18 +137,16 @@ function addDiskLine (fieldset, busPrefix, busName, device, diskDetails) { let active = diskMetaData[type][busPrefix].actions.includes(element) ? "active" : "inactive"; // resize action.src = `images/actions/${element}-${active}.svg`; action.title = `${element.charAt(0).toUpperCase()}${element.slice(1)} Disk`; - if (element === "move") { - action.addEventListener("click", handleDiskMove); - } - else if (element === "resize") { - action.addEventListener("click", handleDiskResize); - } - else if (element === "delete") { - action.addEventListener("click", handleDiskDelete); - } - else { // entry does not support anything in this category, override the src and title for a blank tile - action.src = "images/blank.svg"; - action.title = ""; + if (active === "active") { + if (element === "move") { + action.addEventListener("click", handleDiskMove); + } + else if (element === "resize") { + action.addEventListener("click", handleDiskResize); + } + else if (element === "delete") { + action.addEventListener("click", handleDiskDelete); + } } } action.dataset.disk = diskID;