separate instance card data elements

This commit is contained in:
Arthur Lu 2022-12-14 14:42:40 -08:00
parent ffa468fba2
commit bdec04aaf7

View File

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