From 652c4090551df232421ac4eb7d368f197236c905 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sun, 18 Dec 2022 21:00:58 -0800 Subject: [PATCH] change config button icon on power action --- scripts/elements.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/elements.js b/scripts/elements.js index 0fcb953..423a680 100644 --- a/scripts/elements.js +++ b/scripts/elements.js @@ -77,6 +77,8 @@ class Instance extends HTMLElement { let powerButton = this.shadowElement.querySelector("#power-btn"); powerButton.src = "images/actions/loading.svg"; powerButton.alt = `instance is ${targetActionDesc}`; + let configButton = this.shadowElement.querySelector("#configure-btn"); + configButton.src = "images/actions/config-inactive.svg"; let task = await request(`/nodes/${this.node}/${this.type}/${this.vmid}/status/${targetAction}`, "POST", {node: this.node, vmid: this.vmid}); @@ -91,6 +93,8 @@ class Instance extends HTMLElement { powerButton.src = this.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg"; powerButton.alt = this.status === "running" ? "shutdown instance" : "start instance"; + configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg"; + this.actionLock = false; break; @@ -102,6 +106,8 @@ class Instance extends HTMLElement { powerButton.src = this.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg"; powerButton.alt = this.status === "running" ? "shutdown instance" : "start instance"; + configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg"; + this.actionLock = false; console.error(`attempted to ${targetAction} ${this.vmid} but process returned stopped:${taskStatus.data.exitstatus}`); @@ -117,6 +123,7 @@ class Instance extends HTMLElement { let configButton = this.shadowElement.querySelector("#configure-btn"); configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg"; + configButton } }