change config button icon on power action

This commit is contained in:
Arthur Lu 2022-12-18 21:00:58 -08:00
parent aa4ea3e0de
commit 2721fd3e5e

View File

@ -77,6 +77,8 @@ class Instance extends HTMLElement {
let powerButton = this.shadowElement.querySelector("#power-btn"); let powerButton = this.shadowElement.querySelector("#power-btn");
powerButton.src = "images/actions/loading.svg"; powerButton.src = "images/actions/loading.svg";
powerButton.alt = `instance is ${targetActionDesc}`; 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}); 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.src = this.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg";
powerButton.alt = this.status === "running" ? "shutdown instance" : "start instance"; 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; this.actionLock = false;
break; break;
@ -102,6 +106,8 @@ class Instance extends HTMLElement {
powerButton.src = this.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg"; powerButton.src = this.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg";
powerButton.alt = this.status === "running" ? "shutdown instance" : "start instance"; 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; this.actionLock = false;
console.error(`attempted to ${targetAction} ${this.vmid} but process returned stopped:${taskStatus.data.exitstatus}`); 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"); let configButton = this.shadowElement.querySelector("#configure-btn");
configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg"; configButton.src = data.status === "running" ? "images/actions/config-inactive.svg" : "images/actions/config-active.svg";
configButton
} }
} }