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 available
pull/2449/head
Chaim Lev-Ari 2018-09-28 06:06:47 +03:00 committed by Anthony Lapenna
parent 92b15523f0
commit 226c45f035
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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;