From 10392ecc285871b3f0866370bea11c18693d6a2c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 6 Feb 2021 10:10:54 +0300 Subject: event log: add pagination --- js/PrefHelpers.js | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'js/PrefHelpers.js') diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index 0780fb708..57dff2333 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -50,21 +50,37 @@ const Helpers = { return false; }, - updateEventLog: function() { - xhrPost("backend.php", { op: "pref-system", severity: dijit.byId("severity").attr('value') }, (transport) => { - dijit.byId('systemConfigTab').attr('content', transport.responseText); - Notify.close(); - }); - }, - clearEventLog: function() { - if (confirm(__("Clear event log?"))) { + EventLog: { + log_page: 0, + refresh: function() { + this.log_page = 0; + this.update(); + }, + update: function() { + xhrPost("backend.php", { op: "pref-system", severity: dijit.byId("severity").attr('value'), page: Helpers.EventLog.log_page }, (transport) => { + dijit.byId('systemConfigTab').attr('content', transport.responseText); + Notify.close(); + }); + }, + nextPage: function() { + this.log_page += 1; + this.update(); + }, + prevPage: function() { + if (this.log_page > 0) this.log_page -= 1; - Notify.progress("Loading, please wait..."); + this.update(); + }, + clear: function() { + if (confirm(__("Clear event log?"))) { - xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => { - this.updateEventLog(); - }); - } + Notify.progress("Loading, please wait..."); + + xhrPost("backend.php", {op: "pref-system", method: "clearLog"}, () => { + Helpers.EventLog.refresh(); + }); + } + }, }, editProfiles: function() { -- cgit v1.2.3