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