diff --git a/src/rust/lqosd/src/node_manager/js_build/src/helpers/scaling.js b/src/rust/lqosd/src/node_manager/js_build/src/helpers/scaling.js index 5d802f05..f739301a 100644 --- a/src/rust/lqosd/src/node_manager/js_build/src/helpers/scaling.js +++ b/src/rust/lqosd/src/node_manager/js_build/src/helpers/scaling.js @@ -62,20 +62,9 @@ export function formatThroughput(throughput, limitInMbps) { if (limitBits > 0) { percent = (throughput / limitBits) * 100; } - let blob = ""; - blob += ""; - for (let i=0; i<100; i+=10) { - let color = lerpGreenToRedViaOrange(100-i, 100); - if (percent < i) { - blob += "░"; - } else { - blob += ""; - } - } - blob += ""; - - blob += "" + scaleNumber(throughput, 1) + "bps"; - blob += ""; + let color = lerpGreenToRedViaOrange(100-percent, 100); + let blob = ""; + blob += "" + scaleNumber(throughput, 1) + "bps"; return blob; } @@ -88,30 +77,16 @@ export function formatRtt(rtt) { if (limit > 0) { percent = (rtt / limit) * 100; } - let blob = ""; - blob += ""; - for (let i=0; i<100; i+=10) { - let color = lerpGreenToRedViaOrange(100-i, 100); - if (percent < i) { - blob += "░"; - } else { - blob += ""; - } - } - blob += ""; - - blob += "" + parseFloat(rtt).toFixed(0) + " ms"; - blob += ""; + let color = lerpGreenToRedViaOrange(100-percent, 100); + let blob = ""; + blob += "" + parseFloat(rtt).toFixed(0) + "ms"; return blob; } export function formatRetransmit(retransmits) { let percent = Math.min(100, retransmits) / 100; let color = lerpColor([0, 255, 0], [255, 0, 0], percent); - let html = ""; - html += retransmits; - html += ""; - return html; + return "" + retransmits + ""; } export function formatCakeStat(n) { diff --git a/src/rust/lqosd/src/node_manager/js_build/src/tree.js b/src/rust/lqosd/src/node_manager/js_build/src/tree.js index 5063b92a..7e86870f 100644 --- a/src/rust/lqosd/src/node_manager/js_build/src/tree.js +++ b/src/rust/lqosd/src/node_manager/js_build/src/tree.js @@ -4,7 +4,6 @@ import { formatRetransmit, formatRtt, formatThroughput, - lerpGreenToRedViaOrange, scaleNumber } from "./helpers/scaling"; import {subscribeWS} from "./pubsub/ws"; @@ -250,7 +249,7 @@ function treeUpdate(msg) { col = document.getElementById("re-xmit-down-" + nodeId); if (col !== null) { if (node.current_retransmits[0] !== undefined) { - col.textContent = node.current_retransmits[0]; + col.innerHTML = formatRetransmit(node.current_retransmits[0]); } else { col.textContent = "-"; } @@ -258,7 +257,7 @@ function treeUpdate(msg) { col = document.getElementById("re-xmit-up-" + nodeId); if (col !== null) { if (node.current_retransmits[1] !== undefined) { - col.textContent = node.current_retransmits[1]; + col.innerHTML = formatRetransmit(node.current_retransmits[1]); } else { col.textContent = "-"; }