From: Jo-Philipp Wich Date: Wed, 9 Oct 2013 11:17:55 +0000 (+0000) Subject: modules/admin-full: add DSL status to index page (#620) X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=2aad24cec13cbc4765cbbc5502832184713b823f;hp=8fa1e36b3e9a0691aca635ed39488edc88753845 modules/admin-full: add DSL status to index page (#620) --- diff --git a/modules/admin-full/luasrc/view/admin_status/index.htm b/modules/admin-full/luasrc/view/admin_status/index.htm index 98b6592e1..cfeb91ac7 100644 --- a/modules/admin-full/luasrc/view/admin_status/index.htm +++ b/modules/admin-full/luasrc/view/admin_status/index.htm @@ -24,6 +24,7 @@ You may obtain a copy of the License at if swaptotal > 0 then has_swap = 1 end + local has_dsl = luci.fs.stat("/etc/init.d/dsl_control") if luci.http.formvalue("status") == "1" then local ntm = require "luci.model.network".init() @@ -83,6 +84,12 @@ You may obtain a copy of the License at } end + if has_dsl then + local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat") + local dsl_func = loadstring(dsl_stat) + rv.dsl = dsl_func() + end + luci.http.prepare_content("application/json") luci.http.write_json(rv) @@ -217,6 +224,30 @@ You may obtain a copy of the License at } <% end %> + <% if has_dsl then %> + var dsl_i = document.getElementById('dsl_i'); + var dsl_s = document.getElementById('dsl_s'); + + var s = String.format( + '<%:Status%>: %s
' + + '<%:Line State%>: %s [0x%x]
' + + '<%:Line Speed%>: %s/s / %s/s
' + + '<%:Line Attenuation%>: %s dB / %s dB
' + + '<%:Noise Margin%>: %s dB / %s dB
', + info.dsl.line_state, info.dsl.line_state_detail, + info.dsl.line_state_num, + info.dsl.data_rate_down_s, info.dsl.data_rate_up_s, + info.dsl.line_attenuation_down, info.dsl.line_attenuation_up, + info.dsl.noise_margin_down, info.dsl.noise_margin_up + ); + + dsl_s.innerHTML = String.format('%s', s); + dsl_i.innerHTML = String.format( + '' + + '
ADSL' + ); + <% end %> + <% if has_dhcp then %> var ls = document.getElementById('lease_status_table'); if (ls) @@ -621,6 +652,20 @@ You may obtain a copy of the License at <% end %> +<% if has_dsl then %> +
+ <%:ADSL%> + + +
<%:ADSL Status%> + + + +

?
<%:Collecting data...%>
+
+
+<% end %> + <% if has_wifi then %>
<%:Wireless%>