add loading icon

This commit is contained in:
2022-12-18 17:06:05 -08:00
parent a24467ee39
commit 5e46481f72
2 changed files with 29 additions and 1 deletions

View File

@@ -69,6 +69,9 @@ class Instance extends HTMLElement {
let targetAction = this.status === "running" ? "shutdown" : "start";
let targetStatus = this.status === "running" ? "stopped" : "running";
let typeImg = this.shadowElement.querySelector("#instance-type");
typeImg.src = "images/actions/loading.svg";
await request(`/nodes/${this.node}/${this.type}/${this.vmid}/status/${targetAction}`, "POST", {node: this.node, vmid: this.vmid});
while (true) {
@@ -81,7 +84,6 @@ class Instance extends HTMLElement {
this.status = targetStatus;
let typeImg = this.shadowElement.querySelector("#instance-type");
typeImg.src = `images/instances/${this.type}/${this.status}.svg`;
let powerButton = this.shadowElement.querySelector("#power-btn");