mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Sort the circuit at capacity list.
This commit is contained in:
@@ -35,6 +35,11 @@ export class CircuitCapacityDash extends BaseDashlet {
|
||||
if (msg.event === "CircuitCapacity") {
|
||||
let target = document.getElementById(this.id);
|
||||
|
||||
// Sort msg.data by capacity[0]
|
||||
msg.data.sort((a, b) => {
|
||||
return b.capacity[0] - a.capacity[0];
|
||||
});
|
||||
|
||||
let table = document.createElement("table");
|
||||
table.classList.add("table", "table-striped", "small");
|
||||
let thead = document.createElement("thead");
|
||||
@@ -45,10 +50,14 @@ export class CircuitCapacityDash extends BaseDashlet {
|
||||
thead.appendChild(theading("RTT"));
|
||||
table.appendChild(thead);
|
||||
let tbody = document.createElement("tbody");
|
||||
let count = 0;
|
||||
msg.data.forEach((c) => {
|
||||
if (c.capacity[0] < 0.9 && c.capacity[1] < 0.9) {
|
||||
return;
|
||||
}
|
||||
if (count >= 7) {
|
||||
return;
|
||||
}
|
||||
let row = document.createElement("tr");
|
||||
row.classList.add("small");
|
||||
|
||||
@@ -64,6 +73,8 @@ export class CircuitCapacityDash extends BaseDashlet {
|
||||
row.appendChild(simpleRow((c.capacity[1]*100).toFixed(0)));
|
||||
row.appendChild(simpleRowHtml(formatRtt(c.rtt)));
|
||||
tbody.appendChild(row);
|
||||
|
||||
count++;
|
||||
})
|
||||
table.appendChild(tbody);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user