mirror of https://github.com/aredn/aredn.git
Improve link status hint text (#1541)
This commit is contained in:
parent
0a3d322f53
commit
83e852044e
|
@ -41,6 +41,21 @@
|
||||||
function calcColor(tracker)
|
function calcColor(tracker)
|
||||||
{
|
{
|
||||||
if (tracker.blocked) {
|
if (tracker.blocked) {
|
||||||
|
if (tracker.blocks.user) {
|
||||||
|
return "blocked by user";
|
||||||
|
}
|
||||||
|
if (tracker.blocks.signal) {
|
||||||
|
return "blocked low signal";
|
||||||
|
}
|
||||||
|
if (tracker.blocks.signal) {
|
||||||
|
return "blocked too far";
|
||||||
|
}
|
||||||
|
if (tracker.blocks.quality) {
|
||||||
|
return "blocked by errors or latency";
|
||||||
|
}
|
||||||
|
if (tracker.blocks.dup || tracker.blocks.dtd) {
|
||||||
|
return "blocked as duplicate";
|
||||||
|
}
|
||||||
return "blocked";
|
return "blocked";
|
||||||
}
|
}
|
||||||
if (!tracker.routable) {
|
if (!tracker.routable) {
|
||||||
|
@ -106,15 +121,15 @@
|
||||||
for (let i = 0; i < length(llist); i++) {
|
for (let i = 0; i < length(llist); i++) {
|
||||||
const tracker = trackers[llist[i].mac];
|
const tracker = trackers[llist[i].mac];
|
||||||
const status = calcColor(tracker);
|
const status = calcColor(tracker);
|
||||||
print(`<div class="ctrl cols status ${status}" hx-get="status/e/neighbor-device?m=${tracker.mac}">`);
|
print(`<div class="ctrl cols status ${status}" hx-get="status/e/neighbor-device?m=${tracker.mac}" title='Link status: ${status}'>`);
|
||||||
const link = links[tracker.ip] || {};
|
const link = links[tracker.ip] || {};
|
||||||
const lq = link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier)) + "%") : "-";
|
const lq = link.lossMultiplier ? (min(100, int(100 * link.linkQuality * 65536 / link.lossMultiplier)) + "%") : "-";
|
||||||
const nlq = link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-";
|
const nlq = link.lossMultiplier ? (min(100, int(100 * link.neighborLinkQuality * 65536 / link.lossMultiplier)) + "%") : "-";
|
||||||
if (tracker.hostname) {
|
if (tracker.hostname) {
|
||||||
print(`<div style='flex:0.75'><a onclick="event.stopPropagation()" title='Link status: ${status}' href='http://${tracker.hostname}.local.mesh'>${tracker.hostname}</a></div>`);
|
print(`<div style='flex:0.75'><a onclick="event.stopPropagation()" href='http://${tracker.hostname}.local.mesh'>${tracker.hostname}</a></div>`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print(`<div style='flex:0.75'><a onclick="event.stopPropagation()" title='Link status: ${status}' href='http://${tracker.ip}'>${tracker.ip}</a></div>`);
|
print(`<div style='flex:0.75'><a onclick="event.stopPropagation()" href='http://${tracker.ip}'>${tracker.ip}</a></div>`);
|
||||||
}
|
}
|
||||||
print("<div class='ts cols stats'>");
|
print("<div class='ts cols stats'>");
|
||||||
print(`<div>${lq}</div><div>${nlq}</div><div></div><div></div><div>${100 - tracker.quality}%</div><div></div><div></div>`);
|
print(`<div>${lq}</div><div>${nlq}</div><div></div><div></div><div>${100 - tracker.quality}%</div><div></div><div></div>`);
|
||||||
|
|
Loading…
Reference in New Issue