gluon-status-page: make "gateway nexthop" a link (#2278)
With this commit, the gateway nexthop is now a clickable link, that leads to the status page of the nexthop.
This commit is contained in:
parent
e7df324639
commit
3a885a1b22
File diff suppressed because one or more lines are too long
@ -121,7 +121,15 @@
|
|||||||
var neigh = iface.lookup_neigh(addr);
|
var neigh = iface.lookup_neigh(addr);
|
||||||
if (!neigh)
|
if (!neigh)
|
||||||
continue;
|
continue;
|
||||||
return 'via ' + neigh.get_hostname() + ' (' + i + ')';
|
|
||||||
|
var span = document.createElement('span');
|
||||||
|
span.appendChild(document.createTextNode('via '));
|
||||||
|
var a = document.createElement('a');
|
||||||
|
a.href = 'http://[' + neigh.get_addr() + ']/';
|
||||||
|
a.textContent = neigh.get_hostname();
|
||||||
|
span.appendChild(a);
|
||||||
|
span.appendChild(document.createTextNode(' (' + i + ')'));
|
||||||
|
return span;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'via ' + addr + ' (unknown iface)';
|
return 'via ' + addr + ' (unknown iface)';
|
||||||
@ -264,9 +272,17 @@
|
|||||||
var valuePrev = resolve_key(dataPrev, stat);
|
var valuePrev = resolve_key(dataPrev, stat);
|
||||||
var value = resolve_key(data, stat);
|
var value = resolve_key(data, stat);
|
||||||
try {
|
try {
|
||||||
var text = formats[format](value, valuePrev, diff);
|
var format_result = formats[format](value, valuePrev, diff);
|
||||||
if (text !== undefined)
|
switch (typeof format_result) {
|
||||||
elem.textContent = text;
|
case "string":
|
||||||
|
elem.textContent = format_result;
|
||||||
|
break;
|
||||||
|
case "object":
|
||||||
|
if (elem.lastChild)
|
||||||
|
elem.removeChild(elem.lastChild);
|
||||||
|
elem.appendChild(format_result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
@ -492,6 +508,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var hostname = document.createElement("span");
|
var hostname = document.createElement("span");
|
||||||
|
var addr;
|
||||||
hostname.textContent = addr;
|
hostname.textContent = addr;
|
||||||
tdHostname.appendChild(hostname);
|
tdHostname.appendChild(hostname);
|
||||||
|
|
||||||
@ -664,8 +681,11 @@
|
|||||||
'get_hostname': function() {
|
'get_hostname': function() {
|
||||||
return hostname.textContent;
|
return hostname.textContent;
|
||||||
},
|
},
|
||||||
|
'get_addr': function() {
|
||||||
|
return addr;
|
||||||
|
},
|
||||||
'update_nodeinfo': function(nodeinfo) {
|
'update_nodeinfo': function(nodeinfo) {
|
||||||
var addr = choose_address(nodeinfo.network.addresses);
|
addr = choose_address(nodeinfo.network.addresses);
|
||||||
if (addr) {
|
if (addr) {
|
||||||
if (hostname.nodeName.toLowerCase() === 'span') {
|
if (hostname.nodeName.toLowerCase() === 'span') {
|
||||||
var oldHostname = hostname;
|
var oldHostname = hostname;
|
||||||
|
Loading…
Reference in New Issue
Block a user