diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-12 11:06:38 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-12 11:09:57 +0200 |
commit | 82743b3bd4b4603f2c6b85566d07182cb0f1ce52 (patch) | |
tree | 9444cba040a334821e6593c13541792c718084ea /modules/luci-mod-network/luasrc/view/admin_network | |
parent | 5fd21bc9efedb29ff8376f8043ed2a4b74788d6b (diff) |
luci-mod-network: reimplement switch configuration as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network/luasrc/view/admin_network')
-rw-r--r-- | modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm b/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm deleted file mode 100644 index 6e741b419a..0000000000 --- a/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm +++ /dev/null @@ -1,62 +0,0 @@ -<script type="text/javascript">//<![CDATA[ - var switches = [ '<%=table.concat(self.switches, "', '")%>' ], - tables = document.querySelectorAll('.cbi-section-table'); - - function add_status_row(table) { - var first_row = table.querySelector('.cbi-section-table-row'); - if (first_row.classList.contains('port-status')) - return first_row; - - var status_row = first_row.parentNode.insertBefore( - E('div', { 'class': first_row.className }), first_row); - - first_row.querySelectorAll('.td').forEach(function(td) { - status_row.appendChild(td.cloneNode(false)); - status_row.lastElementChild.removeAttribute('data-title'); - }); - - status_row.firstElementChild.innerHTML = '<%:Port status:%>'; - status_row.classList.add('port-status') ; - - return status_row; - } - - XHR.poll(-1, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null, - function(x, st) - { - for (var i = 0; i < switches.length; i++) - { - var ports = st[switches[i]]; - var tr = add_status_row(tables[i]); - - if (tr && ports && ports.length) - { - for (var j = 0; j < ports.length; j++) - { - var th = tr.querySelector('[data-name="%d"]'.format(j)); - - if (!th) - continue; - - if (ports[j].link) - { - th.innerHTML = String.format( - '<small><img src="<%=resource%>/icons/port_up.png" />' + - '<br />%d<%:baseT%><br />%s</small>', - ports[j].speed, ports[j].duplex - ? '<%:full-duplex%>' : '<%:half-duplex%>' - ); - } - else - { - th.innerHTML = String.format( - '<small><img src="<%=resource%>/icons/port_down.png" />' + - '<br /><%:no link%></small>' - ); - } - } - } - } - } - ); -//]]></script> |