mirror of https://github.com/portainer/portainer
feat(templates): add support for the network field (#583)
parent
3089268d88
commit
e0b94e4ff7
|
@ -68,6 +68,11 @@ function ($scope, $q, $state, $anchorScroll, Config, ContainerService, ImageServ
|
|||
selectedItem = idx;
|
||||
var selectedTemplate = $scope.templates[idx];
|
||||
$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');
|
||||
}
|
||||
|
||||
|
@ -94,8 +99,6 @@ function ($scope, $q, $state, $anchorScroll, Config, ContainerService, ImageServ
|
|||
networks = NetworkService.filterGlobalNetworks(networks);
|
||||
$scope.globalNetworkCount = networks.length;
|
||||
NetworkService.addPredefinedLocalNetworks(networks);
|
||||
} else {
|
||||
$scope.formValues.network = _.find(networks, function(o) { return o.Name === "bridge"; });
|
||||
}
|
||||
return networks;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ function TemplateViewModel(data) {
|
|||
this.Image = data.image;
|
||||
this.Registry = data.registry ? data.registry : '';
|
||||
this.Command = data.command ? data.command : '';
|
||||
this.Network = data.network ? data.network : '';
|
||||
this.Env = data.env ? data.env : [];
|
||||
this.Volumes = data.volumes ? data.volumes : [];
|
||||
this.Ports = [];
|
||||
|
|
Loading…
Reference in New Issue