From f004f1ad8a32ecbea17e3b61b7053a935a7318a3 Mon Sep 17 00:00:00 2001 From: Herbert Wolverson Date: Fri, 19 Jul 2024 10:56:58 -0500 Subject: [PATCH] You can click a node in the all tree to limit the top of the view. --- .../js_build/src/all_tree_sankey.js | 23 +++++++++++++++++++ .../node_manager/static2/all_tree_sankey.html | 5 +++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/rust/lqosd/src/node_manager/js_build/src/all_tree_sankey.js b/src/rust/lqosd/src/node_manager/js_build/src/all_tree_sankey.js index 7da350ac..0ce6adf2 100644 --- a/src/rust/lqosd/src/node_manager/js_build/src/all_tree_sankey.js +++ b/src/rust/lqosd/src/node_manager/js_build/src/all_tree_sankey.js @@ -2,6 +2,9 @@ import { DashboardGraph } from "./graphs/dashboard_graph"; import {lerpGreenToRedViaOrange} from "./helpers/scaling"; import {isRedacted} from "./helpers/redact"; +var allNodes = []; +let rootId = 0; + class AllTreeSankey extends DashboardGraph { constructor(id) { super(id); @@ -16,6 +19,20 @@ class AllTreeSankey extends DashboardGraph { }; this.option && this.chart.setOption(this.option); this.chart.hideLoading(); + this.chart.on('click', (params) => { + //console.log(params.name); + let name = params.name; + // If it contains a >, it's a link + if (name.indexOf(" > ") === -1) { + for (let i=0; i { rootId = 0; }); } update(data, links) { @@ -30,8 +47,10 @@ let lastRtt = {}; function start() { $.get("/local-api/networkTree", (data) => { + allNodes = data; //console.log(data); let redact = isRedacted(); + $("#rootNode").text(data[rootId][1].name); let nodes = []; let links = []; @@ -41,6 +60,10 @@ function start() { if (depth > maxDepth) { continue; } + // If data[i][1].parents does not contain rootId, skip + if (!data[i][1].parents.includes(rootId)) { + continue; + } let name = data[i][1].name; let bytes = data[i][1].current_throughput[0]; let bytesAsMegabits = bytes / 1000000; diff --git a/src/rust/lqosd/src/node_manager/static2/all_tree_sankey.html b/src/rust/lqosd/src/node_manager/static2/all_tree_sankey.html index 6a4aa63b..f814a08b 100644 --- a/src/rust/lqosd/src/node_manager/static2/all_tree_sankey.html +++ b/src/rust/lqosd/src/node_manager/static2/all_tree_sankey.html @@ -1,7 +1,10 @@ -
+
+ Top node::
+
+
\ No newline at end of file