summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-04-13 12:41:26 +0200
committerJo-Philipp Wich <jo@mein.io>2020-04-14 17:06:34 +0200
commit68b2ce84ece62e3aec98b9be31e61ec5f6cdba2d (patch)
tree49ae874a297e8ed0c15ccd2652cb8eb28068d556
parentca295b04e72bb869925ba4183800166130f1b228 (diff)
luci-base: luci.js: use standard indicator framework for poll status
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index 1ed213ebb..11ca2fdfc 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -2120,18 +2120,6 @@
Object.assign(this.env, env);
- document.addEventListener('poll-start', function(ev) {
- document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) {
- e.style.display = (e.id == 'xhr_poll_status_off') ? 'none' : '';
- });
- });
-
- document.addEventListener('poll-stop', function(ev) {
- document.querySelectorAll('[id^="xhr_poll_status"]').forEach(function(e) {
- e.style.display = (e.id == 'xhr_poll_status_on') ? 'none' : '';
- });
- });
-
var domReady = new Promise(function(resolveFn, rejectFn) {
document.addEventListener('DOMContentLoaded', resolveFn);
});
@@ -2627,6 +2615,16 @@
L.notifySessionExpiry();
});
+ document.addEventListener('poll-start', function(ev) {
+ uiClass.showIndicator('poll-status', _('Refreshing'), function(ev) {
+ Request.poll.active() ? Request.poll.stop() : Request.poll.start();
+ });
+ });
+
+ document.addEventListener('poll-stop', function(ev) {
+ uiClass.showIndicator('poll-status', _('Paused'), null, 'inactive');
+ });
+
return Promise.all([
this.probeSystemFeatures(),
this.probePreloadClasses()