add qemu and lxc instance populating
This commit is contained in:
parent
1f4c0310ca
commit
bb06579219
10
index.js
10
index.js
@ -16,12 +16,12 @@ async function init () {
|
|||||||
for (let i = 0; i < nodes.data.length; i++) {
|
for (let i = 0; i < nodes.data.length; i++) {
|
||||||
let newNode = document.createElement("node-card");
|
let newNode = document.createElement("node-card");
|
||||||
newNode.data = nodes.data[i];
|
newNode.data = nodes.data[i];
|
||||||
nodeContainer.append(newNode);
|
|
||||||
let qemu = await request(`/nodes/${nodes.data[i].node}/qemu`, "GET", null);
|
let qemu = await request(`/nodes/${nodes.data[i].node}/qemu`, "GET", null);
|
||||||
let lxc = await request(`/nodes/${nodes.data[i].node}/lxc`, "GET", null);
|
let lxc = await request(`/nodes/${nodes.data[i].node}/lxc`, "GET", null);
|
||||||
console.log(`${nodes.data[i].node} quemu:`);
|
newNode.qemu = qemu;
|
||||||
console.log(qemu);
|
newNode.lxc = lxc;
|
||||||
console.log(`${nodes.data[i].node} lxc:`);
|
|
||||||
console.log(lxc);
|
nodeContainer.append(newNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
24
node.js
24
node.js
@ -27,6 +27,30 @@ class Node extends HTMLElement {
|
|||||||
onlineLabel.style.color = data.status === "online" ? "#00ff00" : "#ff0000";
|
onlineLabel.style.color = data.status === "online" ? "#00ff00" : "#ff0000";
|
||||||
articleElement.append(onlineLabel);
|
articleElement.append(onlineLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set qemu (qemu) {
|
||||||
|
let articleElement = this.shadowElement.querySelector("article");
|
||||||
|
|
||||||
|
let qemuDiv = document.createElement("div");
|
||||||
|
for (let i = 0; i < qemu.length; i++) {
|
||||||
|
let instanceParagraph = document.createElement("p");
|
||||||
|
instanceParagraph.innerText = `${qemu[i].vmid}: ${qemu[i].name}`;
|
||||||
|
qemuDiv.append(instanceParagraph);
|
||||||
|
}
|
||||||
|
articleElement.append(qemuDiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
set lxc (lxc) {
|
||||||
|
let articleElement = this.shadowElement.querySelector("article");
|
||||||
|
|
||||||
|
let lxcDiv = document.createElement("div");
|
||||||
|
for (let i = 0; i < lxc.length; i++) {
|
||||||
|
let instanceParagraph = document.createElement("p");
|
||||||
|
instanceParagraph.innerText = `${lxc[i].vmid}: ${lxc[i].name}`;
|
||||||
|
lxcDiv.append(instanceParagraph);
|
||||||
|
}
|
||||||
|
articleElement.append(lxcDiv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("node-card", Node);
|
customElements.define("node-card", Node);
|
Loading…
Reference in New Issue
Block a user