feat: design revamp of ACP events page (#7664)

* feat: design revamp of ACP events page

- minor UX changes
- new filter controls, filters moved to sidebar
- form usable without js
- start/end filters NOT programmed yet

* feat: events ACP limit by date and perPage

* feat: pre-fill applied filters on template render

* fix: missing translation for ACP events perPage filter

* fix: added some comments to explain setHours behaviour

* fix: stop - start + 1

* fix: socket tests

* fix: +inf, not just inf

* fix: tests, because I am an idiot
This commit is contained in:
Julian Lam
2019-06-04 17:25:09 -04:00
committed by GitHub
parent 4b843ba16f
commit c7f95ccecc
6 changed files with 82 additions and 32 deletions

View File

@@ -48,6 +48,7 @@ events.types = [
'export:uploads',
'account-locked',
'getUsersCSV',
// To add new types from plugins, just Array.push() to this array
];
/**
@@ -82,10 +83,17 @@ events.log = function (data, callback) {
});
};
events.getEvents = function (filter, start, stop, callback) {
events.getEvents = function (filter, start, stop, from, to, callback) {
// from/to optional
if (typeof from === 'function' && !to && !callback) {
callback = from;
from = 0;
to = Date.now();
}
async.waterfall([
function (next) {
db.getSortedSetRevRange('events:time' + (filter ? ':' + filter : ''), start, stop, next);
db.getSortedSetRevRangeByScore('events:time' + (filter ? ':' + filter : ''), start, stop - start + 1, to, from, next);
},
function (eids, next) {
db.getObjects(eids.map(eid => 'event:' + eid), next);