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/networkService.js

34 lines
910 B

angular.module('portainer.services')
.factory('NetworkService', ['$q', 'Network', function NetworkServiceFactory($q, Network) {
'use strict';
var service = {};
service.getNetworks = function() {
return Network.query({}).$promise;
};
service.filterGlobalNetworks = function(networks) {
return networks.filter(function (network) {
if (network.Scope === 'global') {
return network;
}
});
};
service.filterSwarmModeAttachableNetworks = function(networks) {
return networks.filter(function (network) {
if (network.Scope === 'swarm' && network.Attachable === true) {
return network;
}
});
};
service.addPredefinedLocalNetworks = function(networks) {
networks.push({Scope: "local", Name: "bridge"});
networks.push({Scope: "local", Name: "host"});
networks.push({Scope: "local", Name: "none"});
};
return service;
}]);