mirror of https://github.com/portainer/portainer
fix(template-creation): fix an issue related to the network setting (#2312)
* bug(template): pass network name on creation * bug(templates): choose network object on update * fix(templates): set network only when availablepull/2449/head
parent
92b15523f0
commit
226c45f035
|
@ -25,7 +25,7 @@ function TemplateCreateRequest(model) {
|
|||
this.Image = model.Image;
|
||||
this.Registry = model.Registry.URL;
|
||||
this.Command = model.Command;
|
||||
this.Network = model.Network;
|
||||
this.Network = model.Network && model.Network.Name;
|
||||
this.Privileged = model.Privileged;
|
||||
this.Interactive = model.Interactive;
|
||||
this.RestartPolicy = model.RestartPolicy;
|
||||
|
|
|
@ -38,6 +38,12 @@ function ($q, $scope, $state, $transition$, TemplateService, TemplateHelper, Net
|
|||
)
|
||||
})
|
||||
.then(function success(data) {
|
||||
var template = data.template;
|
||||
if (template.Network) {
|
||||
template.Network = _.find(data.networks, function(o) { return o.Name === template.Network; });
|
||||
} else {
|
||||
template.Network = _.find(data.networks, function(o) { return o.Name === 'bridge'; });
|
||||
}
|
||||
$scope.categories = TemplateHelper.getUniqueCategories(data.templates);
|
||||
$scope.template = data.template;
|
||||
$scope.networks = data.networks;
|
||||
|
|
Loading…
Reference in New Issue