From d2bda6c34bada854893ddf935ed3794cfab2579b Mon Sep 17 00:00:00 2001 From: pmelange Date: Sun, 18 Nov 2018 14:26:23 +0100 Subject: [PATCH] luci-app-olsr: reenable the "auto refresh" feature Signed-off-by: pmelange --- .../luasrc/view/freifunk-services/services.htm | 9 +++++++-- .../luasrc/view/status-olsr/hna.htm | 9 +++++++-- .../luasrc/view/status-olsr/neighbors.htm | 16 +++++++++++++--- .../luasrc/view/status-olsr/routes.htm | 17 ++++++++++++----- .../luasrc/view/status-olsr/smartgw.htm | 16 +++++++++++++--- 5 files changed, 52 insertions(+), 15 deletions(-) diff --git a/applications/luci-app-olsr-services/luasrc/view/freifunk-services/services.htm b/applications/luci-app-olsr-services/luasrc/view/freifunk-services/services.htm index f6a81d002..0aac36de8 100644 --- a/applications/luci-app-olsr-services/luasrc/view/freifunk-services/services.htm +++ b/applications/luci-app-olsr-services/luasrc/view/freifunk-services/services.htm @@ -126,7 +126,12 @@ end var tbody = document.getElementById('olsr_services'); if (tbody) { - var s = ''; + var s = '
' + + '
<%:Url%>
' + + '
<%:Protocol%>
' + + '
<%:Source%>
' + + '
'; + for (var idx = 0; idx < info.length; idx++) { var service = info[idx]; @@ -152,7 +157,7 @@ end
<%:Internal services%> -
+
<%:Url%>
<%:Protocol%>
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm index 85cdc5f47..34cf56336 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm @@ -35,7 +35,12 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, var hnadiv = document.getElementById('olsrd_hna'); if (hnadiv) { - var s = ''; + var s = '
' + + '
<%:Announced network%>
' + + '
<%:OLSR gateway%>
' + + '
<%:Validity Time%>
' + + '
'; + for (var idx = 0; idx < info.length; idx++) { var hna = info[idx]; @@ -80,7 +85,7 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<%:Overview of currently active OLSR host net announcements%> -
+
<%:Announced network%>
<%:OLSR gateway%>
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm index 262326b49..8cdda1491 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm @@ -56,7 +56,17 @@ end var nt = document.getElementById('olsr_neigh_table'); if (nt) { - var s = ''; + var s = '
' + + '
<%:Neighbour IP%>
' + + '
<%:Hostname%>
' + + '
<%:Interface%>
' + + '
<%:Local interface IP%>
' + + '
LQ
' + + '
NLQ
' + + '
ETX
' + + '
SNR
' + + '
'; + for (var idx = 0; idx < info.length; idx++) { var neigh = info[idx]; @@ -91,7 +101,7 @@ end '
%s
' + '
%s
' + '
%s
' + - '
%s
' + + '
%s
' + '
', neigh.dfgcolor, neigh.ifn, neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?' ); @@ -111,7 +121,7 @@ end
<%:Overview of currently established OLSR connections%> -
+
<%:Neighbour IP%>
<%:Hostname%>
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm index ba738c016..624047f40 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm @@ -13,7 +13,7 @@ local i = 1 if luci.http.formvalue("status") == "1" then local rv = {} for k, route in ipairs(routes) do - local ETX = string.format("%.3f", tonumber(route.rtpMetricCost)/1024 or 0) + local ETX = string.format("%.3f", tonumber(route.etx) or 0) rv[#rv+1] = { hostname = route.hostname, dest = route.destination, @@ -43,7 +43,14 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, var rt = document.getElementById('olsrd_routes'); if (rt) { - var s = ''; + var s = '
' + + '
<%:Announced network%>
' + + '
<%:OLSR gateway%>
' + + '
<%:Interface%>
' + + '
<%:Metric%>
' + + '
ETX
' + + '
'; + for (var idx = 0; idx < info.length; idx++) { var route = info[idx]; @@ -57,7 +64,7 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, ) if (route.hostname) { - if (hna.proto == '6') { + if (route.proto == '6') { s += String.format( ' / %s', route.hostname, route.hostname || '?' @@ -95,8 +102,8 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
<%:Overview of currently known routes to other OLSR nodes%> -
-
+
+
<%:Announced network%>
<%:OLSR gateway%>
<%:Interface%>
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm index fc86e17d9..8cd2088e4 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm @@ -51,7 +51,18 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, var smartgwdiv = document.getElementById('olsrd_smartgw'); if (smartgwdiv) { - var s = ''; + var s = '
' + + '
<%:Gateway%>
' + + '
<%:Selected%>
' + + '
<%:ETX%>
' + + '
<%:Hops%>
' + + '
<%:Uplink%>
' + + '
<%:Downlink%>
' + + '
<%:IPv4%>
' + + '
<%:IPv6%>
' + + '
<%:Prefix%>
' + + '
'; + for (var idx = 0; idx < info.length; idx++) { var smartgw = info[idx]; @@ -91,7 +102,7 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<%:Overview of smart gateways in this network%> -
+
<%:Gateway%>
<%:Selected%>
@@ -102,7 +113,6 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<%:IPv4%>
<%:IPv6%>
<%:Prefix%>
-
<% for k, gw in ipairs(gws.ipv4, gws.ipv6) do -- 2.25.1