From 55eff45f96b435de2d3d94a0189ff99473e7828d Mon Sep 17 00:00:00 2001 From: lemoer Date: Sun, 24 Nov 2019 02:38:55 +0100 Subject: [PATCH] gluon-status-page: prettify nextnode when node is offline --- .../files/lib/gluon/status-page/view/status-page.html | 2 +- package/gluon-status-page/javascript/status-page.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html b/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html index 0054e61f..cb7aaa11 100644 --- a/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html +++ b/package/gluon-status-page/files/lib/gluon/status-page/view/status-page.html @@ -135,7 +135,7 @@ <%:Load average%><%= statistics('loadavg', 'decimal') %> <%:RAM%><%= statistics('memory', 'memory') %> <%:Filesystem%><%= statistics('rootfs_usage', 'percent') %> - <%:Gateway%><%= statistics('gateway') %>
via <%= statistics('gateway_nexthop', 'neighbour') %> + <%:Gateway%><%= statistics('gateway') %>
<%= statistics('gateway_nexthop', 'neighbour') %> <%:Clients%><%= statistics('clients/total') %> diff --git a/package/gluon-status-page/javascript/status-page.js b/package/gluon-status-page/javascript/status-page.js index 005a0897..b81d21a7 100644 --- a/package/gluon-status-page/javascript/status-page.js +++ b/package/gluon-status-page/javascript/status-page.js @@ -113,15 +113,18 @@ return prettyBytes(bytes); }, 'neighbour': function(addr) { + if (!addr) + return ''; + for (var i in interfaces) { var iface = interfaces[i]; var neigh = iface.get_neigh(addr); if (!neigh) continue; - return neigh.get_hostname() + ' (' + i + ')'; + return 'via ' + neigh.get_hostname() + ' (' + i + ')'; } - return addr + ' (unknown iface)'; + return 'via ' + addr + ' (unknown iface)'; } }