diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-10-09 11:17:55 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-10-09 11:17:55 +0000 |
commit | 2aad24cec13cbc4765cbbc5502832184713b823f (patch) | |
tree | 4fd950125fa3a15be0b32bf1cb395a7da765ba13 /modules/admin-full/luasrc/view | |
parent | 8fa1e36b3e9a0691aca635ed39488edc88753845 (diff) |
modules/admin-full: add DSL status to index page (#620)
Diffstat (limited to 'modules/admin-full/luasrc/view')
-rw-r--r-- | modules/admin-full/luasrc/view/admin_status/index.htm | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/view/admin_status/index.htm b/modules/admin-full/luasrc/view/admin_status/index.htm index 98b6592e1c..cfeb91ac7a 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( + '<strong><%:Status%>: </strong>%s<br />' + + '<strong><%:Line State%>: </strong>%s [0x%x]<br />' + + '<strong><%:Line Speed%>: </strong>%s/s / %s/s<br />' + + '<strong><%:Line Attenuation%>: </strong>%s dB / %s dB<br />' + + '<strong><%:Noise Margin%>: </strong>%s dB / %s dB<br />', + 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('<small>%s</small>', s); + dsl_i.innerHTML = String.format( + '<img src="<%=resource%>/icons/ethernet.png" />' + + '<br /><small>ADSL</small>' + ); + <% 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 </fieldset> <% end %> +<% if has_dsl then %> +<fieldset class="cbi-section"> + <legend><%:ADSL%></legend> + <table width="100%" cellspacing="10"> + <tr><td width="33%" style="vertical-align:top"><%:ADSL Status%></td><td> + <table><tr> + <td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td> + <td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td> + </tr></table> + </td></tr> + </table> +</fieldset> +<% end %> + <% if has_wifi then %> <fieldset class="cbi-section"> <legend><%:Wireless%></legend> |