Support redaction on the tree graph

This commit is contained in:
Herbert Wolverson
2024-07-17 16:15:40 -05:00
parent 31757b12fc
commit 85e7835444
3 changed files with 11 additions and 5 deletions

1
src/rust/Cargo.lock generated
View File

@@ -3966,6 +3966,7 @@ dependencies = [
"ip_network_table",
"lqos_config",
"pyo3",
"reqwest",
"serde",
"serde_json",
"thiserror",

View File

@@ -1,5 +1,6 @@
import { DashboardGraph } from "./graphs/dashboard_graph";
import {lerpGreenToRedViaOrange} from "./helpers/scaling";
import {isRedacted} from "./helpers/redact";
class AllTreeSankey extends DashboardGraph {
constructor(id) {
@@ -30,6 +31,7 @@ let lastRtt = {};
function start() {
$.get("/local-api/networkTree", (data) => {
//console.log(data);
let redact = isRedacted();
let nodes = [];
let links = [];
@@ -50,12 +52,15 @@ function start() {
}
let color = lerpGreenToRedViaOrange(200 - lastRtt[name], 200);
let label = {
fontSize: 6,
color: "#999"
};
if (redact) label.fontSize = 0;
nodes.push({
name: data[i][1].name,
label: {
fontSize: 6,
color: "#999"
},
label: label,
itemStyle: {
color: color
}

View File

@@ -27,7 +27,7 @@ function cssRedact() {
}
}
function isRedacted() {
export function isRedacted() {
let prefs = localStorage.getItem("redact");
if (prefs === null) {
localStorage.setItem("redact", "false");