simplify instacne node assignment

This commit is contained in:
Arthur Lu 2022-12-14 14:11:20 -08:00
parent 0a72233baa
commit b5901cb002

View File

@ -18,17 +18,9 @@ async function init () {
let nodeStatus = nodes.data[i].status; let nodeStatus = nodes.data[i].status;
let qemu = await request(`/nodes/${nodeName}/qemu`, "GET"); let qemu = await request(`/nodes/${nodeName}/qemu`, "GET");
qemu.data.forEach((item) => { qemu.data.forEach((item) => {item.node = {name: nodeName, status: nodeStatus}});
item.node = {};
item.node.name = nodeName;
item.node.status = nodeStatus;
});
let lxc = await request(`/nodes/${nodeName}/lxc`, "GET"); let lxc = await request(`/nodes/${nodeName}/lxc`, "GET");
lxc.data.forEach((item) => { lxc.data.forEach((item) => {item.node = {name: nodeName, status: nodeStatus}});
item.node = {};
item.node.name = nodeName;
item.node.status = nodeStatus;
});
instances = instances.concat(qemu.data, lxc.data); instances = instances.concat(qemu.data, lxc.data);
} }