From e4840583a31032051a1d11ef4bee37577f630cd2 Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Wed, 3 Jul 2024 12:43:55 -0500 Subject: [PATCH] Shaped Devices page includes a count of devices and circuits --- .../node_manager/js_build/src/shaped-devices.js | 16 ++++++++++++++++ .../src/node_manager/static2/shaped_devices.html | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/rust/lqosd/src/node_manager/js_build/src/shaped-devices.js b/src/rust/lqosd/src/node_manager/js_build/src/shaped-devices.js index ac265a0c..353cbe47 100644 --- a/src/rust/lqosd/src/node_manager/js_build/src/shaped-devices.js +++ b/src/rust/lqosd/src/node_manager/js_build/src/shaped-devices.js @@ -124,12 +124,28 @@ function fillTable() { target.appendChild(pages); } +function countCircuits() { + let entries = {}; + shapedDevices.forEach((d) => { + if (!entries.hasOwnProperty(d.circuit_id)) { + entries[d.circuit_id] = 1; + } + }) + let count = 0; + for (const i in entries) { + count++; + } + return count; +} + function loadDevices() { $.get("/local-api/devicesAll", (data) => { //console.log(data); shapedDevices = data; displayDevices = data; fillTable(); + $("#count").text(shapedDevices.length + " devices"); + $("#countCircuit").text(countCircuits() + " circuits"); }) } diff --git a/src/rust/lqosd/src/node_manager/static2/shaped_devices.html b/src/rust/lqosd/src/node_manager/static2/shaped_devices.html index 490bae9d..5a0fd529 100644 --- a/src/rust/lqosd/src/node_manager/static2/shaped_devices.html +++ b/src/rust/lqosd/src/node_manager/static2/shaped_devices.html @@ -1,6 +1,6 @@
-
Shaped Devices
+
Shaped Devices ? ?