Merge pull request #2351 from TDT-AG/pr/20181204-modules
modules: use configurable poll interval
This commit is contained in:
commit
5aa2d3a77f
26 changed files with 28 additions and 27 deletions
|
@ -10,7 +10,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
|||
//<![CDATA[
|
||||
function log_update()
|
||||
{
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "logread")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "logread")%>', null,
|
||||
function(x)
|
||||
{
|
||||
if (!x)
|
||||
|
|
|
@ -123,7 +123,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
|||
status_update(json_info);
|
||||
});
|
||||
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "status_update")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "status_update")%>', null,
|
||||
function(x, json_info)
|
||||
{
|
||||
if (!x || !json_info || !json_info.data)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url('admin/network/ahcpd/status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/network/ahcpd/status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('ahcpd_status_table');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin/services/aria2/status")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin/services/aria2/status")%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('aria2_status');
|
||||
if (data && tb) {
|
||||
|
|
|
@ -10,7 +10,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
|||
//<![CDATA[
|
||||
function log_update()
|
||||
{
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "banip", "logview")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "banip", "logview")%>', null,
|
||||
function(x)
|
||||
{
|
||||
if (!x)
|
||||
|
|
|
@ -76,7 +76,7 @@ function btn_action(action)
|
|||
status_update(json_info)
|
||||
});
|
||||
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "banip", "status")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "banip", "status")%>', null,
|
||||
function(x, json_info)
|
||||
{
|
||||
if (!x || !json_info)
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
// define only ONE XHR.poll in a page because if one is running it blocks the other one
|
||||
// optimum is to define on Map or Section Level from here you can reach all elements
|
||||
// we need update every 15 seconds only
|
||||
XHR.poll(5, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
|
||||
XHR.poll(-1, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
if (data) { _data2elements(data); }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url('admin/telephony/status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/telephony/status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('telephony_status_table');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url("admin/services/minidlna_status")%>', null,
|
||||
XHR.poll(-1, '<%=url("admin/services/minidlna_status")%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('minidlna_status');
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
-%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
|
||||
function(x, status)
|
||||
{
|
||||
var statusDiv = document.getElementById('mwan_status_text');
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</ul>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "detailed_status")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "detailed_status")%>', null,
|
||||
function(x)
|
||||
{
|
||||
var output = document.getElementById('diag-rc-output');
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url('admin/services/ocserv/status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/services/ocserv/status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('ocserv_status_table');
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url('admin/services/privoxy/status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/services/privoxy/status')%>', null,
|
||||
function(x, data) { _data2elements(x); }
|
||||
);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url([[admin/services/radicale/status]])%>', null,
|
||||
XHR.poll(-1, '<%=url([[admin/services/radicale/status]])%>', null,
|
||||
function(x, data) { _data2elements(x); }
|
||||
);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>" value="<%:Add%>" />
|
||||
</div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url('admin/services/shadowsocks-libev/status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/services/shadowsocks-libev/status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var names = [
|
||||
|
|
|
@ -10,7 +10,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
|||
//<![CDATA[
|
||||
function log_update()
|
||||
{
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "logread")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "logread")%>', null,
|
||||
function(x)
|
||||
{
|
||||
if (!x)
|
||||
|
|
|
@ -84,7 +84,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
|||
status_update(json_info)
|
||||
});
|
||||
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
|
||||
function(x, json_info)
|
||||
{
|
||||
if (!x || !json_info)
|
||||
|
|
|
@ -86,7 +86,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
|||
status_update(json_info)
|
||||
});
|
||||
|
||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
|
||||
XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
|
||||
function(x, json_info)
|
||||
{
|
||||
if (!x || !json_info)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
);
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url('admin/services/upnp/status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/services/upnp/status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('upnp_status_table');
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
|
||||
XHR.poll(-1, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, data) {
|
||||
for (var key in data) {
|
||||
if (!data.hasOwnProperty(key)) { continue; }
|
||||
|
|
|
@ -169,8 +169,8 @@ XHR.post = function(url, data, callback) {
|
|||
}
|
||||
|
||||
XHR.poll = function(interval, url, data, callback, post) {
|
||||
if (isNaN(interval) || interval < 1)
|
||||
interval = 5;
|
||||
if (isNaN(interval) || interval <= 0)
|
||||
interval = L.env.pollinterval;
|
||||
|
||||
if (!XHR._q) {
|
||||
XHR._t = 0;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
resource = resource,
|
||||
scriptname = luci.http.getenv("SCRIPT_NAME"),
|
||||
pathinfo = luci.http.getenv("PATH_INFO"),
|
||||
requestpath = luci.dispatcher.context.requestpath
|
||||
requestpath = luci.dispatcher.context.requestpath,
|
||||
pollinterval = luci.config.main.pollinterval or 5
|
||||
}) %>);
|
||||
</script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url('admin/dhcplease_status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/dhcplease_status')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('lease_status_table');
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url('admin/wireless_assoclist')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/wireless_assoclist')%>', null,
|
||||
function(x, st)
|
||||
{
|
||||
var tb = document.getElementById('wifi_assoclist_table');
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
return status_row;
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null,
|
||||
XHR.poll(-1, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null,
|
||||
function(x, st)
|
||||
{
|
||||
for (var i = 0; i < switches.length; i++)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%+cbi/valueheader%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url('admin/system/clock_status')%>', null,
|
||||
XHR.poll(-1, '<%=url('admin/system/clock_status')%>', null,
|
||||
function(x, rv)
|
||||
{
|
||||
var s = document.getElementById('<%=self.option%>-clock-status');
|
||||
|
|
Loading…
Reference in a new issue