diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-12-20 10:52:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-20 10:52:06 +0100 |
commit | 5aa2d3a77f2c77af8fbabf0a18c33e1c4b0cd1d9 (patch) | |
tree | 3a65d1102d52881f10b3515e1f1863833bcd9a52 | |
parent | aee720f11f0c09b3a67a70c6a863bac9c15fe1dc (diff) | |
parent | 3b9ba0210e9da62861f260b4ed367e2a05789afe (diff) |
Merge pull request #2351 from TDT-AG/pr/20181204-modules
modules: use configurable poll interval
26 files changed, 28 insertions, 27 deletions
diff --git a/applications/luci-app-adblock/luasrc/view/adblock/logread.htm b/applications/luci-app-adblock/luasrc/view/adblock/logread.htm index 7fe254ae8..48e367ec2 100644 --- a/applications/luci-app-adblock/luasrc/view/adblock/logread.htm +++ b/applications/luci-app-adblock/luasrc/view/adblock/logread.htm @@ -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) diff --git a/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm b/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm index 0b5c74857..72e2b0d36 100644 --- a/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm +++ b/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm @@ -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) diff --git a/applications/luci-app-ahcp/luasrc/view/ahcp_status.htm b/applications/luci-app-ahcp/luasrc/view/ahcp_status.htm index ab25f862b..4e043aaf3 100644 --- a/applications/luci-app-ahcp/luasrc/view/ahcp_status.htm +++ b/applications/luci-app-ahcp/luasrc/view/ahcp_status.htm @@ -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'); diff --git a/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm b/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm index 318182c08..9d9ffeeac 100644 --- a/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm +++ b/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm @@ -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) { diff --git a/applications/luci-app-banip/luasrc/view/banip/logview.htm b/applications/luci-app-banip/luasrc/view/banip/logview.htm index d298b24de..86f1ea64f 100644 --- a/applications/luci-app-banip/luasrc/view/banip/logview.htm +++ b/applications/luci-app-banip/luasrc/view/banip/logview.htm @@ -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) diff --git a/applications/luci-app-banip/luasrc/view/banip/runtime.htm b/applications/luci-app-banip/luasrc/view/banip/runtime.htm index 65a58bd37..08ef90399 100644 --- a/applications/luci-app-banip/luasrc/view/banip/runtime.htm +++ b/applications/luci-app-banip/luasrc/view/banip/runtime.htm @@ -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) diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm index f3f45e0d0..b6e89775c 100644 --- a/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm +++ b/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm @@ -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); } } diff --git a/applications/luci-app-ltqtapi/luasrc/view/telephony_status.htm b/applications/luci-app-ltqtapi/luasrc/view/telephony_status.htm index 2fd7168bd..6e7c082bb 100644 --- a/applications/luci-app-ltqtapi/luasrc/view/telephony_status.htm +++ b/applications/luci-app-ltqtapi/luasrc/view/telephony_status.htm @@ -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'); diff --git a/applications/luci-app-minidlna/luasrc/view/minidlna_status.htm b/applications/luci-app-minidlna/luasrc/view/minidlna_status.htm index 866eded03..eaf372137 100644 --- a/applications/luci-app-minidlna/luasrc/view/minidlna_status.htm +++ b/applications/luci-app-minidlna/luasrc/view/minidlna_status.htm @@ -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'); diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm b/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm index 49d120c1a..259f3c975 100644 --- a/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm +++ b/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm @@ -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'); diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/status_detail.htm b/applications/luci-app-mwan3/luasrc/view/mwan/status_detail.htm index 12700c4a3..77fce3f91 100644 --- a/applications/luci-app-mwan3/luasrc/view/mwan/status_detail.htm +++ b/applications/luci-app-mwan3/luasrc/view/mwan/status_detail.htm @@ -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'); diff --git a/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm b/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm index c8f3f33d6..9c69514b9 100644 --- a/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm +++ b/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm @@ -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'); diff --git a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm index 85975ac7d..12df6fbab 100644 --- a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm +++ b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm @@ -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); } ); diff --git a/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm b/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm index d9ef82214..48c2a8425 100644 --- a/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm +++ b/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm @@ -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); } ); diff --git a/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm b/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm index f016dd47e..27e101a4d 100644 --- a/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm +++ b/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm @@ -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 = [ diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/logread.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/logread.htm index 25c29b8bb..221f915f8 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/logread.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/logread.htm @@ -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) diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm index 0b025fdae..90c3e2b77 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm @@ -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) diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm index 98e2e64bc..0e78803d0 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm @@ -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) diff --git a/applications/luci-app-upnp/luasrc/view/upnp_status.htm b/applications/luci-app-upnp/luasrc/view/upnp_status.htm index ea79e57a6..7238a5680 100644 --- a/applications/luci-app-upnp/luasrc/view/upnp_status.htm +++ b/applications/luci-app-upnp/luasrc/view/upnp_status.htm @@ -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'); diff --git a/applications/luci-app-wireguard/luasrc/view/wireguard.htm b/applications/luci-app-wireguard/luasrc/view/wireguard.htm index 6ec9ddb36..53968da1d 100644 --- a/applications/luci-app-wireguard/luasrc/view/wireguard.htm +++ b/applications/luci-app-wireguard/luasrc/view/wireguard.htm @@ -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; } diff --git a/modules/luci-base/htdocs/luci-static/resources/xhr.js b/modules/luci-base/htdocs/luci-static/resources/xhr.js index 8292fcdb6..3133898b5 100644 --- a/modules/luci-base/htdocs/luci-static/resources/xhr.js +++ b/modules/luci-base/htdocs/luci-static/resources/xhr.js @@ -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; diff --git a/modules/luci-base/luasrc/view/header.htm b/modules/luci-base/luasrc/view/header.htm index 2813c4d94..d68e39f91 100644 --- a/modules/luci-base/luasrc/view/header.htm +++ b/modules/luci-base/luasrc/view/header.htm @@ -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> diff --git a/modules/luci-base/luasrc/view/lease_status.htm b/modules/luci-base/luasrc/view/lease_status.htm index 15b6b6908..bf2a8968d 100644 --- a/modules/luci-base/luasrc/view/lease_status.htm +++ b/modules/luci-base/luasrc/view/lease_status.htm @@ -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'); diff --git a/modules/luci-base/luasrc/view/wifi_assoclist.htm b/modules/luci-base/luasrc/view/wifi_assoclist.htm index b7147bfb7..f6f66fbbc 100644 --- a/modules/luci-base/luasrc/view/wifi_assoclist.htm +++ b/modules/luci-base/luasrc/view/wifi_assoclist.htm @@ -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'); diff --git a/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm b/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm index 68f0bbc9d..6e741b419 100644 --- a/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm +++ b/modules/luci-mod-network/luasrc/view/admin_network/switch_status.htm @@ -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++) diff --git a/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm b/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm index 37d8ae0e8..2c96eb418 100644 --- a/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm +++ b/modules/luci-mod-system/luasrc/view/admin_system/clock_status.htm @@ -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'); |