Add simple eventlog pagination in apps view

This commit is contained in:
Johannes Zellner
2021-09-23 12:09:05 +02:00
parent 3a55daed2f
commit 5d7832bec1
2 changed files with 26 additions and 8 deletions
+19 -5
View File
@@ -848,15 +848,17 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
busy: false,
eventlogs: [],
activeEventLog: null,
currentPage: 1,
perPage: 5,
show: function () {
$scope.eventlog.refresh();
},
refresh: function () {
$scope.eventlog.busy = true;
// TODO if needed make those interactive
var page = 1;
var perPage = 20;
Client.getAppEventLog($scope.app.id, page, perPage, function (error, result) {
Client.getAppEventLog($scope.app.id, $scope.eventlog.currentPage, $scope.eventlog.perPage, function (error, result) {
if (error) return console.error('Failed to get events:', error);
$scope.eventlog.eventLogs = [];
@@ -871,6 +873,18 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
showDetails: function (eventLog) {
if ($scope.eventlog.activeEventLog === eventLog) $scope.eventlog.activeEventLog = null;
else $scope.eventlog.activeEventLog = eventLog;
},
showNextPage: function () {
$scope.eventlog.currentPage++;
$scope.eventlog.refresh();
},
showPrevPage: function () {
if ($scope.eventlog.currentPage > 1) $scope.eventlog.currentPage--;
else $scope.eventlog.currentPage = 1;
$scope.eventlog.refresh();
}
};