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/docker/services/swarmService.js

28 lines
693 B

import { SwarmViewModel } from '../models/swarm';
angular.module('portainer.docker').factory('SwarmService', [
'$q',
'Swarm',
function SwarmServiceFactory($q, Swarm) {
'use strict';
var service = {};
service.swarm = function (endpointId) {
var deferred = $q.defer();
Swarm.get(endpointId ? { endpointId } : undefined)
.$promise.then(function success(data) {
var swarm = new SwarmViewModel(data);
deferred.resolve(swarm);
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to retrieve Swarm details', err: err });
});
return deferred.promise;
};
return service;
},
]);