mirror of https://github.com/portainer/portainer
feat(templates): add the ability to connect a template to swarm attachable networks (#642)
parent
ffca440135
commit
53f31ba3b8
|
@ -122,7 +122,11 @@ function ($scope, $q, $state, $anchorScroll, Config, ContainerService, Container
|
|||
function filterNetworksBasedOnProvider(networks) {
|
||||
var endpointProvider = $scope.applicationState.endpoint.mode.provider;
|
||||
if (endpointProvider === 'DOCKER_SWARM' || endpointProvider === 'DOCKER_SWARM_MODE') {
|
||||
networks = NetworkService.filterGlobalNetworks(networks);
|
||||
if (endpointProvider === 'DOCKER_SWARM') {
|
||||
networks = NetworkService.filterGlobalNetworks(networks);
|
||||
} else {
|
||||
networks = NetworkService.filterSwarmModeAttachableNetworks(networks);
|
||||
}
|
||||
$scope.globalNetworkCount = networks.length;
|
||||
NetworkService.addPredefinedLocalNetworks(networks);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,14 @@ angular.module('portainer.services')
|
|||
});
|
||||
};
|
||||
|
||||
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"});
|
||||
|
|
Loading…
Reference in New Issue