mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
Switch to ngOboe, for DI and promise interface.
This commit is contained in:
parent
2514672c35
commit
6012453d2d
4 changed files with 21 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
angular.module('events', [])
|
||||
.controller('EventsController', ['Settings', '$scope', function(Settings, $scope) {
|
||||
angular.module('events', ['ngOboe'])
|
||||
.controller('EventsController', ['Settings', '$scope', 'Oboe', 'Messages', '$timeout', function(Settings, $scope, oboe, Messages, $timeout) {
|
||||
$scope.updateEvents = function() {
|
||||
$scope.dockerEvents = [];
|
||||
|
||||
|
@ -15,10 +15,21 @@ angular.module('events', [])
|
|||
url += 'until=' + untilSecs;
|
||||
}
|
||||
|
||||
oboe(url)
|
||||
.done(function(node) {
|
||||
oboe({
|
||||
url: url,
|
||||
pattern: '{id status time}'
|
||||
})
|
||||
.then(function(node) {
|
||||
// finished loading
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}, function(error) {
|
||||
// handle errors
|
||||
Messages.error("Failure", error.data);
|
||||
}, function(node) {
|
||||
// node received
|
||||
$scope.dockerEvents.push(node);
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue