From 3e0a6a64e30429d3df01260e02142b5f9fab0d21 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 3 Apr 2022 12:33:19 +0200 Subject: [PATCH] gluon-status-page: Use as browsers can add it automatically --- .../gluon/status-page/view/status-page.html | 59 +++++++++++-------- .../status-page/www/static/status-page.js | 2 +- .../javascript/status-page.js | 10 ++-- 3 files changed, 41 insertions(+), 30 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 703cf436..c489294a 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 @@ -209,41 +209,50 @@

<%:Monitoring%>

- - - - - + + + + + + +
<%:Uptime%><%= statistics('uptime', 'time') %>
<%:Load average%><%= statistics('loadavg', 'decimal') %>
<%:RAM%><%= statistics('memory', 'memory') %>
<%:Filesystem%><%= statistics('rootfs_usage', 'percent') %>
<%:Gateway%><%= statistics('gateway') %>
<%= statistics('gateway_nexthop', 'neighbour') %>
<%:Uptime%><%= statistics('uptime', 'time') %>
<%:Load average%><%= statistics('loadavg', 'decimal') %>
<%:RAM%><%= statistics('memory', 'memory') %>
<%:Filesystem%><%= statistics('rootfs_usage', 'percent') %>
<%:Gateway%><%= statistics('gateway') %>
<%= statistics('gateway_nexthop', 'neighbour') %>

<%:Clients%>

- - - + + + + +
<%:Total%><%= statistics('clients/total') %>
<%:Wireless 2.4 GHz%><%= statistics('clients/wifi24') %>
<%:Wireless 5 GHz%><%= statistics('clients/wifi5') %>
<%:Total%><%= statistics('clients/total') %>
<%:Wireless 2.4 GHz%><%= statistics('clients/wifi24') %>
<%:Wireless 5 GHz%><%= statistics('clients/wifi5') %>
<% if radios[1] then -%>

<%:Radios%>

- <% for _, radio in ipairs(radios) do -%> + + <% for _, radio in ipairs(radios) do -%> - <%- end %> + <%- end %> +
<%| radio.name %> <%| translatef('Channel %u', radio.channel) %>
<%- end %>

<%:Traffic%>

- - - + + + + +
<%:Transmitted%><%= statisticsTraffic('traffic/tx') %>
<%:Received%><%= statisticsTraffic('traffic/rx') %>
<%:Forwarded%><%= statisticsTraffic('traffic/forward') %>
<%:Transmitted%><%= statisticsTraffic('traffic/tx') %>
<%:Received%><%= statisticsTraffic('traffic/rx') %>
<%:Forwarded%><%= statisticsTraffic('traffic/forward') %>
@@ -259,17 +268,19 @@

<%| iface %>

> - - - <% for i, v in ipairs(mesh.attrs or {}) do %> - ><%| v[2] %> - <% end %> - <% if wireless then %> - - - - <% end %> - + + + + <% for i, v in ipairs(mesh.attrs or {}) do %> + ><%| v[2] %> + <% end %> + <% if wireless then %> + + + + <% end %> + +
<%:Node%>dBm<%:Distance%><%:Last seen%>
<%:Node%>dBm<%:Distance%><%:Last seen%>
<% diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js b/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js index 21c3c692..6427c749 100644 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js @@ -1 +1 @@ -"use strict";!function(){var i=JSON.parse(document.body.getAttribute("data-translations"));function r(t,e){return t.toFixed(e).replace(/\./,i["."])}function a(t,e){e--;for(var n=t;10<=n&&0e[0]||t[1]e[1]?1:0});t=t[0][2];return t&&!/^fe80:/i.test(t)?t:void 0}}return t.wireless&&((g=a.insertCell()).textContent="-",g.setAttribute("data-label",i.children[Object.keys(s).length+1].textContent),(v=a.insertCell()).textContent="-",v.setAttribute("data-label",i.children[Object.keys(s).length+2].textContent),(p=a.insertCell()).textContent="-",p.setAttribute("data-label",i.children[Object.keys(s).length+3].textContent),m=A(e),t.signalgraph.addSignal(m)),a.onmouseenter=function(){a.classList.add("highlight"),m&&(m.highlight=!0)},a.onmouseleave=function(){a.classList.remove("highlight"),m&&(m.highlight=!1)},y(),{get_hostname:function(){return u.textContent},get_addr:function(){return o},update_nodeinfo:function(t){var e,n,r,i,a;(o=E(t.network.addresses))&&("span"===u.nodeName.toLowerCase()&&(a=u,u=document.createElement("a"),a.parentNode.replaceChild(u,a)),u.href="http://["+o+"]/"),u.textContent=t.hostname,x&&t.location&&(e=x.latitude,n=x.longitude,r=t.location.latitude,i=t.location.longitude,a=Math.PI/180,t=(r*=a)-(e*=a),n=(i*=a)-(n*=a),r=Math.sin(t/2)*Math.sin(t/2)+Math.sin(n/2)*Math.sin(n/2)*Math.cos(e)*Math.cos(r),r=6372.8*(2*Math.asin(Math.sqrt(r))),v.textContent=Math.round(1e3*r)+" m"),y()},update_mesh:function(n){Object.keys(s).forEach(function(t){var e=s[t];e.td.textContent=n[t]+e.suffix}),y()},update_wifi:function(t){g.textContent=t.signal,p.textContent=Math.round(t.inactive/1e3)+" s",a.classList.toggle("inactive",200e[0]||t[1]e[1]?1:0}),t=t[0][2],t&&!/^fe80:/i.test(t)?t:void 0}return t.wireless&&((g=a.insertCell()).textContent="-",g.setAttribute("data-label",r.children[Object.keys(s).length+1].textContent),(m=a.insertCell()).textContent="-",m.setAttribute("data-label",r.children[Object.keys(s).length+2].textContent),(p=a.insertCell()).textContent="-",p.setAttribute("data-label",r.children[Object.keys(s).length+3].textContent),v=A(e),t.signalgraph.addSignal(v)),a.onmouseenter=function(){a.classList.add("highlight"),v&&(v.highlight=!0)},a.onmouseleave=function(){a.classList.remove("highlight"),v&&(v.highlight=!1)},y(),{get_hostname:function(){return l.textContent},get_addr:function(){return o},update_nodeinfo:function(t){var e,n,i,r,a;(o=w(t.network.addresses))&&("span"===l.nodeName.toLowerCase()&&(e=l,l=document.createElement("a"),e.parentNode.replaceChild(l,e)),l.href="http://["+o+"]/"),l.textContent=t.hostname,x&&t.location&&(e=x.latitude,n=x.longitude,i=t.location.latitude,t=t.location.longitude,r=Math.PI/180,a=(i*=r)-(e*=r),t=(t*=r)-(n*=r),r=Math.sin(a/2)*Math.sin(a/2)+Math.sin(t/2)*Math.sin(t/2)*Math.cos(e)*Math.cos(i),n=6372.8*(2*Math.asin(Math.sqrt(r))),m.textContent=Math.round(1e3*n)+" m"),y()},update_mesh:function(n){Object.keys(s).forEach(function(t){var e=s[t];e.td.textContent=n[t]+e.suffix}),y()},update_wifi:function(t){g.textContent=t.signal,p.textContent=Math.round(t.inactive/1e3)+" s",a.classList.toggle("inactive",200