modules/admin-full: rework status javascript code to use XHR.poll()
This commit is contained in:
parent
b2b3b181d8
commit
fd052a6e64
6 changed files with 697 additions and 742 deletions
|
@ -44,8 +44,7 @@ $Id$
|
||||||
s.innerHTML = '<%:Waiting for router...%>';
|
s.innerHTML = '<%:Waiting for router...%>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var rcxhr = new XHR();
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network")%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
|
||||||
rcxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
|
|
||||||
function(x)
|
function(x)
|
||||||
{
|
{
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -67,9 +66,7 @@ $Id$
|
||||||
var wifidevs = <%=luci.http.write_json(netdevs)%>;
|
var wifidevs = <%=luci.http.write_json(netdevs)%>;
|
||||||
var arptable = <%=luci.http.write_json(arpcache)%>;
|
var arptable = <%=luci.http.write_json(arpcache)%>;
|
||||||
|
|
||||||
(function() {
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "iface_status", table.concat(netlist, ","))%>', null,
|
||||||
var func = arguments.callee;
|
|
||||||
iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "iface_status", table.concat(netlist, ","))%>', null,
|
|
||||||
function(x, ifcs)
|
function(x, ifcs)
|
||||||
{
|
{
|
||||||
if (ifcs)
|
if (ifcs)
|
||||||
|
@ -173,11 +170,8 @@ $Id$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(func, 5000);
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
})();
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<fieldset class="cbi-section" style="display:none">
|
<fieldset class="cbi-section" style="display:none">
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
<%+cbi/valueheader%>
|
<%+cbi/valueheader%>
|
||||||
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var iwxhr = new XHR();
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "iface_status", self.network)%>', null,
|
||||||
|
|
||||||
(function() {
|
|
||||||
var func = arguments.callee;
|
|
||||||
|
|
||||||
iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "iface_status", self.network)%>', null,
|
|
||||||
function(x, ifc)
|
function(x, ifc)
|
||||||
{
|
{
|
||||||
if (ifc && (ifc = ifc[0]))
|
if (ifc && (ifc = ifc[0]))
|
||||||
|
@ -79,11 +74,8 @@
|
||||||
d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
|
d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(func, 5000);
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
})();
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var stxhr = new XHR();
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "dhcplease_status")%>', null,
|
||||||
|
|
||||||
(function() {
|
|
||||||
var func = arguments.callee;
|
|
||||||
|
|
||||||
stxhr.get('<%=luci.dispatcher.build_url("admin", "network", "dhcplease_status")%>', null,
|
|
||||||
function(x, st)
|
function(x, st)
|
||||||
{
|
{
|
||||||
var tb = document.getElementById('lease_status_table');
|
var tb = document.getElementById('lease_status_table');
|
||||||
|
@ -46,11 +41,8 @@
|
||||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(func, 5000);
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
})();
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<fieldset class="cbi-section">
|
<fieldset class="cbi-section">
|
||||||
|
|
|
@ -119,7 +119,6 @@ $Id$
|
||||||
|
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var iwxhr = new XHR();
|
|
||||||
var wifidevs = <%=luci.http.write_json(netdevs)%>;
|
var wifidevs = <%=luci.http.write_json(netdevs)%>;
|
||||||
var arptable = <%=luci.http.write_json(arpcache)%>;
|
var arptable = <%=luci.http.write_json(arpcache)%>;
|
||||||
|
|
||||||
|
@ -147,8 +146,7 @@ $Id$
|
||||||
st.innerHTML = '<em><%:Wireless is restarting...%></em>';
|
st.innerHTML = '<em><%:Wireless is restarting...%></em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var rcxhr = new XHR();
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network")%>/wireless_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
|
||||||
rcxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/wireless_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
|
|
||||||
function(x)
|
function(x)
|
||||||
{
|
{
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -166,10 +164,7 @@ $Id$
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
(function() {
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "wireless_status", table.concat(netlist, ","))%>', null,
|
||||||
var func = arguments.callee;
|
|
||||||
|
|
||||||
iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "wireless_status", table.concat(netlist, ","))%>', null,
|
|
||||||
function(x, st)
|
function(x, st)
|
||||||
{
|
{
|
||||||
if (st)
|
if (st)
|
||||||
|
@ -227,7 +222,6 @@ $Id$
|
||||||
toggle.style.backgroundImage = 'url(<%=resource%>/cbi/reload.gif)';
|
toggle.style.backgroundImage = 'url(<%=resource%>/cbi/reload.gif)';
|
||||||
toggle.value = '<%:Enable%>';
|
toggle.value = '<%:Enable%>';
|
||||||
toggle.title = '<%:Activate this network%>';
|
toggle.title = '<%:Activate this network%>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle.setAttribute('active', is_assoc);
|
toggle.setAttribute('active', is_assoc);
|
||||||
|
@ -337,11 +331,8 @@ $Id$
|
||||||
img.src = '<%=resource%>/icons/wifi_big' + (devup[dev] ? '' : '_disabled') + '.png';
|
img.src = '<%=resource%>/icons/wifi_big' + (devup[dev] ? '' : '_disabled') + '.png';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(func, 5000);
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
})();
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<h2><a id="content" name="content"><%:Wireless Overview%></a></h2>
|
<h2><a id="content" name="content"><%:Wireless Overview%></a></h2>
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
<%+cbi/valueheader%>
|
<%+cbi/valueheader%>
|
||||||
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var iwxhr = new XHR();
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "wireless_status", self.ifname)%>', null,
|
||||||
|
|
||||||
(function() {
|
|
||||||
var func = arguments.callee;
|
|
||||||
|
|
||||||
iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "wireless_status", self.ifname)%>', null,
|
|
||||||
function(x, iw)
|
function(x, iw)
|
||||||
{
|
{
|
||||||
if (iw && (iw = iw[0]))
|
if (iw && (iw = iw[0]))
|
||||||
|
@ -63,11 +58,8 @@
|
||||||
iw.ssid || '?', iw.mode
|
iw.ssid || '?', iw.mode
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(func, 5000);
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
})();
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|
|
@ -119,14 +119,10 @@ $Id$
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var iwxhr = new XHR();
|
|
||||||
var wifidevs = <%=luci.http.write_json(netdevs)%>;
|
var wifidevs = <%=luci.http.write_json(netdevs)%>;
|
||||||
var arptable = <%=luci.http.write_json(arpcache)%>;
|
var arptable = <%=luci.http.write_json(arpcache)%>;
|
||||||
|
|
||||||
(function() {
|
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
|
||||||
var func = arguments.callee;
|
|
||||||
|
|
||||||
iwxhr.get('<%=REQUEST_URI%>', { status: 1 },
|
|
||||||
function(x, info)
|
function(x, info)
|
||||||
{
|
{
|
||||||
var si = document.getElementById('wan4_i');
|
var si = document.getElementById('wan4_i');
|
||||||
|
@ -459,10 +455,8 @@ $Id$
|
||||||
if (e = document.getElementById('conns'))
|
if (e = document.getElementById('conns'))
|
||||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||||
|
|
||||||
window.setTimeout(func, 5000);
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
})();
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<h2><a id="content" name="content"><%:Status%></a></h2>
|
<h2><a id="content" name="content"><%:Status%></a></h2>
|
||||||
|
|
Loading…
Reference in a new issue