summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status/htdocs/luci-static
diff options
context:
space:
mode:
authorPaul Donald <newtwen+github@gmail.com>2024-11-05 19:06:49 +0100
committerPaul Donald <newtwen+github@gmail.com>2024-11-05 19:06:49 +0100
commit7dde3239e0a779eddd29e0b52ff4a7929fb9517d (patch)
tree82bb4c50765c96bae80f72544533817ce4c958a4 /modules/luci-mod-status/htdocs/luci-static
parent247820d85498d7e2ec961a575ae15af88e5145d7 (diff)
luci-mod-status: rework interface status info
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'modules/luci-mod-status/htdocs/luci-static')
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js23
1 files changed, 7 insertions, 16 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js
index 0d051bdeaf..e87aa34542 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js
@@ -24,29 +24,20 @@ function renderbox(ifc, ipv6) {
expires = ifc.getExpiry(),
uptime = ifc.getUptime();
+ function addEntries(label, array) {
+ return Array.isArray(array) ? array.flatMap((item) => [label, item]) : [label, null];
+ }
+
return E('div', { class: 'ifacebox' }, [
E('div', { class: 'ifacebox-head center ' + (active ? 'active' : '') },
E('strong', ipv6 ? _('IPv6 Upstream') : _('IPv4 Upstream'))),
E('div', { class: 'ifacebox-body left' }, [
L.itemlist(E('span'), [
_('Protocol'), ifc.getI18n() || E('em', _('Not connected')),
- _('Prefix Delegated'), ipv6 ? ifc.getIP6Prefix() : null,
- _('Address'), addrs[0],
- _('Address'), addrs[1],
- _('Address'), addrs[2],
- _('Address'), addrs[3],
- _('Address'), addrs[4],
- _('Address'), addrs[5],
- _('Address'), addrs[6],
- _('Address'), addrs[7],
- _('Address'), addrs[8],
- _('Address'), addrs[9],
+ ...addEntries(_('Prefix Delegated'), ipv6 ? ifc.getIP6Prefixes?.() : null),
+ ...addEntries(_('Address'), addrs),
_('Gateway'), ipv6 ? (ifc.getGateway6Addr() || '::') : (ifc.getGatewayAddr() || '0.0.0.0'),
- _('DNS') + ' 1', dnssrv[0],
- _('DNS') + ' 2', dnssrv[1],
- _('DNS') + ' 3', dnssrv[2],
- _('DNS') + ' 4', dnssrv[3],
- _('DNS') + ' 5', dnssrv[4],
+ ...addEntries(_('DNS'), dnssrv),
_('Expires'), (expires != null && expires > -1) ? '%t'.format(expires) : null,
_('Connected'), (uptime > 0) ? '%t'.format(uptime) : null
]),