mirror of https://github.com/portainer/portainer
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
angular.module('events', [])
|
|
.controller('EventsController', ['Settings', '$scope', function(Settings, $scope) {
|
|
$scope.updateEvents = function() {
|
|
$scope.dockerEvents = [];
|
|
|
|
// TODO: Clean up URL building
|
|
var url = Settings.url + '/events?';
|
|
|
|
if ($scope.model.since) {
|
|
var sinceSecs = Math.floor($scope.model.since.getTime() / 1000);
|
|
url += 'since=' + sinceSecs + '&';
|
|
}
|
|
if ($scope.model.until) {
|
|
var untilSecs = Math.floor($scope.model.until.getTime() / 1000);
|
|
url += 'until=' + untilSecs;
|
|
}
|
|
|
|
oboe(url)
|
|
.done(function(node) {
|
|
$scope.dockerEvents.push(node);
|
|
$scope.$apply();
|
|
});
|
|
};
|
|
|
|
// Init
|
|
$scope.model = {};
|
|
$scope.model.since = new Date(Date.now() - 86400000); // 24 hours in the past
|
|
$scope.model.until = new Date();
|
|
$scope.updateEvents();
|
|
|
|
}]); |