luci-app-olsr: make cosmetic changes.

modify the status tables so that then headers and columns align, values
left justified.

Additionally, add the openwrt style interface name to the interfaces table,
change huge  ETX numbers to 'infinate', and add the german translation for
'Selected'.

Signed-off-by: pmelange <isprotejesvalkata@gmail.com>
This commit is contained in:
pmelange 2018-11-15 14:55:42 +01:00
parent a92c94df32
commit 7387553a04
12 changed files with 107 additions and 107 deletions

View file

@ -132,9 +132,9 @@ end
var service = info[idx]; var service = info[idx];
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' +
'<div class="td cbi-section-table-titles"><a href="%s">%s</a></div>' + '<div class="td cbi-section-table-cell" style="text-align: left"><a href="%s">%s</a></div>' +
'<div class="td cbi-section-table-titles">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-titles"><a href="http://%s/cgi-bin-status.html">%s</a></div>' + '<div class="td cbi-section-table-cell" style="text-align: left"><a href="http://%s/cgi-bin-status.html">%s</a></div>' +
'</div>', '</div>',
service.url, service.descr, service.proto, service.origin_link, service.origin || '?' service.url, service.descr, service.proto, service.origin_link, service.origin || '?'
); );
@ -153,15 +153,12 @@ end
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Internal services%></legend> <legend><%:Internal services%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Url%></div> <div class="th cbi-section-table-cell"><%:Url%></div>
<div class="th cbi-section-table-cell"><%:Protocol%></div> <div class="th cbi-section-table-cell"><%:Protocol%></div>
<div class="th cbi-section-table-cell"><%:Source%></div> <div class="th cbi-section-table-cell"><%:Source%></div>
</div> </div>
</div>
<div class="tbody" id="olsr_services">
<% <%
for k, line in ipairs(services) do for k, line in ipairs(services) do
local field = {} local field = {}
@ -178,13 +175,12 @@ end
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%>">
<div class="td cbi-section-table-titles"><a href="<%=url%>"><%=descr%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="<%=url%>"><%=descr%></a></div>
<div class="td cbi-section-table-titles"><%=proto%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=proto%></div>
<div class="td cbi-section-table-titles"><a href="http://<%=origin_link%>/cgi-bin-status.html"><%=origin%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://<%=origin_link%>/cgi-bin-status.html"><%=origin%></a></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>
</div>
</div> </div>
<br /> <br />
<%=last_update%> <%=last_update%>

View file

@ -331,6 +331,8 @@ end
function action_interfaces() function action_interfaces()
local data, has_v4, has_v6, error = fetch_jsoninfo('interfaces') local data, has_v4, has_v6, error = fetch_jsoninfo('interfaces')
local ntm = require "luci.model.network".init()
if error then if error then
return return
end end
@ -339,6 +341,13 @@ function action_interfaces()
return a.proto < b.proto return a.proto < b.proto
end 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) table.sort(data, compare)
luci.template.render("status-olsr/interfaces", {iface=data, has_v4=has_v4, has_v6=has_v6}) luci.template.render("status-olsr/interfaces", {iface=data, has_v4=has_v4, has_v6=has_v6})
end end

View file

@ -62,9 +62,9 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
} }
s += String.format( s += String.format(
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity
) )
s += '</div>' s += '</div>'
} }
@ -81,20 +81,17 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<legend><%:Overview of currently active OLSR host net announcements%></legend> <legend><%:Overview of currently active OLSR host net announcements%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Announced network%></div> <div class="th cbi-section-table-cell"><%:Announced network%></div>
<div class="th cbi-section-table-cell"><%:OLSR gateway%></div> <div class="th cbi-section-table-cell"><%:OLSR gateway%></div>
<div class="th cbi-section-table-cell"><%:Validity Time%></div> <div class="th cbi-section-table-cell"><%:Validity Time%></div>
</div> </div>
</div>
<div class="tbody" id="olsrd_hna">
<% for k, route in ipairs(hna) do %> <% for k, route in ipairs(hna) do %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>">
<div class="td cbi-section-table-cell"><%=hna[k].destination%>/<%=hna[k].genmask%> </div> <div class="td cbi-section-table-cell" style="text-align: left"><%=hna[k].destination%>/<%=hna[k].genmask%> </div>
<div class="td cbi-section-table-cell"> <div class="td cbi-section-table-cell" style="text-align: left">
<% if hna[k].proto == '6' then %> <% if hna[k].proto == '6' then %>
<a href="http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%></a> <a href="http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%></a>
<% else %> <% else %>
@ -110,12 +107,11 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
validity = '-' validity = '-'
end %> end %>
<div class="td cbi-section-table-cell"><%=validity%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=validity%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>
</div>
</div> </div>
</fieldset> </fieldset>

View file

@ -21,6 +21,7 @@ local i = 1
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="tr"> <div class="tr">
<div class="th cbi-section-table-cell"><%:Interface%></div> <div class="th cbi-section-table-cell"><%:Interface%></div>
<div class="th cbi-section-table-cell"><%:Device%></div>
<div class="th cbi-section-table-cell"><%:State%></div> <div class="th cbi-section-table-cell"><%:State%></div>
<div class="th cbi-section-table-cell"><%:MTU%></div> <div class="th cbi-section-table-cell"><%:MTU%></div>
<div class="th cbi-section-table-cell"><%:WLAN%></div> <div class="th cbi-section-table-cell"><%:WLAN%></div>
@ -32,13 +33,14 @@ local i = 1
<% for k, iface in ipairs(iface) do %> <% for k, iface in ipairs(iface) do %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=iface.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=iface.proto%>">
<div class="td cbi-section-table-cell"><%=iface.name%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.interface%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrInterface.up and luci.i18n.translate('up') or luci.i18n.translate('down')%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.name%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrInterface.mtu%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.olsrInterface.up and luci.i18n.translate('up') or luci.i18n.translate('down')%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrInterface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.olsrInterface.mtu%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrInterface.ipAddress%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.olsrInterface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Netmask%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.olsrInterface.ipAddress%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Broadcast or iface.olsrInterface.ipv6Multicast%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Netmask%></div>
<div class="td cbi-section-table-cell" style="text-align: left"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Broadcast or iface.olsrInterface.ipv6Multicast%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>

View file

@ -38,8 +38,8 @@ local i = 1
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=mid.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=mid.proto%>">
<div class="td cbi-section-table-cell"><a href="http://<%=host%>/cgi-bin-status.html"><%=mid.main.ipAddress%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://<%=host%>/cgi-bin-status.html"><%=mid.main.ipAddress%></a></div>
<div class="td cbi-section-table-cell"><%=aliases%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=aliases%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)

View file

@ -64,34 +64,34 @@ end
if (neigh.proto == '6') { if (neigh.proto == '6') {
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
'<div class="td cbi-section-table-titles" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s</a></div>', '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left"><a href="http://[%s]/cgi-bin-status.html">%s</a></div>',
neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip
); );
} else { } else {
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
'<div class="td cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>', '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left"><a href="http://%s/cgi-bin-status.html">%s</a></div>',
neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip
); );
} }
if (neigh.hn) { if (neigh.hn) {
s += String.format( s += String.format(
'<div class="td cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>', '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left"><a href="http://%s/cgi-bin-status.html">%s</a></div>',
neigh.dfgcolor, neigh.hn, neigh.hn neigh.dfgcolor, neigh.hn, neigh.hn
); );
} else { } else {
s += String.format( s += String.format(
'<div class="td cbi-section-table-titles" style="background-color:%s">?</div>', '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">?</div>',
neigh.dfgcolor neigh.dfgcolor
); );
} }
s += String.format( s += String.format(
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s" title="Signal: %s Noise: %s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left" title="Signal: %s Noise: %s">%s</div>' +
'</div>', '</div>',
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 || '?' 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 || '?'
); );
@ -112,8 +112,7 @@ end
<legend><%:Overview of currently established OLSR connections%></legend> <legend><%:Overview of currently established OLSR connections%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="thead"> <div class="tr cbi-section-table-cell">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Neighbour IP%></div> <div class="th cbi-section-table-cell"><%:Neighbour IP%></div>
<div class="th cbi-section-table-cell"><%:Hostname%></div> <div class="th cbi-section-table-cell"><%:Hostname%></div>
<div class="th cbi-section-table-cell"><%:Interface%></div> <div class="th cbi-section-table-cell"><%:Interface%></div>
@ -123,9 +122,7 @@ end
<div class="th cbi-section-table-cell">ETX</div> <div class="th cbi-section-table-cell">ETX</div>
<div class="th cbi-section-table-cell">SNR</div> <div class="th cbi-section-table-cell">SNR</div>
</div> </div>
</div>
<div class="tbody" id="olsr_neigh_table">
<% local i = 1 <% local i = 1
for k, link in ipairs(links) do for k, link in ipairs(links) do
link.linkCost = tonumber(link.linkCost) or 0 link.linkCost = tonumber(link.linkCost) or 0
@ -148,22 +145,21 @@ end
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>">
<% if link.proto == "6" then %> <% if link.proto == "6" then %>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></div>
<% else %> <% else %>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></div>
<% end %> <% end %>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.interface%></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><%=link.interface%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.localIP%></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><%=link.localIP%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><%=string.format("%.3f", link.linkQuality)%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></div> <div class="td cbi-section-table-cell" style="background-color:<%=defaultgw_color%>; text-align: left"><%=string.format("%.3f", link.neighborLinkQuality)%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></div> <div class="td cbi-section-table-cell" style="background-color:<%=color%>; text-align: left"><%=string.format("%.3f", link.linkCost)%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=snr_color%>" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></div> <div class="td cbi-section-table-cell" style="background-color:<%=snr_color%>; text-align: left" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></div>
</div> </div>
<% <%
i = ((i % 2) + 1) i = ((i % 2) + 1)
end %> end %>
</div>
</div> </div>
<br /> <br />

View file

@ -50,8 +50,8 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
'<div class="td cbi-section-table-cell">%s/%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s/%s</div>' +
'<div class="td cbi-section-table-cell">' + '<div class="td cbi-section-table-cell" style="text-align: left">' +
'<a href="http://%s/cgi-bin-status.html">%s</a>', '<a href="http://%s/cgi-bin-status.html">%s</a>',
route.proto, route.dest, route.genmask, route.gw, route.gw route.proto, route.dest, route.genmask, route.gw, route.gw
) )
@ -72,9 +72,9 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
} }
s += String.format( s += String.format(
'</div>' + '</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell" style="background-color:%s; text-align: left">%s</div>' +
'</div>', '</div>',
route.interface, route.metric, route.color, route.etx || '?' route.interface, route.metric, route.color, route.etx || '?'
); );
@ -96,7 +96,6 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
<legend><%:Overview of currently known routes to other OLSR nodes%></legend> <legend><%:Overview of currently known routes to other OLSR nodes%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Announced network%></div> <div class="th cbi-section-table-cell"><%:Announced network%></div>
<div class="th cbi-section-table-cell"><%:OLSR gateway%></div> <div class="th cbi-section-table-cell"><%:OLSR gateway%></div>
@ -104,18 +103,15 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
<div class="th cbi-section-table-cell"><%:Metric%></div> <div class="th cbi-section-table-cell"><%:Metric%></div>
<div class="th cbi-section-table-cell">ETX</div> <div class="th cbi-section-table-cell">ETX</div>
</div> </div>
</div>
<div class="tbody" id="olsrd_routes">
<% for k, route in ipairs(routes) do <% 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) color = olsrtools.etx_color(ETX)
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>">
<div class="td cbi-section-table-cell"><%=route.destination%>/<%=route.genmask%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=route.destination%>/<%=route.genmask%></div>
<div class="td cbi-section-table-cell"> <div class="td cbi-section-table-cell" style="text-align: left">
<% if route.proto == '6' then %> <% if route.proto == '6' then %>
<a href="http://[<%=route.gateway%>]/cgi-bin-status.html"><%=route.gateway%></a> <a href="http://[<%=route.gateway%>]/cgi-bin-status.html"><%=route.gateway%></a>
<% else %> <% else %>
@ -125,14 +121,13 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
/ <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.hostname%></a> / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.hostname%></a>
<% end %> <% end %>
</div> </div>
<div class="td cbi-section-table-cell"><%=route.networkInterface%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=route.networkInterface%></div>
<div class="td cbi-section-table-cell"><%=route.metric%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=route.metric%></div>
<div class="td cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", ETX)%></div> <div class="td cbi-section-table-cell" style="background-color:<%=color%>; text-align: left"><%=string.format("%.3f", ETX)%></div>
</div> </div>
<% <%
i = ((i % 2) + 1) i = ((i % 2) + 1)
end %> end %>
</div>
</div> </div>
<%+status-olsr/legend%> <%+status-olsr/legend%>

View file

@ -19,7 +19,7 @@ if luci.http.formvalue("status") == "1" then
local rv = {} local rv = {}
for k, gw in ipairs(gws.ipv4, gws.ipv6) do for k, gw in ipairs(gws.ipv4, gws.ipv6) do
gw.cost = tonumber(gw.cost)/1024 or 0 gw.cost = tonumber(gw.cost)/1024 or 0
if gw.cost == 4096 then if gw.cost >= 100 then
gw.cost = 0 gw.cost = 0
end end
@ -27,7 +27,7 @@ if luci.http.formvalue("status") == "1" then
proto = gw.IPv4 and '4' or '6', proto = gw.IPv4 and '4' or '6',
originator = gw.originator, originator = gw.originator,
selected = gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no'), 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, hops = gw.hops,
uplink = gw.uplink, uplink = gw.uplink,
downlink = gw.downlink, downlink = gw.downlink,
@ -64,15 +64,15 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
} }
s += String.format( s += String.format(
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>', '<div class="td cbi-section-table-cell" style="text-align: left">%s</div>',
linkgw, smartgw.selected, smartgw.cost, smartgw.hops, smartgw.uplink, smartgw.downlink, smartgw.v4, smartgw.v6, smartgw.prefix linkgw, smartgw.selected, smartgw.cost, smartgw.hops, smartgw.uplink, smartgw.downlink, smartgw.v4, smartgw.v6, smartgw.prefix
) )
s += '</div>' s += '</div>'
@ -83,9 +83,6 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
); );
//]]></script> //]]></script>
<%+header%>
<h2 name="content"><%:SmartGW announcements%></h2> <h2 name="content"><%:SmartGW announcements%></h2>
<div id="togglebuttons"></div> <div id="togglebuttons"></div>
@ -95,7 +92,6 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Overview of smart gateways in this network%></legend> <legend><%:Overview of smart gateways in this network%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Gateway%></div> <div class="th cbi-section-table-cell"><%:Gateway%></div>
<div class="th cbi-section-table-cell"><%:Selected%></div> <div class="th cbi-section-table-cell"><%:Selected%></div>
@ -108,37 +104,34 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<div class="th cbi-section-table-cell"><%:Prefix%></div> <div class="th cbi-section-table-cell"><%:Prefix%></div>
</div> </div>
</div>
<div class="tbody" id="olsrd_smartgw"> <% for k, gw in ipairs(gws.ipv4, gws.ipv6) do
<% for k, gw in ipairs(gws) do
gw.cost = tonumber(gw.cost)/1024 or 0 gw.cost = tonumber(gw.cost)/1024 or 0
if gw.cost == 4096 then if gw.cost >= 100 then
gw.cost = 0 gw.cost = 0
end end
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=proto%>">
<% if gw.proto == '6' then %> <% if gw.proto == '6' then %>
<div class="td cbi-section-table-cell"><a href="http://[<%=gw.originator%>]/cgi-bin-status.html"><%=gw.originator%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://[<%=gw.originator%>]/cgi-bin-status.html"><%=gw.originator%></a></div>
<% else %> <% else %>
<div class="td cbi-section-table-cell"><a href="http://<%=gw.originator%>/cgi-bin-status.html"><%=gw.originator%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://<%=gw.originator%>/cgi-bin-status.html"><%=gw.originator%></a></div>
<% end %> <% end %>
<div class="td cbi-section-table-cell"><%=gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=string.format("%.3f", gw.cost)%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinate')%></div>
<div class="td cbi-section-table-cell"><%=gw.hops%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.hops%></div>
<div class="td cbi-section-table-cell"><%=gw.uplink%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.uplink%></div>
<div class="td cbi-section-table-cell"><%=gw.downlink%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.downlink%></div>
<div class="td cbi-section-table-cell"><%=gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=gw.prefix%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=gw.prefix%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>
</div>
</div> </div>
</fieldset> </fieldset>

View file

@ -27,7 +27,7 @@ local olsrtools = require "luci.tools.olsr"
</div> </div>
<% for k, route in ipairs(routes) do <% 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 color = olsrtools.etx_color(tonumber(cost))
local lq = string.format("%.3f", tonumber(route.linkQuality) or 0) local lq = string.format("%.3f", tonumber(route.linkQuality) or 0)
local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) 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 %> <% if route.proto == "6" then %>
<div class="td cbi-section-table-cell"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></div>
<div class="td cbi-section-table-cell"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></div>
<% else %> <% else %>
<div class="td cbi-section-table-cell"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></div>
<div class="td cbi-section-table-cell"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></div> <div class="td cbi-section-table-cell" style="text-align: left"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></div>
<%end%> <%end%>
<div class="td cbi-section-table-cell"><%=lq%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=lq%></div>
<div class="td cbi-section-table-cell"><%=nlq%></div> <div class="td cbi-section-table-cell" style="text-align: left"><%=nlq%></div>
<div class="td cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></div> <div class="td cbi-section-table-cell" style="background-color:<%=color%>; text-align: left"><%=cost%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)

View file

@ -1201,6 +1201,10 @@ msgstr ""
#~ msgid "Status" #~ msgid "Status"
#~ msgstr "Status" #~ msgstr "Status"
#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97
msgid "Selected"
msgstr "Ausgewählt"
#~ msgid "Device" #~ msgid "Device"
#~ msgstr "Schnittstelle" #~ msgstr "Schnittstelle"

View file

@ -1088,6 +1088,10 @@ msgstr ""
msgid "yes" msgid "yes"
msgstr "" msgstr ""
#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97
msgid "Selected"
msgstr ""
#~ msgid "" #~ msgid ""
#~ "Make sure that OLSRd is running, the \"txtinfo\" plugin is loaded, " #~ "Make sure that OLSRd is running, the \"txtinfo\" plugin is loaded, "
#~ "configured on port 2006 and accepts connections from \"127.0.0.1\"." #~ "configured on port 2006 and accepts connections from \"127.0.0.1\"."

View file

@ -1073,3 +1073,8 @@ msgstr ""
#: applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:135 #: applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:135
msgid "yes" msgid "yes"
msgstr "" msgstr ""
#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97
msgid "Selected"
msgstr ""