From 4797b3027b041346955cf2c7a43bd180c07cfb53 Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Thu, 9 Mar 2017 17:20:18 +0900 Subject: [PATCH] Hotfix creation dialog This patch removes hostname and ports attributes, and modifies memory_size as MiB from create dialog. Also, merge environment tab into miscellaneous tab. Since create dialog will be changed widely in following patch, so this patch is provided as hotfix. Change-Id: I63920f7792655cce06d3bcf531ecdce6591cdd44 --- zun_ui/api/client.py | 6 +--- .../containers/create/container-model.js | 2 -- .../create/create-workflow.service.js | 6 ---- .../create/envs/container.envs.controller.js | 34 ------------------- .../containers/create/envs/envs.help.html | 4 --- .../containers/create/envs/envs.html | 12 ------- .../containers/create/misc/misc.help.html | 6 ++-- .../containers/create/misc/misc.html | 16 +++------ .../create/spec/container.spec.controller.js | 18 ---------- .../containers/create/spec/spec.help.html | 2 +- .../containers/create/spec/spec.html | 17 ++-------- 11 files changed, 11 insertions(+), 112 deletions(-) delete mode 100644 zun_ui/static/dashboard/container/containers/create/envs/container.envs.controller.js delete mode 100644 zun_ui/static/dashboard/container/containers/create/envs/envs.help.html delete mode 100644 zun_ui/static/dashboard/container/containers/create/envs/envs.html diff --git a/zun_ui/api/client.py b/zun_ui/api/client.py index 3e20c11..b9536ad 100644 --- a/zun_ui/api/client.py +++ b/zun_ui/api/client.py @@ -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) diff --git a/zun_ui/static/dashboard/container/containers/create/container-model.js b/zun_ui/static/dashboard/container/containers/create/container-model.js index ada327d..d98748e 100644 --- a/zun_ui/static/dashboard/container/containers/create/container-model.js +++ b/zun_ui/static/dashboard/container/containers/create/container-model.js @@ -43,9 +43,7 @@ memory_size: null, memory_unit: "m", environment: null, - hostname: null, workdir: null, - ports: null, labels: null }; } diff --git a/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js b/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js index 3bfecca..97cb011 100644 --- a/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js +++ b/zun_ui/static/dashboard/container/containers/create/create-workflow.service.js @@ -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', diff --git a/zun_ui/static/dashboard/container/containers/create/envs/container.envs.controller.js b/zun_ui/static/dashboard/container/containers/create/envs/container.envs.controller.js deleted file mode 100644 index f4c94ae..0000000 --- a/zun_ui/static/dashboard/container/containers/create/envs/container.envs.controller.js +++ /dev/null @@ -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() { - } -})(); diff --git a/zun_ui/static/dashboard/container/containers/create/envs/envs.help.html b/zun_ui/static/dashboard/container/containers/create/envs/envs.help.html deleted file mode 100644 index 30ca9f3..0000000 --- a/zun_ui/static/dashboard/container/containers/create/envs/envs.help.html +++ /dev/null @@ -1,4 +0,0 @@ -
-
Environment Variables
-
The environment variables in comma separated KEY=VALUE pairs
-
diff --git a/zun_ui/static/dashboard/container/containers/create/envs/envs.html b/zun_ui/static/dashboard/container/containers/create/envs/envs.html deleted file mode 100644 index d26bda7..0000000 --- a/zun_ui/static/dashboard/container/containers/create/envs/envs.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
-
-
- - -
-
-
-
diff --git a/zun_ui/static/dashboard/container/containers/create/misc/misc.help.html b/zun_ui/static/dashboard/container/containers/create/misc/misc.help.html index 45e60eb..3845aae 100644 --- a/zun_ui/static/dashboard/container/containers/create/misc/misc.help.html +++ b/zun_ui/static/dashboard/container/containers/create/misc/misc.help.html @@ -1,8 +1,6 @@
-
Hostname
-
The hostname to use for the container.
Working Directory
The working directory needs to be an absolute path.
-
Ports
-
The ports to expose in comma separated values.
+
Environment Variables
+
The environment variables in comma separated KEY=VALUE pairs
diff --git a/zun_ui/static/dashboard/container/containers/create/misc/misc.html b/zun_ui/static/dashboard/container/containers/create/misc/misc.html index d652372..9c7a8f3 100644 --- a/zun_ui/static/dashboard/container/containers/create/misc/misc.html +++ b/zun_ui/static/dashboard/container/containers/create/misc/misc.html @@ -1,13 +1,5 @@
-
-
- - -
-
@@ -18,10 +10,10 @@
- - + +
diff --git a/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js b/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js index d9f0ec8..c6d98eb 100644 --- a/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js +++ b/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js @@ -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(); - }; } })(); diff --git a/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html b/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html index c7f9fca..665ad28 100644 --- a/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html +++ b/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html @@ -2,5 +2,5 @@
CPU
The number of virtual cpus.
Memory
-
The container memory size.
+
The container memory size in MiB.
diff --git a/zun_ui/static/dashboard/container/containers/create/spec/spec.html b/zun_ui/static/dashboard/container/containers/create/spec/spec.html index 0ecbefc..b6dac57 100644 --- a/zun_ui/static/dashboard/container/containers/create/spec/spec.html +++ b/zun_ui/static/dashboard/container/containers/create/spec/spec.html @@ -8,24 +8,13 @@ placeholder="{$ 'The number of virtual cpu for this container.'|translate $}">
- -
-
+
-
-
-
-
- - + placeholder="{$ 'The container memory size in MiB.'|translate $}" + id="container-memory-size">