Tree capacity now includes a link to the tree (duh), and is redactable.

This commit is contained in:
Herbert Wolverson 2024-07-17 10:10:23 -05:00
parent 1ea75039ee
commit 4580f499fc
3 changed files with 12 additions and 3 deletions

View File

@ -61,7 +61,7 @@ export class TopTreeSummary extends BaseDashlet {
let link = document.createElement("a");
link.href = "/tree.html?id=" + r[0];
link.innerText = r[1].name;
link.classList.add("tiny");
link.classList.add("tiny", "redactable");
nameCol.appendChild(link);
row.appendChild(nameCol);

View File

@ -62,7 +62,14 @@ export class TreeCapacityDash extends BaseDashlet {
let row = document.createElement("tr");
row.classList.add("small");
row.appendChild(simpleRow(node.name));
let linkCol = document.createElement("td");
let link = document.createElement("a");
link.href = "/node.html?id=" + node.id;
link.innerText = node.name;
link.classList.add("tiny", "redactable");
linkCol.appendChild(link);
row.appendChild(linkCol());
row.appendChild(simpleRowHtml(formatPercent(down*100)));
row.appendChild(simpleRowHtml(formatPercent(up*100)));
row.appendChild(simpleRowHtml(formatRtt(node.rtt)));

View File

@ -7,6 +7,7 @@ use crate::shaped_devices_tracker::NETWORK_JSON;
#[derive(Serialize)]
struct NodeCapacity {
id: usize,
name: String,
down: f64,
up: f64,
@ -22,7 +23,7 @@ pub async fn tree_capacity(channels: Arc<PubSub>) {
let capacities: Vec<_> = {
if let Ok(reader) = NETWORK_JSON.read() {
reader.get_nodes_when_ready().iter().map(|node| {
reader.get_nodes_when_ready().iter().enumerate().map(|(id, node)| {
let node = node.clone_to_transit();
let down = node.current_throughput.0 as f64 * 8.0 / 1_000_000.0;
let up = node.current_throughput.1 as f64 * 8.0 / 1_000_000.0;
@ -40,6 +41,7 @@ pub async fn tree_capacity(channels: Arc<PubSub>) {
};
NodeCapacity {
id,
name: node.name.clone(),
down,
up,