feature: Optimization of Magnum

1. Update some form item labels for better semantics
2. Make the template name be required when create the template
3. Support create cluster instance from template list

Change-Id: I588af877fe776dbf7d44b11ad350566bf231121f
This commit is contained in:
xusongfu 2022-11-07 16:21:19 +08:00
parent f73d5a37bf
commit 5ba32d6dde
14 changed files with 101 additions and 53 deletions

View File

@ -0,0 +1,8 @@
---
features:
- |
Support create cluster instance from template list
1. Add create cluster action from magnum template list
2. It is convenient and quick to use templates to create cluster instances

View File

@ -360,6 +360,7 @@
"Cloud Platform": "Cloud Platform",
"Cluster Detail": "Cluster Detail",
"Cluster Distro": "Cluster Distro",
"Cluster Info": "Cluster Info",
"Cluster Management": "Cluster Management",
"Cluster Name": "Cluster Name",
"Cluster Network": "Cluster Network",
@ -1180,7 +1181,6 @@
"Indonesia": "Indonesia",
"Infinity": "Infinity",
"Info": "Info",
"Info *": "Info *",
"Ingress": "Ingress",
"Init Complete": "Init Complete",
"Init Failed": "Init Failed",
@ -1424,12 +1424,11 @@
"Manually Specify": "Manually Specify",
"Marshall Islands": "Marshall Islands",
"Martinique": "Martinique",
"Master Addresses": "Master Addresses",
"Master Count": "Master Count",
"Master Flavor": "Master Flavor",
"Master Flavor ID": "Master Flavor ID",
"Master LB": "Master LB",
"Master LB Enabled": "Master LB Enabled",
"Master Node Addresses": "Master Node Addresses",
"Master Node Flavor ID": "Master Node Flavor ID",
"Master Node LB": "Master Node LB",
"Master Node LB Enabled": "Master Node LB Enabled",
"Mauritania": "Mauritania",
"Mauritius": "Mauritius",
"Max Avail": "Max Avail",
@ -1530,6 +1529,7 @@
"Network Line": "Network Line",
"Network Name": "Network Name",
"Network Service": "Network Service",
"Network Setting": "Network Setting",
"Network Traffic": "Network Traffic",
"Network Type": "Network Type",
"Network topology page": "Network topology page",
@ -1567,12 +1567,12 @@
"Node Addresses": "Node Addresses",
"Node Count": "Node Count",
"Node Driver": "Node Driver",
"Node Flavor": "Node Flavor",
"Node Flavor ID": "Node Flavor ID",
"Node ID/Name": "Node ID/Name",
"Node Info": "Node Info",
"Node Name": "Node Name",
"Node Spec": "Node Spec",
"Node Spec *": "Node Spec *",
"Nodes": "Nodes",
"Norfolk Island": "Norfolk Island",
"Normal": "Normal",
@ -2290,6 +2290,7 @@
"The Provider is the encryption provider format (e.g. \"luks\")": "The Provider is the encryption provider format (e.g. \"luks\")",
"The Republic of Macedonia": "The Republic of Macedonia",
"The Republic of South Sudan": "The Republic of South Sudan",
"The SSH key is a way to remotely log in to the cluster instance. The cloud platform only helps to keep the public key. Please keep your private key properly.": "The SSH key is a way to remotely log in to the cluster instance. The cloud platform only helps to keep the public key. Please keep your private key properly.",
"The SSH key is a way to remotely log in to the instance. The cloud platform only helps to keep the public key. Please keep your private key properly.": "The SSH key is a way to remotely log in to the instance. The cloud platform only helps to keep the public key. Please keep your private key properly.",
"The amphora instance is required for load balancing service setup and is not recommended": "The amphora instance is required for load balancing service setup and is not recommended",
"The associated floating IP, virtual adapter, volume and other resources will be automatically disassociated.": "The associated floating IP, virtual adapter, volume and other resources will be automatically disassociated.",

View File

@ -360,6 +360,7 @@
"Cloud Platform": "云平台",
"Cluster Detail": "集群详情",
"Cluster Distro": "集群发行版",
"Cluster Info": "集群信息",
"Cluster Management": "集群管理",
"Cluster Name": "集群名称",
"Cluster Network": "集群网络",
@ -757,7 +758,7 @@
"Do not reset the normally mounted volume to the \"available\"、\"maintenance\" or \"error\" status. The reset state does not remove the volume from the instance. If you need to remove the volume from the instance, please go to the console of the corresponding project and use the \"detach\" operation.": "请勿将正常的挂载中的云硬盘重置为“可用”、“维护”或”错误“状态。重置状态并不会将云硬盘从云主机上卸载下来。如果您需要将云硬盘从云主机上移除,请进入相应项目的控制台使用“解绑”操作。",
"Do not set with a backend": "不设置后端",
"Docker": "Docker",
"Docker Storage Driver": "Docker存储驱动程序",
"Docker Storage Driver": "Docker存储驱动",
"Docker Swarm": "Docker Swarm",
"Docker Swarm Mode": "Docker Swarm Mode",
"Docker Volume Size": "Docker硬盘大小",
@ -953,8 +954,8 @@
"Flavor ID": "云主机类型ID",
"Flavor Info": "配置信息",
"Flavor Name": "云主机类型名称",
"Flavor of Master Nodes": "主节点的云主机类型",
"Flavor of Worker Nodes": "工作节点的云主机类型",
"Flavor of Master Nodes": "主节点类型",
"Flavor of Worker Nodes": "工作节点类型",
"Flavors": "云主机类型",
"Floating IP": "浮动IP",
"Floating IP Address": "浮动IP地址",
@ -1180,7 +1181,6 @@
"Indonesia": "印度尼西亚",
"Infinity": "无限制",
"Info": "信息",
"Info *": "信息 *",
"Ingress": "入口",
"Init Complete": "初始化完成",
"Init Failed": "初始化失败",
@ -1424,12 +1424,11 @@
"Manually Specify": "手动指定",
"Marshall Islands": "马绍尔群岛",
"Martinique": "马提尼克岛",
"Master Addresses": "主地址",
"Master Count": "主数量",
"Master Flavor": "主类型",
"Master Flavor ID": "主类型ID",
"Master LB": "主负载均衡",
"Master LB Enabled": "允许主负载均衡",
"Master Node Addresses": "主节点地址",
"Master Node Flavor ID": "主节点类型ID",
"Master Node LB": "主节点负载均衡",
"Master Node LB Enabled": "启用主节点负载均衡",
"Mauritania": "毛里塔尼亚",
"Mauritius": "毛里求斯",
"Max Avail": "最大可用量",
@ -1530,6 +1529,7 @@
"Network Line": "网络线路",
"Network Name": "网络名称",
"Network Service": "网络服务",
"Network Setting": "网络设置",
"Network Traffic": "网络流量",
"Network Type": "网络类型",
"Network topology page": "网络拓扑页面",
@ -1567,12 +1567,12 @@
"Node Addresses": "节点地址",
"Node Count": "节点数量",
"Node Driver": "节点驱动",
"Node Flavor": "节点类型",
"Node Flavor ID": "节点类型ID",
"Node ID/Name": "节点ID/名称",
"Node Info": "节点信息",
"Node Name": "节点名称",
"Node Spec": "节点规格",
"Node Spec *": "节点规格 *",
"Nodes": "节点",
"Norfolk Island": "诺福克岛",
"Normal": "正常",
@ -1593,11 +1593,11 @@
"Nova Service": "计算服务",
"Number of GPU": "GPU数量",
"Number of IPs used by all projects": "所有项目使用的IP数量",
"Number of Master Nodes": "主节点数",
"Number of Master Nodes": "主节点数",
"Number of Nodes": "节点数量",
"Number of Ports": "端口数量",
"Number of Usb Controller": "USB控制器数量",
"Number of Worker Nodes": "工作节点数",
"Number of Worker Nodes": "工作节点数",
"OK": "",
"OS": "操作系统",
"OS Admin": "镜像默认用户",
@ -2290,6 +2290,7 @@
"The Provider is the encryption provider format (e.g. \"luks\")": "提供者是提供者加密格式(例如\"luks\"",
"The Republic of Macedonia": "马其顿",
"The Republic of South Sudan": "南苏丹共和国",
"The SSH key is a way to remotely log in to the cluster instance. The cloud platform only helps to keep the public key. Please keep your private key properly.": "SSH 密钥是一种远程登录集群实例的方式,云平台只帮助保管公钥,请妥善保管自己的私钥。",
"The SSH key is a way to remotely log in to the instance. The cloud platform only helps to keep the public key. Please keep your private key properly.": "SSH 密钥是一种远程登录云主机的方式,云平台只帮助保管公钥,请妥善保管自己的私钥。",
"The amphora instance is required for load balancing service setup and is not recommended": "amphora 相关的云主机为负载均衡服务搭建所需,不建议选择",
"The associated floating IP, virtual adapter, volume and other resources will be automatically disassociated.": "绑定的浮动IP、网卡、云硬盘等资源将自动解绑。",
@ -2309,8 +2310,8 @@
"The floating IP configured with port forwardings cannot be bound": "不允许绑定配置了端口转发的浮动IP",
"The format of the certificate content is: by \"----BEGIN CERTIFICATE-----\" as the beginning,\"-----END CERTIFICATE----\" as the end, 64 characters per line, the last line does not exceed 64 characters, and there cannot be blank lines.": "证书内容格式为:以”-----BEGIN CERTIFICATE-----”作为开头,以“-----END CERTIFICATE----”作为结尾每行64字符最后一行不超过64字符不能有空行。",
"The host name of this container": "容器的主机名",
"The http_proxy address to use for nodes in cluster": "用于集群中节点的 http_proxy 地址",
"The https_proxy address to use for nodes in cluster": "用于集群中节点的 https_proxy 地址",
"The http_proxy address to use for nodes in cluster": "用于集群中节点的HTTP代理地址",
"The https_proxy address to use for nodes in cluster": "用于集群中节点的HTTPS代理地址",
"The instance architecture diagram mainly shows the overall architecture composition of the instance. If you need to view the network topology of the instance, please go to: ": "云主机架构图主要展示云主机的总体架构组成。如果需要查看云主机的网络拓扑,请转到:",
"The instance deleted immediately cannot be restored": "立即删除的云主机无法恢复",
"The instance has been locked. If you want to do more, please unlock it first.": "该云主机已被锁定。如果要做更多操作,请先解锁。",
@ -2341,7 +2342,7 @@
"The name should start with upper letter, lower letter, and be a string of 2 to 255, characters can only contain \"0-9, a-z, A-Z, -, ., _\".": "名称应以大写字母或小写字母开头最长为255字符且只包含“0-9, a-z, A-Z, -, ., _”。",
"The name should start with upper letter, lower letter, and be a string of 3 to 63, characters can only contain \"0-9, a-z, A-Z, -\".": "名称应以大写字母小写字母开头长度为3-63字符且只包含“0-9, a-z, A-Z, -”。",
"The new password cannot be identical to the current password.": "用户新密码不能与原密码相同。",
"The no_proxy address to use for nodes in cluster": "用于集群中节点的 no_proxy 地址",
"The no_proxy address to use for nodes in cluster": "集群中节点多用,无需代理",
"The number of allowed key pairs for each user.": "每个用户允许创建的密钥数量",
"The number of vCPU cores should not exceed the maximum number of CPU cores of the physical node. Otherwise it will cause fail to schedule to any physical node when creating instance.": "vCPU核数不应该超过物理节点的最大CPU核数否则会导致云主机创建时无法调度到任何物理节点。",
"The number of virtual cpu for this container": "容器的虚拟 CPU 数量",

View File

@ -114,7 +114,7 @@ export class BaseDetail extends Base {
dataIndex: 'dns_nameserver',
},
{
label: t('Master LB Enabled'),
label: t('Master Node LB Enabled'),
dataIndex: 'master_lb_enabled',
valueRender: 'yesNo',
},
@ -172,7 +172,7 @@ export class BaseDetail extends Base {
content: flavorUrl,
},
{
label: t('Master Flavor ID'),
label: t('Master Node Flavor ID'),
content: masterFlavorUrl,
},
{
@ -222,7 +222,7 @@ export class BaseDetail extends Base {
];
return {
title: t('Labels'),
title: t('Additional Labels'),
labelCol: 2,
options,
};

View File

@ -0,0 +1,24 @@
// Copyright 2021 99cloud
//
// 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.
import { inject, observer } from 'mobx-react';
import Base from 'pages/container-infra/containers/Clusters/actions/StepCreate';
export class CreateCluster extends Base {
static path(item) {
return `/container-infra/clusters/create?template=${item.id}`;
}
}
export default inject('rootStore')(observer(CreateCluster));

View File

@ -65,6 +65,7 @@ export class StepInfo extends Base {
label: t('Cluster Template Name'),
type: 'input',
placeholder: t('Cluster Template Name'),
required: true,
},
{
name: 'coe',

View File

@ -266,7 +266,7 @@ export class StepNetwork extends Base {
},
{
name: 'master_lb_enabled',
label: t('Master LB'),
label: t('Master Node LB'),
type: 'check',
},
{

View File

@ -90,10 +90,7 @@ export class StepNodeSpec extends Base {
get imageList() {
const { imageTab } = this.state;
return (globalImageStore.list.data || [])
.filter(
(it) =>
this.acceptedImageOs.includes(it.os_distro)
)
.filter((it) => this.acceptedImageOs.includes(it.os_distro))
.filter((it) => getImageOS(it) === imageTab);
}
@ -187,7 +184,7 @@ export class StepNodeSpec extends Base {
data: this.keypairs,
isLoading: globalKeypairStore.list.isLoading,
tip: t(
'The SSH key is a way to remotely log in to the instance. The cloud platform only helps to keep the public key. Please keep your private key properly.'
'The SSH key is a way to remotely log in to the cluster instance. The cloud platform only helps to keep the public key. Please keep your private key properly.'
),
filterParams: [
{
@ -208,13 +205,13 @@ export class StepNodeSpec extends Base {
},
{
name: 'flavor',
label: t('Flavor'),
label: t('Node Flavor'),
type: 'select-table',
component: <FlavorSelectTable onChange={this.onFlavorChange} />,
},
{
name: 'masterFlavor',
label: t('Master Flavor'),
label: t('Flavor of Master Nodes'),
type: 'select-table',
component: <FlavorSelectTable onChange={this.onFlavorChange} />,
},

View File

@ -74,19 +74,19 @@ export class StepCreate extends StepAction {
get steps() {
return [
{
title: t('Info *'),
title: t('Cluster Info'),
component: StepInfo,
},
{
title: t('Node Spec *'),
title: t('Node Spec'),
component: StepNodeSpec,
},
{
title: t('Network'),
title: t('Network Setting'),
component: StepNetwork,
},
{
title: t('Labels'),
title: t('Additional Labels'),
component: StepLabel,
},
];

View File

@ -12,11 +12,12 @@
import Create from './StepCreate';
import Delete from './Delete';
import Edit from './Edit';
import CreateCluster from './CreateCluster';
const actionConfigs = {
rowActions: {
firstAction: Delete,
moreActions: [{ action: Edit }],
moreActions: [{ action: Edit }, { action: CreateCluster }],
},
batchActions: [Delete],
primaryActions: [Create],

View File

@ -111,7 +111,7 @@ export class BaseDetail extends Base {
dataIndex: 'docker_volume_size',
},
{
label: t('Master Flavor ID'),
label: t('Master Node Flavor ID'),
content: masterFlavorUrl,
},
{
@ -149,7 +149,7 @@ export class BaseDetail extends Base {
dataIndex: 'api_address',
},
{
label: t('Master Addresses'),
label: t('Master Node Addresses'),
dataIndex: 'master_addresses',
render: (value) =>
value && value.length ? value.map((it) => <div>{it}</div>) : '-',
@ -192,7 +192,7 @@ export class BaseDetail extends Base {
];
return {
title: t('Labels'),
title: t('Additional Labels'),
labelCol: 2,
options,
};

View File

@ -37,7 +37,12 @@ export class StepInfo extends Base {
}
get clusterTemplates() {
return globalClusterTemplateStore.list.data || [];
const templates = globalClusterTemplateStore.list.data || [];
const { template } = this.locationParams;
if (template) {
return templates.filter((it) => it.uuid === template);
}
return templates;
}
async getKeypairs() {
@ -48,6 +53,16 @@ export class StepInfo extends Base {
return globalKeypairStore.list.data || [];
}
get defaultValue() {
const { template } = this.locationParams;
if (template) {
return {
clusterTemplate: { selectedRowKeys: [template] },
};
}
return {};
}
get formItems() {
return [
{
@ -80,7 +95,7 @@ export class StepInfo extends Base {
data: this.keypairs,
isLoading: globalKeypairStore.list.isLoading,
tip: t(
'The SSH key is a way to remotely log in to the instance. The cloud platform only helps to keep the public key. Please keep your private key properly.'
'The SSH key is a way to remotely log in to the cluster instance. The cloud platform only helps to keep the public key. Please keep your private key properly.'
),
filterParams: [
{

View File

@ -51,15 +51,15 @@ export class StepCreate extends StepAction {
get steps() {
return [
{
title: t('Info *'),
title: t('Cluster Info'),
component: StepInfo,
},
{
title: t('Node Spec *'),
title: t('Node Spec'),
component: StepNodeSpec,
},
{
title: t('Networks'),
title: t('Network Setting'),
component: StepNetworks,
},
{
@ -67,7 +67,7 @@ export class StepCreate extends StepAction {
component: StepManagement,
},
{
title: t('Labels'),
title: t('Additional Labels'),
component: StepLabel,
},
];
@ -100,8 +100,8 @@ export class StepCreate extends StepAction {
name: values.name,
labels: {
...requestLabels,
auto_healing_enabled: `${auto_healing_enabled ? true : false}`,
auto_scaling_enabled: `${auto_scaling_enabled ? true : false}`,
auto_healing_enabled: `${!!auto_healing_enabled}`,
auto_scaling_enabled: `${!!auto_scaling_enabled}`,
},
master_flavor_id: masterFlavor.selectedRowKeys[0],
flavor_id: flavor.selectedRowKeys[0],