From: Dirk Brenken Date: Sat, 29 Jul 2017 08:02:21 +0000 (+0200) Subject: luci-app-travelmate: enhancements & fixes X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fpull%2F1261%2Fhead;p=oweals%2Fluci.git luci-app-travelmate: enhancements & fixes * Further optimized Station Overview & Scan page, especially for mobile devices * add a "Rescan" button in manual mode on overview page * XHTML fixes Signed-off-by: Dirk Brenken --- diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua index 64ab880c4..aa508f521 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua @@ -35,12 +35,8 @@ if uplink == "" then o.default = "trm_wwan" o.rmempty = false - function o.validate(self, value) - iface = value - return iface - end - function o.write(self, section, value) + iface = o:formvalue(section) uci:set("travelmate", section, "trm_iface", iface) uci:save("travelmate") uci:commit("travelmate") @@ -77,12 +73,22 @@ o1.default = o1.disabled o1.rmempty = false o2 = s:option(Flag, "trm_automatic", translate("Enable 'automatic' mode"), - translate("Keep travelmate in an active state.")) + translate("Keep travelmate in an active state. Check every n seconds the connection status, i.e. the uplink availability.")) o2.default = o2.enabled o2.rmempty = false +btn = s:option(Button, "", translate("Manual Rescan")) +btn:depends("trm_automatic", "") +btn.inputtitle = translate("Rescan") +btn.inputstyle = "find" +btn.disabled = false +function btn.write() + luci.sys.call("/etc/init.d/travelmate start >/dev/null 2>&1") + luci.http.redirect(luci.dispatcher.build_url("admin", "services", "travelmate")) +end + o3 = s:option(Value, "trm_iface", translate("Uplink / Trigger interface"), - translate("Name of the uplink interface that triggers travelmate processing.")) + translate("Name of the uplink interface that triggers travelmate processing in 'manual' mode.")) o3.datatype = "and(uciname,rangelength(3,15))" o3.default = "trm_wwan" o3.rmempty = false diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm index bdb265f19..f1c6be162 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm @@ -3,7 +3,6 @@ Copyright 2017 Dirk Brenken (dev@brenken.org) This is free software, licensed under the Apache License, Version 2.0 -%> - <%- local write = io.write local uci = require "luci.model.uci".cursor() @@ -14,17 +13,17 @@ This is free software, licensed under the Apache License, Version 2.0

<%:Wireless Stations%>

-
<%:Provides an overview of all configured uplink interfaces for travelmate. You can edit and delete existing interfaces or scan for new uplinks.%>
+
+ <%:Provides an overview of all configured uplinks for the travelmate interface (%><%=trmiface%><%:). You can edit, delete or re-order existing uplinks or scan for a new one. The currently used uplink is emphasized in blue.%> +
- - - + <% local pos = 1 @@ -39,24 +38,21 @@ This is free software, licensed under the Apache License, Version 2.0 local disabled = s.disabled or "" local style = "color:#000000" if disabled == "0" then - style = "color:#0069d6" + style = "color:#0069d6;font-weight:bold" end if iface == trmiface then %> - + - - - - - <% @@ -71,13 +67,14 @@ This is free software, licensed under the Apache License, Version 2.0 local device = s[".name"] %> - - - + + + <% end) %> + <%+footer%> diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm index 2ce45c63c..dea107eef 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm @@ -48,7 +48,7 @@ This is free software, licensed under the Apache License, Version 2.0 <% for i, net in ipairs(iw.scanlist or { }) do%> - + @@ -58,17 +58,17 @@ This is free software, licensed under the Apache License, Version 2.0 - @@ -77,13 +77,14 @@ This is free software, licensed under the Apache License, Version 2.0
- +
- - - + + +
+ <%+footer%>
<%:Device%><%:Mode%><%:Uplink Interface%> <%:SSID%> <%:Encryption%><%:Disabled%><%:Actions%>
<%=device%><%=mode%><%=iface%> <%=ssid%> <%=encryption%><%=disabled%> - - + + + - - + + +
<%:Signal strength%>
<%=net.ssid and utl.pcdata(net.ssid) or "%s" % translate("hidden")%> <%=percent_wifi_signal(net)%> % +
- - - - + + + + <% if net.encryption.wpa then %> - - <% for _, v in ipairs(net.encryption.auth_suites) do %> + + <% for _, v in ipairs(net.encryption.auth_suites) do %> <% end; end %> - +