From caf2dd037ba4b560a0794ce87d6a230e7a6cbcf8 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sun, 24 Nov 2019 01:15:18 +0100 Subject: [PATCH 1/3] gluon-status-page: add gateway_nexthop to status page statistics --- .../lib/gluon/status-page/view/status-page.html | 1 + package/gluon-status-page/i18n/de.po | 3 +++ .../gluon-status-page/i18n/gluon-status-page.pot | 3 +++ .../gluon-status-page/javascript/status-page.js | 14 ++++++++++++++ 4 files changed, 21 insertions(+) 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 6e18b010..641c79aa 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 @@ -136,6 +136,7 @@ <%:RAM%><%= statistics('memory', 'memory') %> <%:Filesystem%><%= statistics('rootfs_usage', 'percent') %> <%:Gateway%><%= statistics('gateway') %> + <%:Gateway Nexthop%><%= statistics('gateway_nexthop', 'neighbour') %> <%:Clients%><%= statistics('clients/total') %> diff --git a/package/gluon-status-page/i18n/de.po b/package/gluon-status-page/i18n/de.po index ef0374c0..5caebfde 100644 --- a/package/gluon-status-page/i18n/de.po +++ b/package/gluon-status-page/i18n/de.po @@ -55,6 +55,9 @@ msgstr "Weitergeleitet" msgid "Gateway" msgstr "Gateway" +msgid "Gateway Nexthop" +msgstr "Gateway Nexthop" + msgid "IP address" msgstr "IP-Adresse" diff --git a/package/gluon-status-page/i18n/gluon-status-page.pot b/package/gluon-status-page/i18n/gluon-status-page.pot index 766a5de8..e471e878 100644 --- a/package/gluon-status-page/i18n/gluon-status-page.pot +++ b/package/gluon-status-page/i18n/gluon-status-page.pot @@ -46,6 +46,9 @@ msgstr "" msgid "Gateway" msgstr "" +msgid "Gateway Nexthop" +msgstr "" + msgid "IP address" msgstr "" diff --git a/package/gluon-status-page/javascript/status-page.js b/package/gluon-status-page/javascript/status-page.js index e3405cf6..005a0897 100644 --- a/package/gluon-status-page/javascript/status-page.js +++ b/package/gluon-status-page/javascript/status-page.js @@ -112,6 +112,17 @@ 'bytes': function(bytes) { return prettyBytes(bytes); }, + 'neighbour': function(addr) { + for (var i in interfaces) { + var iface = interfaces[i]; + var neigh = iface.get_neigh(addr); + if (!neigh) + continue; + return neigh.get_hostname() + ' (' + i + ')'; + } + + return addr + ' (unknown iface)'; + } } @@ -582,6 +593,9 @@ } return { + 'get_hostname': function() { + return hostname.textContent; + }, 'update_nodeinfo': function(nodeinfo) { var addr = choose_address(nodeinfo.network.addresses); if (addr) { From 07ebac6a49a288a3f5b7c7fc4e45a38b265ff929 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sun, 24 Nov 2019 02:12:47 +0100 Subject: [PATCH 2/3] gluon-status-page: show gateway_nexthop and gateway in one table row --- .../files/lib/gluon/status-page/view/status-page.html | 3 +-- 1 file changed, 1 insertion(+), 2 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 641c79aa..0054e61f 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,8 +135,7 @@ <%:Load average%><%= statistics('loadavg', 'decimal') %> <%:RAM%><%= statistics('memory', 'memory') %> <%:Filesystem%><%= statistics('rootfs_usage', 'percent') %> - <%:Gateway%><%= statistics('gateway') %> - <%:Gateway Nexthop%><%= statistics('gateway_nexthop', 'neighbour') %> + <%:Gateway%><%= statistics('gateway') %>
via <%= statistics('gateway_nexthop', 'neighbour') %> <%:Clients%><%= statistics('clients/total') %> From 55eff45f96b435de2d3d94a0189ff99473e7828d Mon Sep 17 00:00:00 2001 From: lemoer Date: Sun, 24 Nov 2019 02:38:55 +0100 Subject: [PATCH 3/3] 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)'; } }