Add refresh button to eventlog

This commit is contained in:
Johannes Zellner
2020-10-09 12:31:25 +02:00
parent 75b867550b
commit 5481a65ab1
2 changed files with 19 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ angular.module('Application').controller('ActivityController', ['$scope', '$loca
$scope.config = Client.getConfig();
$scope.busy = false;
$scope.busyRefresh = false;
$scope.eventLogs = [];
$scope.activeEventLog = null;
@@ -408,22 +409,36 @@ angular.module('Application').controller('ActivityController', ['$scope', '$loca
return line;
}
function fetchEventLogs() {
$scope.busy = true;
function fetchEventLogs(background, callback) {
callback = callback || function (error) { if (error) console.error(error); };
background = background || false;
if (!background) $scope.busy = true;
var actions = $scope.selectedActions.map(function (a) { return a.value; }).join(', ');
Client.getEventLogs(actions, $scope.search || null, $scope.currentPage, $scope.pageItems.value, function (error, result) {
$scope.busy = false;
if (error) return console.error(error);
if (error) return callback(error);
$scope.eventLogs = [];
result.forEach(function (e) {
$scope.eventLogs.push({ raw: e, details: eventLogDetails(e), source: eventLogSource(e) });
});
callback();
});
}
$scope.refresh = function () {
$scope.busyRefresh = true;
fetchEventLogs(true, function () {
$scope.busyRefresh = false;
});
};
$scope.showNextPage = function () {
$scope.currentPage++;
fetchEventLogs();