2012-09-11 14:18:28 +00:00
|
|
|
<script type="text/javascript">//<![CDATA[
|
2012-11-01 20:03:36 +00:00
|
|
|
var switches = [ '<%=table.concat(self.switches, "', '")%>' ];
|
2015-10-07 17:07:36 +00:00
|
|
|
XHR.poll(5, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null,
|
2012-11-01 20:03:36 +00:00
|
|
|
function(x, st)
|
2012-09-11 14:18:28 +00:00
|
|
|
{
|
2012-11-01 20:03:36 +00:00
|
|
|
for (var i = 0; i < switches.length; i++)
|
2012-09-11 14:18:28 +00:00
|
|
|
{
|
2012-11-01 20:03:36 +00:00
|
|
|
var ports = st[switches[i]];
|
|
|
|
var th0 = document.getElementById('portstatus-' + switches[i]);
|
|
|
|
|
|
|
|
if (th0 && ports && ports.length)
|
2012-09-11 14:18:28 +00:00
|
|
|
{
|
2012-11-01 20:03:36 +00:00
|
|
|
if (!th0.innerHTML)
|
|
|
|
th0.innerHTML = '<%:Port status:%>';
|
|
|
|
|
|
|
|
for (var j = 0; j < ports.length; j++)
|
2012-09-11 14:18:28 +00:00
|
|
|
{
|
2012-11-01 20:03:36 +00:00
|
|
|
var th = th0.parentNode.parentNode.childNodes[j+1];
|
2012-09-11 14:18:28 +00:00
|
|
|
|
2012-11-01 20:03:36 +00:00
|
|
|
if (ports[j].link)
|
2012-09-11 14:18:28 +00:00
|
|
|
{
|
|
|
|
th.innerHTML = String.format(
|
|
|
|
'<small><img src="<%=resource%>/icons/port_up.png" />' +
|
2012-09-11 15:52:01 +00:00
|
|
|
'<br />%d<%:baseT%><br />%s</small>',
|
2012-11-01 20:03:36 +00:00
|
|
|
ports[j].speed, ports[j].duplex
|
2012-09-11 14:18:28 +00:00
|
|
|
? '<%:full-duplex%>' : '<%:half-duplex%>'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
th.innerHTML = String.format(
|
|
|
|
'<small><img src="<%=resource%>/icons/port_down.png" />' +
|
|
|
|
'<br /><%:no link%></small>'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-01 20:03:36 +00:00
|
|
|
}
|
|
|
|
);
|
2012-09-11 14:18:28 +00:00
|
|
|
//]]></script>
|