2016-04-30 18:57:55 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('Application').controller('ActivityController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
|
|
|
|
|
$scope.config = Client.getConfig();
|
|
|
|
|
|
|
|
|
|
$scope.eventLogs = [ ];
|
|
|
|
|
|
2016-05-02 11:36:20 -07:00
|
|
|
$scope.currentPage = 1;
|
|
|
|
|
$scope.pageItems = 20;
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 18:57:55 -07:00
|
|
|
function fetchEventLogs() {
|
2016-05-02 11:36:20 -07:00
|
|
|
$scope.busy = true;
|
|
|
|
|
|
|
|
|
|
Client.getEventLogs($scope.currentPage, $scope.pageItems, function (error, eventLogs) {
|
|
|
|
|
$scope.busy = false;
|
|
|
|
|
|
2016-04-30 18:57:55 -07:00
|
|
|
if (error) return console.error(error);
|
|
|
|
|
|
|
|
|
|
$scope.eventLogs = eventLogs;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Client.onReady(function () {
|
|
|
|
|
fetchEventLogs();
|
|
|
|
|
});
|
|
|
|
|
|
2016-05-02 11:36:20 -07:00
|
|
|
$scope.showNextPage = function () {
|
|
|
|
|
$scope.currentPage++;
|
|
|
|
|
fetchEventLogs();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.showPrevPage = function () {
|
|
|
|
|
if ($scope.currentPage > 1) $scope.currentPage--;
|
|
|
|
|
else $scope.currentPage = 1;
|
|
|
|
|
|
|
|
|
|
fetchEventLogs();
|
|
|
|
|
};
|
2016-04-30 18:57:55 -07:00
|
|
|
}]);
|