You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/services/docker/nodeService.js

25 lines
584 B

angular.module('portainer.services')
.factory('NodeService', ['$q', 'Node', function NodeServiceFactory($q, Node) {
'use strict';
var service = {};
service.nodes = function(id) {
var deferred = $q.defer();
Node.query({}).$promise
.then(function success(data) {
var nodes = data.map(function (item) {
return new NodeViewModel(item);
});
deferred.resolve(nodes);
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to retrieve nodes', err: err });
});
return deferred.promise;
};
return service;
}]);