From 3be0c02595999988dcb86617eceecefd2d63bfe1 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sun, 11 Dec 2022 15:24:19 -0800 Subject: [PATCH] sort nodes and instances --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index cfc3e86..6acc027 100644 --- a/index.js +++ b/index.js @@ -12,13 +12,17 @@ async function init () { } let nodes = await request("/nodes", "GET", null); + nodes.data.sort((a, b) => (a.node > b.node) ? 1 : -1); + let nodeContainer = document.getElementById("node-container") for (let i = 0; i < nodes.data.length; i++) { let newNode = document.createElement("node-card"); newNode.data = nodes.data[i]; let qemu = await request(`/nodes/${nodes.data[i].node}/qemu`, "GET", null); + qemu.data.sort((a, b) => (a.vmid > b.vmid) ? 1 : -1); let lxc = await request(`/nodes/${nodes.data[i].node}/lxc`, "GET", null); + lxc.data.sort((a, b) => (a.vmid > b.vmid) ? 1 : -1); newNode.qemu = qemu.data; newNode.lxc = lxc.data;