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__)
|
||||
|
||||
CONTAINER_CREATE_ATTRS = ['name', 'image', 'command', 'cpu', 'memory',
|
||||
'environment', 'workdir', 'ports', 'hostname',
|
||||
'labels', 'image_pull_policy']
|
||||
CONTAINER_CREATE_ATTRS = zun_client.containers.CREATION_ATTRIBUTES
|
||||
|
||||
|
||||
@memoized
|
||||
@ -65,8 +63,6 @@ def container_create(request, **kwargs):
|
||||
kv = v.split("=", 1)
|
||||
labels[kv[0]] = kv[1]
|
||||
args["labels"] = labels
|
||||
elif key == "ports":
|
||||
args["ports"] = [v for v in value.split(",")]
|
||||
return zunclient(request).containers.create(**args)
|
||||
|
||||
|
||||
|
@ -43,9 +43,7 @@
|
||||
memory_size: null,
|
||||
memory_unit: "m",
|
||||
environment: null,
|
||||
hostname: null,
|
||||
workdir: null,
|
||||
ports: null,
|
||||
labels: null
|
||||
};
|
||||
}
|
||||
|
@ -48,12 +48,6 @@
|
||||
helpUrl: basePath + 'containers/create/misc/misc.help.html',
|
||||
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'),
|
||||
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>
|
||||
<dt translate>Hostname</dt>
|
||||
<dd translate>The hostname to use for the container.</dd>
|
||||
<dt translate>Working Directory</dt>
|
||||
<dd translate>The working directory needs to be an absolute path.</dd>
|
||||
<dt translate>Ports</dt>
|
||||
<dd translate>The ports to expose in comma separated values.</dd>
|
||||
<dt translate>Environment Variables</dt>
|
||||
<dd translate>The environment variables in comma separated KEY=VALUE pairs</dd>
|
||||
</dl>
|
||||
|
@ -1,13 +1,5 @@
|
||||
<div ng-controller="createContainerMiscController as ctrl">
|
||||
<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="form-group">
|
||||
<label class="control-label" for="container-workdir" translate>Working Directory</label>
|
||||
@ -18,10 +10,10 @@
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="container-ports" translate>Ports</label>
|
||||
<input name="container-ports" type="text" class="form-control" id="container-ports"
|
||||
ng-model="model.newContainerSpec.ports"
|
||||
placeholder="{$ 'PORT1,PORT2,PORT3...'|translate $}">
|
||||
<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>
|
||||
|
@ -33,23 +33,5 @@
|
||||
|
||||
function createContainerSpecController($scope, gettext) {
|
||||
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>
|
||||
<dd translate>The number of virtual cpus.</dd>
|
||||
<dt translate>Memory</dt>
|
||||
<dd translate>The container memory size.</dd>
|
||||
<dd translate>The container memory size in MiB.</dd>
|
||||
</dl>
|
||||
|
@ -8,24 +8,13 @@
|
||||
placeholder="{$ 'The number of virtual cpu for this container.'|translate $}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-8">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="container-memory-size" translate>Memory Size</label>
|
||||
<input name="container-memory-size" type="number" min="1"
|
||||
class="form-control" ng-model="model.newContainerSpec.memory_size"
|
||||
placeholder="{$ 'The container memory size.'|translate $}"
|
||||
ng-change="changeMemorySize()" 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>
|
||||
placeholder="{$ 'The container memory size in MiB.'|translate $}"
|
||||
id="container-memory-size">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user