feat(templates): add support for the network field (#583)

pull/595/head
Anthony Lapenna 8 years ago committed by GitHub
parent 3089268d88
commit e0b94e4ff7

@ -68,6 +68,11 @@ function ($scope, $q, $state, $anchorScroll, Config, ContainerService, ImageServ
selectedItem = idx; selectedItem = idx;
var selectedTemplate = $scope.templates[idx]; var selectedTemplate = $scope.templates[idx];
$scope.state.selectedTemplate = selectedTemplate; $scope.state.selectedTemplate = selectedTemplate;
if (selectedTemplate.Network) {
$scope.formValues.network = _.find($scope.availableNetworks, function(o) { return o.Name === selectedTemplate.Network; });
} else {
$scope.formValues.network = _.find($scope.availableNetworks, function(o) { return o.Name === "bridge"; });
}
$anchorScroll('selectedTemplate'); $anchorScroll('selectedTemplate');
} }
@ -94,8 +99,6 @@ function ($scope, $q, $state, $anchorScroll, Config, ContainerService, ImageServ
networks = NetworkService.filterGlobalNetworks(networks); networks = NetworkService.filterGlobalNetworks(networks);
$scope.globalNetworkCount = networks.length; $scope.globalNetworkCount = networks.length;
NetworkService.addPredefinedLocalNetworks(networks); NetworkService.addPredefinedLocalNetworks(networks);
} else {
$scope.formValues.network = _.find(networks, function(o) { return o.Name === "bridge"; });
} }
return networks; return networks;
} }

@ -5,6 +5,7 @@ function TemplateViewModel(data) {
this.Image = data.image; this.Image = data.image;
this.Registry = data.registry ? data.registry : ''; this.Registry = data.registry ? data.registry : '';
this.Command = data.command ? data.command : ''; this.Command = data.command ? data.command : '';
this.Network = data.network ? data.network : '';
this.Env = data.env ? data.env : []; this.Env = data.env ? data.env : [];
this.Volumes = data.volumes ? data.volumes : []; this.Volumes = data.volumes ? data.volumes : [];
this.Ports = []; this.Ports = [];

Loading…
Cancel
Save