Merge "Hotfix creation dialog"
This commit is contained in:
commit
b359e776c1
|
@ -20,9 +20,7 @@ from zunclient.v1 import client as zun_client
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONTAINER_CREATE_ATTRS = ['name', 'image', 'command', 'cpu', 'memory',
|
CONTAINER_CREATE_ATTRS = zun_client.containers.CREATION_ATTRIBUTES
|
||||||
'environment', 'workdir', 'ports', 'hostname',
|
|
||||||
'labels', 'image_pull_policy']
|
|
||||||
|
|
||||||
|
|
||||||
@memoized
|
@memoized
|
||||||
|
@ -65,8 +63,6 @@ def container_create(request, **kwargs):
|
||||||
kv = v.split("=", 1)
|
kv = v.split("=", 1)
|
||||||
labels[kv[0]] = kv[1]
|
labels[kv[0]] = kv[1]
|
||||||
args["labels"] = labels
|
args["labels"] = labels
|
||||||
elif key == "ports":
|
|
||||||
args["ports"] = [v for v in value.split(",")]
|
|
||||||
return zunclient(request).containers.create(**args)
|
return zunclient(request).containers.create(**args)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,7 @@
|
||||||
memory_size: null,
|
memory_size: null,
|
||||||
memory_unit: "m",
|
memory_unit: "m",
|
||||||
environment: null,
|
environment: null,
|
||||||
hostname: null,
|
|
||||||
workdir: null,
|
workdir: null,
|
||||||
ports: null,
|
|
||||||
labels: null
|
labels: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,6 @@
|
||||||
helpUrl: basePath + 'containers/create/misc/misc.help.html',
|
helpUrl: basePath + 'containers/create/misc/misc.help.html',
|
||||||
formName: 'containerMiscForm'
|
formName: 'containerMiscForm'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: gettext('Environments'),
|
|
||||||
templateUrl: basePath + 'containers/create/envs/envs.html',
|
|
||||||
helpUrl: basePath + 'containers/create/envs/envs.help.html',
|
|
||||||
formName: 'containerEnvsForm'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: gettext('Labels'),
|
title: gettext('Labels'),
|
||||||
templateUrl: basePath + 'containers/create/labels/labels.html',
|
templateUrl: basePath + 'containers/create/labels/labels.html',
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License. You may obtain
|
|
||||||
* a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ngdoc controller
|
|
||||||
* @name createContainerEnvsController
|
|
||||||
* @ngController
|
|
||||||
* @description
|
|
||||||
* Controller for the container environments step in create workflow
|
|
||||||
*/
|
|
||||||
angular
|
|
||||||
.module('horizon.dashboard.container.containers')
|
|
||||||
.controller('createContainerEnvsController', createContainerEnvsController);
|
|
||||||
|
|
||||||
createContainerEnvsController.$inject = [
|
|
||||||
];
|
|
||||||
|
|
||||||
function createContainerEnvsController() {
|
|
||||||
}
|
|
||||||
})();
|
|
|
@ -1,4 +0,0 @@
|
||||||
<dl>
|
|
||||||
<dt translate>Environment Variables</dt>
|
|
||||||
<dd translate>The environment variables in comma separated KEY=VALUE pairs</dd>
|
|
||||||
</dl>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<div ng-controller="createContainerEnvsController as ctrl">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="container-environment" translate>Environment Variables</label>
|
|
||||||
<input name="container-environment" type="text" class="form-control" id="container-environment"
|
|
||||||
ng-model="model.newContainerSpec.environment"
|
|
||||||
placeholder="{$ 'KEY1=VALUE1,KEY2=VALUE2...'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,8 +1,6 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt translate>Hostname</dt>
|
|
||||||
<dd translate>The hostname to use for the container.</dd>
|
|
||||||
<dt translate>Working Directory</dt>
|
<dt translate>Working Directory</dt>
|
||||||
<dd translate>The working directory needs to be an absolute path.</dd>
|
<dd translate>The working directory needs to be an absolute path.</dd>
|
||||||
<dt translate>Ports</dt>
|
<dt translate>Environment Variables</dt>
|
||||||
<dd translate>The ports to expose in comma separated values.</dd>
|
<dd translate>The environment variables in comma separated KEY=VALUE pairs</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
<div ng-controller="createContainerMiscController as ctrl">
|
<div ng-controller="createContainerMiscController as ctrl">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="container-hostname" translate>Hostname</label>
|
|
||||||
<input name="container-hostname" type="text" class="form-control" id="container-hostname"
|
|
||||||
ng-model="model.newContainerSpec.hostname"
|
|
||||||
placeholder="{$ 'The hostname to use for the container'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="container-workdir" translate>Working Directory</label>
|
<label class="control-label" for="container-workdir" translate>Working Directory</label>
|
||||||
|
@ -18,10 +10,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="container-ports" translate>Ports</label>
|
<label class="control-label" for="container-environment" translate>Environment Variables</label>
|
||||||
<input name="container-ports" type="text" class="form-control" id="container-ports"
|
<input name="container-environment" type="text" class="form-control" id="container-environment"
|
||||||
ng-model="model.newContainerSpec.ports"
|
ng-model="model.newContainerSpec.environment"
|
||||||
placeholder="{$ 'PORT1,PORT2,PORT3...'|translate $}">
|
placeholder="{$ 'KEY1=VALUE1,KEY2=VALUE2...'|translate $}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -33,23 +33,5 @@
|
||||||
|
|
||||||
function createContainerSpecController($scope, gettext) {
|
function createContainerSpecController($scope, gettext) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
ctrl.memory_units = [{unit: "b", label: gettext("bytes")},
|
|
||||||
{unit: "k", label: gettext("KB")},
|
|
||||||
{unit: "m", label: gettext("MB")},
|
|
||||||
{unit: "g", label: gettext("GB")}];
|
|
||||||
|
|
||||||
$scope.changeMemory = function(){
|
|
||||||
if($scope.model.newContainerSpec.memory_size > 0){
|
|
||||||
$scope.model.newContainerSpec.memory = $scope.model.newContainerSpec.memory_size + $scope.model.newContainerSpec.memory_unit;
|
|
||||||
}else{
|
|
||||||
$scope.model.newContainerSpec.memory = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.changeMemoryUnit = function(){
|
|
||||||
$scope.changeMemory();
|
|
||||||
};
|
|
||||||
$scope.changeMemorySize = function(){
|
|
||||||
$scope.changeMemory();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
<dt translate>CPU</dt>
|
<dt translate>CPU</dt>
|
||||||
<dd translate>The number of virtual cpus.</dd>
|
<dd translate>The number of virtual cpus.</dd>
|
||||||
<dt translate>Memory</dt>
|
<dt translate>Memory</dt>
|
||||||
<dd translate>The container memory size.</dd>
|
<dd translate>The container memory size in MiB.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -8,24 +8,13 @@
|
||||||
placeholder="{$ 'The number of virtual cpu for this container.'|translate $}">
|
placeholder="{$ 'The number of virtual cpu for this container.'|translate $}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-xs-12">
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-8">
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="container-memory-size" translate>Memory Size</label>
|
<label class="control-label" for="container-memory-size" translate>Memory Size</label>
|
||||||
<input name="container-memory-size" type="number" min="1"
|
<input name="container-memory-size" type="number" min="1"
|
||||||
class="form-control" ng-model="model.newContainerSpec.memory_size"
|
class="form-control" ng-model="model.newContainerSpec.memory_size"
|
||||||
placeholder="{$ 'The container memory size.'|translate $}"
|
placeholder="{$ 'The container memory size in MiB.'|translate $}"
|
||||||
ng-change="changeMemorySize()" id="container-memory-size">
|
id="container-memory-size">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="container-memory-unit" translate>Memory Unit</label>
|
|
||||||
<select name="container-memory-unit" id="container-memory-unit"
|
|
||||||
class="form-control" ng-options="mu.unit as mu.label for mu in ctrl.memory_units"
|
|
||||||
ng-model="model.newContainerSpec.memory_unit" ng-change="changeMemoryUnit()">
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue