summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-04-13 12:31:54 +0200
committerJo-Philipp Wich <jo@mein.io>2020-04-14 17:10:06 +0200
commitb6e93d54a0f9c6be310e07a66ac08532ba6400b0 (patch)
tree2ef619ce872e3e1bb9741e0fcfdb1058c0ec49f7 /modules/luci-base/htdocs/luci-static/resources
parent952b169167bc562be17d4022d8be06978c8a61aa (diff)
luci-base: ui.js: use standard indicator framework to display uci changes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js21
1 files changed, 4 insertions, 17 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js
index 17e70e4f9d..2e4e4ad1c4 100644
--- a/modules/luci-base/htdocs/luci-static/resources/ui.js
+++ b/modules/luci-base/htdocs/luci-static/resources/ui.js
@@ -3800,26 +3800,13 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
* The number of changes to indicate.
*/
setIndicator: function(n) {
- var i = document.querySelector('.uci_change_indicator');
- if (i == null) {
- var poll = document.getElementById('xhr_poll_status');
- i = poll.parentNode.insertBefore(E('a', {
- 'href': '#',
- 'class': 'uci_change_indicator label notice',
- 'click': L.bind(this.displayChanges, this)
- }), poll);
- }
-
if (n > 0) {
- dom.content(i, [ _('Unsaved Changes'), ': ', n ]);
- i.classList.add('flash');
- i.style.display = '';
- document.dispatchEvent(new CustomEvent('uci-new-changes'));
+ UI.prototype.showIndicator('uci-changes',
+ '%s: %d'.format(_('Unsaved Changes'), n),
+ L.bind(this.displayChanges, this));
}
else {
- i.classList.remove('flash');
- i.style.display = 'none';
- document.dispatchEvent(new CustomEvent('uci-clear-changes'));
+ UI.prototype.hideIndicator('uci-changes');
}
},