Add simple eventlog pagination in apps view
This commit is contained in:
+19
-5
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user