mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Start unifying dashboard tables
This commit is contained in:
parent
8707ede766
commit
f60a67a1f1
@ -1,6 +1,6 @@
|
||||
import {BaseDashlet} from "./base_dashlet";
|
||||
import {RttHistogram} from "../graphs/rtt_histo";
|
||||
import {clearDashDiv, theading} from "../helpers/builders";
|
||||
import {clearDashDiv, theading, topNTableHeader, topNTableRow} from "../helpers/builders";
|
||||
import {scaleNumber, rttCircleSpan, formatThroughput, formatRtt, formatRetransmit} from "../helpers/scaling";
|
||||
import {redactCell} from "../helpers/redact";
|
||||
|
||||
@ -39,60 +39,11 @@ export class Top10Downloaders extends BaseDashlet {
|
||||
let t = document.createElement("table");
|
||||
t.classList.add("table", "table-striped", "table-sm");
|
||||
|
||||
let th = document.createElement("thead");
|
||||
th.classList.add("small");
|
||||
th.appendChild(theading("IP Address/Circuit"));
|
||||
th.appendChild(theading("Plan"));
|
||||
th.appendChild(theading("DL ⬇️"));
|
||||
th.appendChild(theading("UL ⬆️"));
|
||||
th.appendChild(theading("RTT (ms)"));
|
||||
th.appendChild(theading("TCP Retransmits", 2));
|
||||
t.appendChild(th);
|
||||
t.appendChild(topNTableHeader());
|
||||
|
||||
let tbody = document.createElement("tbody");
|
||||
msg.data.forEach((r) => {
|
||||
let row = document.createElement("tr");
|
||||
row.classList.add("small");
|
||||
|
||||
if (r.circuit_id !== "") {
|
||||
let link = document.createElement("a");
|
||||
link.href = "circuit.html?id=" + encodeURI(r.circuit_id);
|
||||
link.innerText = r.ip_address;
|
||||
redactCell(link);
|
||||
row.append(link);
|
||||
} else {
|
||||
let ip = document.createElement("td");
|
||||
ip.innerText = r.ip_address;
|
||||
redactCell(ip);
|
||||
row.append(ip);
|
||||
}
|
||||
|
||||
let shaped = document.createElement("td");
|
||||
shaped.classList.add("tiny");
|
||||
shaped.innerText = r.plan.down + " / " + r.plan.up;
|
||||
row.append(shaped);
|
||||
|
||||
let dl = document.createElement("td");
|
||||
dl.innerHTML = formatThroughput(r.bits_per_second.down, r.plan.down);
|
||||
row.append(dl);
|
||||
|
||||
let ul = document.createElement("td");
|
||||
ul.innerHTML = formatThroughput(r.bits_per_second.up, r.plan.up);
|
||||
row.append(ul);
|
||||
|
||||
let rtt = document.createElement("td");
|
||||
rtt.innerHTML = formatRtt(r.median_tcp_rtt);
|
||||
row.append(rtt);
|
||||
|
||||
let tcp_xmit_down = document.createElement("td");
|
||||
tcp_xmit_down.innerHTML = formatRetransmit(r.tcp_retransmits.down);
|
||||
row.append(tcp_xmit_down);
|
||||
|
||||
let tcp_xmit_up = document.createElement("td");
|
||||
tcp_xmit_up.innerHTML = formatRetransmit(r.tcp_retransmits.up);
|
||||
row.append(tcp_xmit_up);
|
||||
|
||||
t.appendChild(row);
|
||||
t.appendChild(topNTableRow(r));
|
||||
});
|
||||
t.appendChild(tbody);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {BaseDashlet} from "./base_dashlet";
|
||||
import {RttHistogram} from "../graphs/rtt_histo";
|
||||
import {clearDashDiv, theading} from "../helpers/builders";
|
||||
import {clearDashDiv, theading, topNTableHeader, topNTableRow} from "../helpers/builders";
|
||||
import {scaleNumber, rttCircleSpan, formatThroughput, formatRtt} from "../helpers/scaling";
|
||||
import {redactCell} from "../helpers/redact";
|
||||
|
||||
@ -37,52 +37,13 @@ export class Worst10Downloaders extends BaseDashlet {
|
||||
let target = document.getElementById(this.id);
|
||||
|
||||
let t = document.createElement("table");
|
||||
t.classList.add("table", "table-striped", "tiny");
|
||||
t.classList.add("table", "table-striped", "small");
|
||||
|
||||
let th = document.createElement("thead");
|
||||
th.appendChild(theading(""));
|
||||
th.appendChild(theading("IP Address/Circuit"));
|
||||
th.appendChild(theading("DL ⬇️"));
|
||||
th.appendChild(theading("UL ⬆️"));
|
||||
th.appendChild(theading("RTT (ms)"));
|
||||
th.appendChild(theading("TCP Retransmits"));
|
||||
th.appendChild(theading("Shaped"));
|
||||
t.appendChild(th);
|
||||
t.appendChild(topNTableHeader());
|
||||
|
||||
let tbody = document.createElement("tbody");
|
||||
msg.data.forEach((r) => {
|
||||
let row = document.createElement("tr");
|
||||
|
||||
let circle = document.createElement("td");
|
||||
circle.appendChild(rttCircleSpan(r.median_tcp_rtt));
|
||||
row.appendChild(circle);
|
||||
|
||||
let ip = document.createElement("td");
|
||||
ip.innerText = r.ip_address;
|
||||
redactCell(ip);
|
||||
row.append(ip);
|
||||
|
||||
let dl = document.createElement("td");
|
||||
dl.innerHTML = formatThroughput(r.bits_per_second.down, r.plan.down);
|
||||
row.append(dl);
|
||||
|
||||
let ul = document.createElement("td");
|
||||
ul.innerHTML = formatThroughput(r.bits_per_second.up, r.plan.up);
|
||||
row.append(ul);
|
||||
|
||||
let rtt = document.createElement("td");
|
||||
rtt.innerHTML = formatRtt(r.median_tcp_rtt);
|
||||
row.append(rtt);
|
||||
|
||||
let tcp_xmit = document.createElement("td");
|
||||
tcp_xmit.innerText = r.tcp_retransmits.down + " / " + r.tcp_retransmits.up;
|
||||
row.append(tcp_xmit);
|
||||
|
||||
let shaped = document.createElement("td");
|
||||
shaped.innerText = r.plan.down + " / " + r.plan.up;
|
||||
row.append(shaped);
|
||||
|
||||
t.appendChild(row);
|
||||
t.appendChild(topNTableRow(r));
|
||||
});
|
||||
t.appendChild(tbody);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {BaseDashlet} from "./base_dashlet";
|
||||
import {RttHistogram} from "../graphs/rtt_histo";
|
||||
import {clearDashDiv, theading} from "../helpers/builders";
|
||||
import {clearDashDiv, theading, topNTableHeader, topNTableRow} from "../helpers/builders";
|
||||
import {scaleNumber, rttCircleSpan, formatRtt, formatThroughput} from "../helpers/scaling";
|
||||
import {redactCell} from "../helpers/redact";
|
||||
|
||||
@ -39,50 +39,11 @@ export class Worst10Retransmits extends BaseDashlet {
|
||||
let t = document.createElement("table");
|
||||
t.classList.add("table", "table-striped", "tiny");
|
||||
|
||||
let th = document.createElement("thead");
|
||||
th.appendChild(theading(""));
|
||||
th.appendChild(theading("IP Address/Circuit"));
|
||||
th.appendChild(theading("DL ⬇️"));
|
||||
th.appendChild(theading("UL ⬆️"));
|
||||
th.appendChild(theading("RTT (ms)"));
|
||||
th.appendChild(theading("TCP Retransmits"));
|
||||
th.appendChild(theading("Shaped"));
|
||||
t.appendChild(th);
|
||||
t.appendChild(topNTableHeader());
|
||||
|
||||
let tbody = document.createElement("tbody");
|
||||
msg.data.forEach((r) => {
|
||||
let row = document.createElement("tr");
|
||||
|
||||
let circle = document.createElement("td");
|
||||
circle.appendChild(rttCircleSpan(r.median_tcp_rtt));
|
||||
row.appendChild(circle);
|
||||
|
||||
let ip = document.createElement("td");
|
||||
ip.innerText = r.ip_address;
|
||||
redactCell(ip);
|
||||
row.append(ip);
|
||||
|
||||
let dl = document.createElement("td");
|
||||
dl.innerHTML = formatThroughput(r.bits_per_second.down, r.plan.down);
|
||||
row.append(dl);
|
||||
|
||||
let ul = document.createElement("td");
|
||||
ul.innerHTML = formatThroughput(r.bits_per_second.up, r.plan.up);
|
||||
row.append(ul);
|
||||
|
||||
let rtt = document.createElement("td");
|
||||
rtt.innerHTML = formatRtt(r.median_tcp_rtt);
|
||||
row.append(rtt);
|
||||
|
||||
let tcp_xmit = document.createElement("td");
|
||||
tcp_xmit.innerText = r.tcp_retransmits.down + " / " + r.tcp_retransmits.up;
|
||||
row.append(tcp_xmit);
|
||||
|
||||
let shaped = document.createElement("td");
|
||||
shaped.innerText = r.plan.down + " / " + r.plan.up;
|
||||
row.append(shaped);
|
||||
|
||||
t.appendChild(row);
|
||||
t.appendChild(topNTableRow(r));
|
||||
});
|
||||
t.appendChild(tbody);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {scaleNanos} from "./scaling";
|
||||
import {formatRetransmit, formatRtt, formatThroughput, scaleNanos} from "./scaling";
|
||||
import {redactCell} from "./redact";
|
||||
|
||||
export function heading5Icon(icon, text) {
|
||||
let h5 = document.createElement("h5");
|
||||
@ -99,4 +100,61 @@ export function formatLastSeen(n) {
|
||||
result = scaleNanos(n, 0) + " ago";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function topNTableHeader() {
|
||||
let th = document.createElement("thead");
|
||||
th.classList.add("small");
|
||||
th.appendChild(theading("IP Address/Circuit"));
|
||||
th.appendChild(theading("Plan"));
|
||||
th.appendChild(theading("DL ⬇️"));
|
||||
th.appendChild(theading("UL ⬆️"));
|
||||
th.appendChild(theading("RTT (ms)"));
|
||||
th.appendChild(theading("TCP Retransmits", 2));
|
||||
return th;
|
||||
}
|
||||
|
||||
export function topNTableRow(r) {
|
||||
let row = document.createElement("tr");
|
||||
row.classList.add("small");
|
||||
|
||||
if (r.circuit_id !== "") {
|
||||
let link = document.createElement("a");
|
||||
link.href = "circuit.html?id=" + encodeURI(r.circuit_id);
|
||||
link.innerText = r.ip_address;
|
||||
redactCell(link);
|
||||
row.append(link);
|
||||
} else {
|
||||
let ip = document.createElement("td");
|
||||
ip.innerText = r.ip_address;
|
||||
redactCell(ip);
|
||||
row.append(ip);
|
||||
}
|
||||
|
||||
let shaped = document.createElement("td");
|
||||
shaped.classList.add("tiny");
|
||||
shaped.innerText = r.plan.down + " / " + r.plan.up;
|
||||
row.append(shaped);
|
||||
|
||||
let dl = document.createElement("td");
|
||||
dl.innerHTML = formatThroughput(r.bits_per_second.down, r.plan.down);
|
||||
row.append(dl);
|
||||
|
||||
let ul = document.createElement("td");
|
||||
ul.innerHTML = formatThroughput(r.bits_per_second.up, r.plan.up);
|
||||
row.append(ul);
|
||||
|
||||
let rtt = document.createElement("td");
|
||||
rtt.innerHTML = formatRtt(r.median_tcp_rtt);
|
||||
row.append(rtt);
|
||||
|
||||
let tcp_xmit_down = document.createElement("td");
|
||||
tcp_xmit_down.innerHTML = formatRetransmit(r.tcp_retransmits.down);
|
||||
row.append(tcp_xmit_down);
|
||||
|
||||
let tcp_xmit_up = document.createElement("td");
|
||||
tcp_xmit_up.innerHTML = formatRetransmit(r.tcp_retransmits.up);
|
||||
row.append(tcp_xmit_up);
|
||||
|
||||
return row;
|
||||
}
|
Loading…
Reference in New Issue
Block a user