refactor(templates): use the set field instead of default (#164)

pull/165/head
Anthony Lapenna 2016-08-24 19:46:31 +12:00 committed by GitHub
parent 7c5c693f17
commit 3c75c5fe25
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@
</div>
</div>
<!-- !name-and-network-inputs -->
<div ng-repeat="var in selectedTemplate.env" ng-if="!var.default" class="form-group">
<div ng-repeat="var in selectedTemplate.env" ng-if="!var.set" class="form-group">
<label for="field_{{ $index }}" class="col-sm-2 control-label text-left">{{ var.label }}</label>
<div class="col-sm-10">
<select ng-if="!swarm && var.type === 'container'" ng-options="container|containername for container in runningContainers" class="selectpicker form-control" ng-model="var.value">

View File

@ -76,7 +76,7 @@ function createConfigFromTemplate(template) {
containerConfig.Image = template.image;
if (template.env) {
template.env.forEach(function (v) {
if (v.value || v.default) {
if (v.value || v.set) {
var val;
if (v.type && v.type === 'container') {
if ($scope.swarm && $scope.formValues.network.Scope === 'global') {
@ -86,7 +86,7 @@ function createConfigFromTemplate(template) {
val = container.NetworkSettings.Networks[Object.keys(container.NetworkSettings.Networks)[0]].IPAddress;
}
} else {
val = v.default ? v.default : v.value;
val = v.set ? v.set : v.value;
}
containerConfig.Env.push(v.name + "=" + val);
}