set instance to original if request returns an error
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
1b4e818b6d
commit
23f3153294
@ -76,7 +76,24 @@ class Instance extends HTMLElement {
|
|||||||
let configButton = this.shadowElement.querySelector("#configure-btn");
|
let configButton = this.shadowElement.querySelector("#configure-btn");
|
||||||
configButton.src = "images/actions/config-inactive.svg";
|
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});
|
try {
|
||||||
|
let task = await request(`/nodes/${this.node}/${this.type}/${this.vmid}/status/${targetAction}`, "POST", {node: this.node, vmid: this.vmid});
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
typeImg.src = `images/instances/${this.type}/${this.status}.svg`;
|
||||||
|
typeImg.alt = `${this.status} instance`;
|
||||||
|
|
||||||
|
powerButton.src = this.status === "running" ? "images/actions/stop.svg" : "images/actions/start.svg";
|
||||||
|
powerButton.alt = this.status === "running" ? "shutdown instance" : "start instance";
|
||||||
|
|
||||||
|
configButton.src = this.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}`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
let taskStatus = await request(`/nodes/${this.node}/tasks/${task.data}/status`);
|
let taskStatus = await request(`/nodes/${this.node}/tasks/${task.data}/status`);
|
||||||
|
Loading…
Reference in New Issue
Block a user