arrange instance elements inline

This commit is contained in:
Arthur Lu 2022-12-14 15:38:13 -08:00
parent 223681ccc6
commit 90eba4904c
2 changed files with 20 additions and 9 deletions

View File

@ -4,6 +4,12 @@ article {
margin: 0px;
}
.instance-top-div {
.instance-div {
display: flex;
column-gap: 10px;
align-items: center;
}
.instance-div img {
height: 16px;
}

View File

@ -24,30 +24,35 @@ class Instance extends HTMLElement {
set data (data) {
let instanceArticle = this.shadowElement.querySelector("article");
let topDiv = document.createElement("div");
topDiv.classList.add("instance-top-div");
let detailDiv = document.createElement("div");
detailDiv.classList.add("instance-div");
let typeImg = document.createElement("img");
typeImg.src = `images/instances/${data.type}/${data.status}.svg`;
topDiv.append(typeImg);
detailDiv.append(typeImg);
let vmidParagraph = document.createElement("p");
vmidParagraph.innerText = data.vmid;
topDiv.append(vmidParagraph);
detailDiv.append(vmidParagraph);
let nameParagraph = document.createElement("p");
nameParagraph.innerText = data.name;
topDiv.append(nameParagraph);
detailDiv.append(nameParagraph);
instanceArticle.append(topDiv);
instanceArticle.append(detailDiv);
let nodeDiv = document.createElement("div");
nodeDiv.classList.add("instance-div");
let nodeImg = document.createElement("img");
nodeImg.src = `images/nodes/${data.node.status}.svg`;
instanceArticle.append(nodeImg);
nodeDiv.append(nodeImg);
let nodeParagraph = document.createElement("p");
nodeParagraph.innerText = data.node.name;
instanceArticle.append(nodeParagraph);
nodeDiv.append(nodeParagraph);
instanceArticle.append(nodeDiv);
}
}