fix unknown status check order

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-01-17 12:36:34 -08:00
parent 93490a7e65
commit dccb5ec582

View File

@ -28,6 +28,9 @@ class Instance extends HTMLElement {
} }
set data (data) { set data (data) {
if (data.status === "unknown") {
data.status = "stopped";
}
let typeImg = this.shadowElement.querySelector("#instance-type"); let typeImg = this.shadowElement.querySelector("#instance-type");
typeImg.src = `images/instances/${data.type}/${data.status}.svg`; typeImg.src = `images/instances/${data.type}/${data.status}.svg`;
typeImg.alt = `${data.status} instance`; typeImg.alt = `${data.status} instance`;
@ -47,9 +50,6 @@ class Instance extends HTMLElement {
} }
let nodeImg = this.shadowElement.querySelector("#node-status"); let nodeImg = this.shadowElement.querySelector("#node-status");
if (data.status === "unknown") {
data.status = "stopped";
}
nodeImg.src = `images/nodes/${data.node.status}.svg`; nodeImg.src = `images/nodes/${data.node.status}.svg`;
let nodeParagraph = this.shadowElement.querySelector("#node-name"); let nodeParagraph = this.shadowElement.querySelector("#node-name");