mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Update luci and theme
This commit is contained in:
parent
fe03553aae
commit
4d7962337f
165 changed files with 74180 additions and 13802 deletions
62
luci-mod-network/luasrc/view/admin_network/switch_status.htm
Normal file
62
luci-mod-network/luasrc/view/admin_network/switch_status.htm
Normal file
|
@ -0,0 +1,62 @@
|
|||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue