1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 02:39:41 +02:00

refactor(templates): refactor controller code and create required services (#580)

This commit is contained in:
Anthony Lapenna 2017-02-10 14:11:36 +13:00 committed by GitHub
parent 06a484880b
commit 2f3475b96a
10 changed files with 421 additions and 249 deletions

View file

@ -0,0 +1,25 @@
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.addPredefinedLocalNetworks = function(networks) {
networks.push({Scope: "local", Name: "bridge"});
networks.push({Scope: "local", Name: "host"});
networks.push({Scope: "local", Name: "none"});
};
return service;
}]);