separate instance card data elements

This commit is contained in:
Arthur Lu 2022-12-14 14:42:40 -08:00
parent 8ef1cc3344
commit 6400f36324

View File

@ -24,10 +24,31 @@ class Instance extends HTMLElement {
set data (data) {
let instanceArticle = this.shadowElement.querySelector("article");
let instanceParagraph = document.createElement("p");
instanceParagraph.innerText = `${data.type} | ${data.vmid} | ${data.name} | ${data.status} | ${data.node.name} (${data.node.status})`;
instanceParagraph.style.color = data.status === "running" ? "#00ff00" : "#ff0000";
instanceArticle.append(instanceParagraph);
let type = document.createElement("img");
type.src = `images/${data.type}.svg`;
instanceArticle.append(type);
let vmid = document.createElement("p");
vmid.innerText = data.vmid;
instanceArticle.append(vmid);
let name = document.createElement("p");
name.innerText = data.name;
instanceArticle.append(name);
let status = document.createElement("p");
status.innerText = data.status;
status.style.color = data.status === "running" ? "#00ff00" : "#ff0000";
instanceArticle.append(status);
let nodeName = document.createElement("p");
nodeName.innerText = data.node.name;
instanceArticle.append(nodeName);
let nodeStatus = document.createElement("p");
nodeStatus.innerText = data.node.status;
nodeStatus.style.color = data.node.status === "online" ? "#00ff00" : "#ff0000";
instanceArticle.append(nodeStatus);
}
}