add node data to instances

This commit is contained in:
Arthur Lu 2022-12-14 13:47:28 -08:00
parent f12be4b2a9
commit f81fea1268

View File

@ -14,8 +14,19 @@ async function init () {
let instanceContainer = document.getElementById("instance-container") let instanceContainer = document.getElementById("instance-container")
for (let i = 0; i < nodes.data.length; i++) { for (let i = 0; i < nodes.data.length; i++) {
let qemu = await request(`/nodes/${nodes.data[i].node}/qemu`, "GET"); let nodeName = nodes.data[i].node;
let lxc = await request(`/nodes/${nodes.data[i].node}/lxc`, "GET"); let nodeStatus = nodes.data[i].status;
let qemu = await request(`/nodes/${nodeName}/qemu`, "GET");
qemu.data.forEach((item) => {
item.node.name = nodeName;
item.node.status = nodeStatus;
});
let lxc = await request(`/nodes/${nodeName}/lxc`, "GET");
lxc.data.forEach((item) => {
item.node.name = nodeName;
item.node.status = nodeStatus;
});
instances = instances.concat(qemu.data, lxc.data); instances = instances.concat(qemu.data, lxc.data);
} }