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 /modules | |
parent | aee720f11f0c09b3a67a70c6a863bac9c15fe1dc (diff) | |
parent | 3b9ba0210e9da62861f260b4ed367e2a05789afe (diff) |
Merge pull request #2351 from TDT-AG/pr/20181204-modules
modules: use configurable poll interval
Diffstat (limited to 'modules')
6 files changed, 8 insertions, 7 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/xhr.js b/modules/luci-base/htdocs/luci-static/resources/xhr.js index 8292fcdb6c..3133898b5e 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 2813c4d943..d68e39f917 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 15b6b6908e..bf2a8968d1 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 b7147bfb71..f6f66fbbc6 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 68f0bbc9d4..6e741b419a 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 37d8ae0e85..2c96eb4180 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'); |