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 91624f3b30..0aac36de87 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,15 +126,20 @@ 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]; s += String.format( '
' + - '
%s
' + - '
%s
' + - '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + '
', service.url, service.descr, service.proto, service.origin_link, service.origin || '?' ); @@ -152,16 +157,13 @@ end
<%:Internal services%> -
-
+
<%:Url%>
<%:Protocol%>
<%:Source%>
-
-
<% for k, line in ipairs(services) do local field = {} @@ -178,13 +180,12 @@ end %>
- -
<%=proto%>
- + +
<%=proto%>
+
<% i = ((i % 2) + 1) end %> -

<%=last_update%> diff --git a/applications/luci-app-olsr/luasrc/controller/olsr.lua b/applications/luci-app-olsr/luasrc/controller/olsr.lua index dc424c0114..11e27d7c00 100644 --- a/applications/luci-app-olsr/luasrc/controller/olsr.lua +++ b/applications/luci-app-olsr/luasrc/controller/olsr.lua @@ -331,6 +331,8 @@ end function action_interfaces() local data, has_v4, has_v6, error = fetch_jsoninfo('interfaces') + local ntm = require "luci.model.network".init() + if error then return end @@ -339,6 +341,13 @@ function action_interfaces() return a.proto < b.proto end + for k, v in ipairs(data) do + local interface = ntm:get_status_by_address(v.olsrInterface.ipAddress) + if interface then + v.interface = interface + end + end + table.sort(data, compare) luci.template.render("status-olsr/interfaces", {iface=data, has_v4=has_v4, has_v6=has_v6}) end 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 f04d926918..34cf563363 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]; @@ -62,9 +67,9 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, } s += String.format( - '
%s
' + - '
%s
' + - '
%s
', hna.destination + '/' + hna.genmask, linkgw + hostname, validity + '
%s
' + + '
%s
' + + '
%s
', hna.destination + '/' + hna.genmask, linkgw + hostname, validity ) s += '
' } @@ -80,21 +85,18 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<%:Overview of currently active OLSR host net announcements%> -
-
+
<%:Announced network%>
<%:OLSR gateway%>
<%:Validity Time%>
-
-
<% for k, route in ipairs(hna) do %>
-
<%=hna[k].destination%>/<%=hna[k].genmask%>
-
+
<%=hna[k].destination%>/<%=hna[k].genmask%>
+
<% if hna[k].proto == '6' then %> <%=hna[k].gateway%> <% else %> @@ -110,12 +112,11 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, validity = '-' end %> -
<%=validity%>
+
<%=validity%>
<% i = ((i % 2) + 1) end %> -
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm index 7506f07029..12f7cba967 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm @@ -21,6 +21,7 @@ local i = 1
<%:Interface%>
+
<%:Device%>
<%:State%>
<%:MTU%>
<%:WLAN%>
@@ -32,13 +33,14 @@ local i = 1 <% for k, iface in ipairs(iface) do %>
-
<%=iface.name%>
-
<%=iface.olsrInterface.up and luci.i18n.translate('up') or luci.i18n.translate('down')%>
-
<%=iface.olsrInterface.mtu%>
-
<%=iface.olsrInterface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
-
<%=iface.olsrInterface.ipAddress%>
-
<%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Netmask%>
-
<%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Broadcast or iface.olsrInterface.ipv6Multicast%>
+
<%=iface.interface%>
+
<%=iface.name%>
+
<%=iface.olsrInterface.up and luci.i18n.translate('up') or luci.i18n.translate('down')%>
+
<%=iface.olsrInterface.mtu%>
+
<%=iface.olsrInterface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
+
<%=iface.olsrInterface.ipAddress%>
+
<%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Netmask%>
+
<%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Broadcast or iface.olsrInterface.ipv6Multicast%>
<% i = ((i % 2) + 1) end %> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm index 9babd50a80..469d89111a 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm @@ -38,8 +38,8 @@ local i = 1 %>
- -
<%=aliases%>
+ +
<%=aliases%>
<% i = ((i % 2) + 1) 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 29ea95694c..8cdda14916 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]; @@ -64,34 +74,34 @@ end if (neigh.proto == '6') { s += String.format( '
' + - '', + '', neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip ); } else { s += String.format( '
' + - '', + '', neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip ); } if (neigh.hn) { s += String.format( - '', + '', neigh.dfgcolor, neigh.hn, neigh.hn ); } else { s += String.format( - '
?
', + '
?
', neigh.dfgcolor ); } s += String.format( - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + + '
%s
' + + '
%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,9 +121,8 @@ end
<%:Overview of currently established OLSR connections%> -
-
-
+
+
<%:Neighbour IP%>
<%:Hostname%>
<%:Interface%>
@@ -123,9 +132,7 @@ end
ETX
SNR
-
-
<% local i = 1 for k, link in ipairs(links) do link.linkCost = tonumber(link.linkCost) or 0 @@ -148,22 +155,21 @@ end
<% if link.proto == "6" then %> - + <% else %> - + <% end %> - -
<%=link.interface%>
-
<%=link.localIP%>
-
<%=string.format("%.3f", link.linkQuality)%>
-
<%=string.format("%.3f", link.neighborLinkQuality)%>
-
<%=string.format("%.3f", link.linkCost)%>
-
<%=link.snr%>
+ +
<%=link.interface%>
+
<%=link.localIP%>
+
<%=string.format("%.3f", link.linkQuality)%>
+
<%=string.format("%.3f", link.neighborLinkQuality)%>
+
<%=string.format("%.3f", link.linkCost)%>
+
<%=link.snr%>
<% i = ((i % 2) + 1) end %> -

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 4b733524a5..624047f40c 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,21 +43,28 @@ 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]; s += String.format( '
' + - '
%s/%s
' + - '
' + + '
%s/%s
' + + '
' + '%s', route.proto, route.dest, route.genmask, route.gw, route.gw ) if (route.hostname) { - if (hna.proto == '6') { + if (route.proto == '6') { s += String.format( ' / %s', route.hostname, route.hostname || '?' @@ -72,9 +79,9 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, } s += String.format( '
' + - '
%s
' + - '
%s
' + - '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + '
', route.interface, route.metric, route.color, route.etx || '?' ); @@ -95,27 +102,23 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
<%:Overview of currently known routes to other OLSR nodes%> -
-
-
+
+
<%:Announced network%>
<%:OLSR gateway%>
<%:Interface%>
<%:Metric%>
ETX
-
- -
<% for k, route in ipairs(routes) do - ETX = tonumber(route.rtpMetricCost)/1024 or '0' + ETX = tonumber(route.etx) or '0' color = olsrtools.etx_color(ETX) %>
-
<%=route.destination%>/<%=route.genmask%>
-
+
<%=route.destination%>/<%=route.genmask%>
+
<% if route.proto == '6' then %> <%=route.gateway%> <% else %> @@ -125,14 +128,13 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, / <%=route.hostname%> <% end %>
-
<%=route.networkInterface%>
-
<%=route.metric%>
-
<%=string.format("%.3f", ETX)%>
+
<%=route.networkInterface%>
+
<%=route.metric%>
+
<%=string.format("%.3f", ETX)%>
<% i = ((i % 2) + 1) end %> -
<%+status-olsr/legend%> 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 ba36ce980a..8cd2088e42 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm @@ -19,7 +19,7 @@ if luci.http.formvalue("status") == "1" then local rv = {} for k, gw in ipairs(gws.ipv4, gws.ipv6) do gw.cost = tonumber(gw.cost)/1024 or 0 - if gw.cost == 4096 then + if gw.cost >= 100 then gw.cost = 0 end @@ -27,7 +27,7 @@ if luci.http.formvalue("status") == "1" then proto = gw.IPv4 and '4' or '6', originator = gw.originator, selected = gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no'), - cost = string.format("%.3f", gw.cost), + cost = gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinate'), hops = gw.hops, uplink = gw.uplink, downlink = gw.downlink, @@ -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]; @@ -64,15 +75,15 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, } s += String.format( - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
' + - '
%s
', + '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + + '
%s
' + + '
%s
', linkgw, smartgw.selected, smartgw.cost, smartgw.hops, smartgw.uplink, smartgw.downlink, smartgw.v4, smartgw.v6, smartgw.prefix ) s += '
' @@ -83,9 +94,6 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, ); //]]> - -<%+header%> -

<%:SmartGW announcements%>

@@ -94,8 +102,7 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<%:Overview of smart gateways in this network%> -
-
+
<%:Gateway%>
<%:Selected%>
@@ -106,39 +113,35 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<%:IPv4%>
<%:IPv6%>
<%:Prefix%>
- -
-
- <% for k, gw in ipairs(gws) do + <% for k, gw in ipairs(gws.ipv4, gws.ipv6) do gw.cost = tonumber(gw.cost)/1024 or 0 - if gw.cost == 4096 then + if gw.cost >= 100 then gw.cost = 0 end %>
<% if gw.proto == '6' then %> - + <% else %> - + <% end %> -
<%=gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
-
<%=string.format("%.3f", gw.cost)%>
-
<%=gw.hops%>
-
<%=gw.uplink%>
-
<%=gw.downlink%>
-
<%=gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
-
<%=gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
-
<%=gw.prefix%>
+
<%=gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
+
<%=gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinate')%>
+
<%=gw.hops%>
+
<%=gw.uplink%>
+
<%=gw.downlink%>
+
<%=gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
+
<%=gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
+
<%=gw.prefix%>
<% i = ((i % 2) + 1) end %> -
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm index 02fdfddac3..fe673c4111 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm @@ -27,7 +27,7 @@ local olsrtools = require "luci.tools.olsr"
<% for k, route in ipairs(routes) do - local cost = string.format("%.3f", tonumber(route.tcEdgeCost/1024) or 0) + local cost = string.format("%.3f", tonumber(route.tcEdgeCost) or 0) local color = olsrtools.etx_color(tonumber(cost)) local lq = string.format("%.3f", tonumber(route.linkQuality) or 0) local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0) @@ -37,19 +37,19 @@ local olsrtools = require "luci.tools.olsr" <% if route.proto == "6" then %> - - + + <% else %> - - + + <%end%> -
<%=lq%>
-
<%=nlq%>
-
<%=cost%>
+
<%=lq%>
+
<%=nlq%>
+
<%=cost%>
<% i = ((i % 2) + 1) diff --git a/applications/luci-app-olsr/po/de/olsr.po b/applications/luci-app-olsr/po/de/olsr.po index 2f387413ff..15b8412a26 100644 --- a/applications/luci-app-olsr/po/de/olsr.po +++ b/applications/luci-app-olsr/po/de/olsr.po @@ -1201,6 +1201,10 @@ msgstr "" #~ msgid "Status" #~ msgstr "Status" +#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97 +msgid "Selected" +msgstr "Ausgewählt" + #~ msgid "Device" #~ msgstr "Schnittstelle" diff --git a/applications/luci-app-olsr/po/en/olsr.po b/applications/luci-app-olsr/po/en/olsr.po index bd7ee6fcbf..a009f84854 100644 --- a/applications/luci-app-olsr/po/en/olsr.po +++ b/applications/luci-app-olsr/po/en/olsr.po @@ -1088,6 +1088,10 @@ msgstr "" msgid "yes" msgstr "" +#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97 +msgid "Selected" +msgstr "" + #~ msgid "" #~ "Make sure that OLSRd is running, the \"txtinfo\" plugin is loaded, " #~ "configured on port 2006 and accepts connections from \"127.0.0.1\"." diff --git a/applications/luci-app-olsr/po/templates/olsr.pot b/applications/luci-app-olsr/po/templates/olsr.pot index 49f5d63501..521af613ed 100644 --- a/applications/luci-app-olsr/po/templates/olsr.pot +++ b/applications/luci-app-olsr/po/templates/olsr.pot @@ -1073,3 +1073,8 @@ msgstr "" #: applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:135 msgid "yes" msgstr "" + +#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97 +msgid "Selected" +msgstr "" +