diff --git a/src/locales/en.json b/src/locales/en.json index cd2c4a03..159b68f1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -955,7 +955,7 @@ "Flavor Info": "Flavor Info", "Flavor Name": "Flavor Name", "Flavor of Master Nodes": "Flavor of Master Nodes", - "Flavor of Worker Nodes": "Flavor of Worker Nodes", + "Flavor of Nodes": "Flavor of Nodes", "Flavors": "Flavors", "Floating IP": "Floating IP", "Floating IP Address": "Floating IP Address", @@ -1130,6 +1130,7 @@ "If an instance is using this flavor, deleting it will cause the instance's flavor data to be missing. Are you sure to delete {name}?": "If an instance is using this flavor, deleting it will cause the instance's flavor data to be missing. Are you sure to delete {name}?", "If checked, the network will be enable.": "If checked, the network will be enable.", "If it is an SNI type certificate, a domain name needs to be specified": "If it is an SNI type certificate, a domain name needs to be specified", + "If it’s not set, the value of this in template will be used.": "If it’s not set, the value of this in template will be used.", "If no gateway is specified, the first IP address will be defaulted.": "If no gateway is specified, the first IP address will be defaulted.", "If not provided, the roles assigned to the application credential will be the same as the roles in the current token.": "If not provided, the roles assigned to the application credential will be the same as the roles in the current token.", "If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.": "If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.", @@ -1427,7 +1428,6 @@ "Master Count": "Master Count", "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", @@ -1567,7 +1567,6 @@ "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", @@ -1597,7 +1596,6 @@ "Number of Nodes": "Number of Nodes", "Number of Ports": "Number of Ports", "Number of Usb Controller": "Number of Usb Controller", - "Number of Worker Nodes": "Number of Worker Nodes", "OK": "OK", "OS": "OS", "OS Admin": "OS Admin", @@ -2290,6 +2288,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. If it’s not set, the value of this in template will be used.": "The SSH key is a way to remotely log in to the cluster instance. If it’s not set, the value of this in template will be used.", "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", @@ -2613,7 +2612,7 @@ "When you do online backup of the volume that has been bound, you need to pay attention to the following points:": "When you do online backup of the volume that has been bound, you need to pay attention to the following points:", "When you restore a backup, you need to meet one of the following conditions:": "When you restore a backup, you need to meet one of the following conditions:", "When your Yaml file is a fixed template, variable variables can be stored in an environment variable file to implement template deployment. The parameters in the environment variable file need to match the parameters defined in the template file.": "When your Yaml file is a fixed template, variable variables can be stored in an environment variable file to implement template deployment. The parameters in the environment variable file need to match the parameters defined in the template file.", - "Whether enable or not using the floating IP of cloud provider. If it’s not set, the value of this in template will be used.": "Whether enable or not using the floating IP of cloud provider. If it’s not set, the value of this in template will be used.", + "Whether enable or not using the floating IP of cloud provider.": "Whether enable or not using the floating IP of cloud provider.", "Whether the Login Name can be used is up to the feasible configuration of cloud-init or cloudbase-init service in the image.": "Whether the Login Name can be used is up to the feasible configuration of cloud-init or cloudbase-init service in the image.", "Whether the boot device should be set only for the next reboot, or persistently.": "Whether the boot device should be set only for the next reboot, or persistently.", "Which Network Interface provider to use when plumbing the network connections for this Node": "Which Network Interface provider to use when plumbing the network connections for this Node", diff --git a/src/locales/zh.json b/src/locales/zh.json index 2bdee839..d0324a1e 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -955,7 +955,7 @@ "Flavor Info": "配置信息", "Flavor Name": "云主机类型名称", "Flavor of Master Nodes": "主节点类型", - "Flavor of Worker Nodes": "工作节点类型", + "Flavor of Nodes": "节点类型", "Flavors": "云主机类型", "Floating IP": "浮动IP", "Floating IP Address": "浮动IP地址", @@ -1130,6 +1130,7 @@ "If an instance is using this flavor, deleting it will cause the instance's flavor data to be missing. Are you sure to delete {name}?": "若有云主机正在使用此 flavor,删除会导致云主机的 flavor 数据缺失,确定删除 {name} ?", "If checked, the network will be enable.": "如果选中,那么网络将被启用。", "If it is an SNI type certificate, a domain name needs to be specified": "如果是 SNI 类型证书,需指定域名", + "If it’s not set, the value of this in template will be used.": "如果不设置,将使用模板的值", "If no gateway is specified, the first IP address will be defaulted.": "如果不指定网关IP,默认是第一个地址。", "If not provided, the roles assigned to the application credential will be the same as the roles in the current token.": "如果不选择,那么分配给应用凭证的角色将与当前用户的角色相同。", "If nova-compute on the host is disabled, it will be forbidden to be selected as the target host.": "如果计算节点上的nova-compute被禁用,将禁止其作为目标节点。", @@ -1427,7 +1428,6 @@ "Master Count": "主数量", "Master Node Addresses": "主节点地址", "Master Node Flavor ID": "主节点类型ID", - "Master Node LB": "主节点负载均衡", "Master Node LB Enabled": "启用主节点负载均衡", "Mauritania": "毛里塔尼亚", "Mauritius": "毛里求斯", @@ -1567,7 +1567,6 @@ "Node Addresses": "节点地址", "Node Count": "节点数量", "Node Driver": "节点驱动", - "Node Flavor": "节点类型", "Node Flavor ID": "节点类型ID", "Node ID/Name": "节点ID/名称", "Node Info": "节点信息", @@ -1597,7 +1596,6 @@ "Number of Nodes": "节点数量", "Number of Ports": "端口数量", "Number of Usb Controller": "USB控制器数量", - "Number of Worker Nodes": "工作节点数量", "OK": "", "OS": "操作系统", "OS Admin": "镜像默认用户", @@ -2290,6 +2288,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. If it’s not set, the value of this in template will be used.": "SSH 密钥是一种远程登录集群实例的方式,如果不设置,将使用模板的值。", "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 相关的云主机为负载均衡服务搭建所需,不建议选择", @@ -2613,7 +2612,7 @@ "When you do online backup of the volume that has been bound, you need to pay attention to the following points:": "当您对已经绑定的硬盘做在线备份时,需要注意以下几点:", "When you restore a backup, you need to meet one of the following conditions:": "当您恢复备份时,需要满足以下条件之一:", "When your Yaml file is a fixed template, variable variables can be stored in an environment variable file to implement template deployment. The parameters in the environment variable file need to match the parameters defined in the template file.": "当您的Yaml文件为一个固定模版时,可变变量可以存放在环境变量文件中来实现模版部署,环境变量文件中的参数需要与模版文件中定义的参数保持匹配。", - "Whether enable or not using the floating IP of cloud provider. If it’s not set, the value of this in template will be used.": "是否启用或不使用云服务商的浮动IP。如果未设置,则使用模板中的值。", + "Whether enable or not using the floating IP of cloud provider.": "是否启用或不使用云服务商的浮动IP。", "Whether the Login Name can be used is up to the feasible configuration of cloud-init or cloudbase-init service in the image.": "用户名是否可登录取决于镜像中的cloud-init或cloudbase-init服务的预制配置", "Whether the boot device should be set only for the next reboot, or persistently.": "是否永久使用该引导设置。", "Which Network Interface provider to use when plumbing the network connections for this Node": "当为这个节点连接网络时,使用哪个网络接口提供者", diff --git a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx index 1a965235..f8a3154f 100644 --- a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx +++ b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNetwork/index.jsx @@ -266,13 +266,17 @@ export class StepNetwork extends Base { }, { name: 'master_lb_enabled', - label: t('Master Node LB'), + label: t('Enable Load Balancer'), type: 'check', + content: t('Enabled Load Balancer for Master Nodes'), }, { name: 'floating_ip_enabled', - label: t('Floating IP'), + label: t('Enable Floating IP'), type: 'check', + tip: t( + 'Whether enable or not using the floating IP of cloud provider.' + ), }, ]; } diff --git a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx index d8713a34..3870e3cd 100644 --- a/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx +++ b/src/pages/container-infra/containers/ClusterTemplates/actions/StepCreate/StepNodeSpec/index.jsx @@ -18,11 +18,7 @@ import Base from 'components/Form'; import globalImageStore from 'src/stores/glance/image'; import globalKeypairStore from 'src/stores/nova/keypair'; import FlavorSelectTable from 'src/pages/compute/containers/Instance/components/FlavorSelectTable'; -import { - getImageColumns, - getImageSystemTabs, - getImageOS, -} from 'resources/glance/image'; +import { getImageColumns } from 'resources/glance/image'; export class StepNodeSpec extends Base { init() { @@ -47,7 +43,7 @@ export class StepNodeSpec extends Base { } async getImageList() { - await globalImageStore.fetchList(); + await globalImageStore.fetchList({ all_projects: this.hasAdminRole }); this.updateDefaultValue(); } @@ -63,10 +59,10 @@ export class StepNodeSpec extends Base { const { context: { coe = '' } = {} } = this.props; let acceptedOs = []; if (coe === 'kubernetes') { - acceptedOs = ['fedora', 'coreos', 'others']; + acceptedOs = ['fedora-coreos']; } else if (['swarm', 'swarm-mode'].includes(coe)) { - acceptedOs = ['fedora']; - } else if (['mesos', 'dcos'].includes(coe)) { + acceptedOs = ['fedora-atomic']; + } else { acceptedOs = ['ubuntu']; } return acceptedOs; @@ -76,22 +72,11 @@ export class StepNodeSpec extends Base { return getImageColumns(this); } - get systemTabs() { - const imageTabs = getImageSystemTabs(); - return imageTabs.filter((it) => this.acceptedImageOs.includes(it.value)); - } - - onImageTabChange = (value) => { - this.setState({ - imageTab: value, - }); - }; - get imageList() { - const { imageTab } = this.state; - return (globalImageStore.list.data || []) - .filter((it) => this.acceptedImageOs.includes(it.os_distro)) - .filter((it) => getImageOS(it) === imageTab); + return (globalImageStore.list.data || []).filter((it) => { + const { originData: { os_distro } = {} } = it; + return this.acceptedImageOs.includes(os_distro); + }); } get volumeDrivers() { @@ -172,10 +157,6 @@ export class StepNodeSpec extends Base { }, ], columns: this.imageColumns, - tabs: this.systemTabs, - defaultTabValue: this.systemTabs[0].value, - onTabChange: this.onImageTabChange, - imageTabAuto: true, }, { name: 'keypairs', @@ -205,7 +186,7 @@ export class StepNodeSpec extends Base { }, { name: 'flavor', - label: t('Node Flavor'), + label: t('Flavor of Nodes'), type: 'select-table', component: , }, diff --git a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepInfo/index.jsx b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepInfo/index.jsx index 48e6bfc7..532789de 100644 --- a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepInfo/index.jsx +++ b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepInfo/index.jsx @@ -53,6 +53,13 @@ export class StepInfo extends Base { return globalKeypairStore.list.data || []; } + handleTemplateChange = (e) => { + const { selectedRows = [] } = e; + this.setState({ + clusterTemplate: selectedRows[0], + }); + }; + get defaultValue() { const { template } = this.locationParams; if (template) { @@ -64,6 +71,9 @@ export class StepInfo extends Base { } get formItems() { + const { clusterTemplate } = this.state; + const { keypair_id } = clusterTemplate || {}; + return [ { name: 'name', @@ -86,16 +96,17 @@ export class StepInfo extends Base { }, ], columns: getBaseTemplateColumns(this), + onChange: this.handleTemplateChange, }, { name: 'keypair', label: t('Keypair'), type: 'select-table', - required: true, + required: !keypair_id, data: this.keypairs, isLoading: globalKeypairStore.list.isLoading, tip: t( - '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. If it’s not set, the value of this in template will be used.' ), filterParams: [ { diff --git a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNetworks/index.jsx b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNetworks/index.jsx index e7c2a2dc..66e0ccaf 100644 --- a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNetworks/index.jsx +++ b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNetworks/index.jsx @@ -14,6 +14,7 @@ import Base from 'components/Form'; import { inject, observer } from 'mobx-react'; +import { defaultTip } from 'resources/magnum/cluster'; export class StepNetworks extends Base { get title() { @@ -45,6 +46,7 @@ export class StepNetworks extends Base { label: t('Enable Load Balancer'), type: 'check', content: t('Enabled Load Balancer for Master Nodes'), + tip: defaultTip, }, { name: 'newNetwork', @@ -65,9 +67,7 @@ export class StepNetworks extends Base { name: 'floating_ip_enabled', label: t('Enable Floating IP'), type: 'check', - tip: t( - 'Whether enable or not using the floating IP of cloud provider. If it’s not set, the value of this in template will be used.' - ), + tip: defaultTip, }, ]; } diff --git a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNodeSpec/index.jsx b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNodeSpec/index.jsx index f62a7fab..bc9494f5 100644 --- a/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNodeSpec/index.jsx +++ b/src/pages/container-infra/containers/Clusters/actions/StepCreate/StepNodeSpec/index.jsx @@ -16,6 +16,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import Base from 'components/Form'; import FlavorSelectTable from 'src/pages/compute/containers/Instance/components/FlavorSelectTable'; +import { defaultTip } from 'resources/magnum/cluster'; export class StepNodeSpec extends Base { get title() { @@ -46,6 +47,10 @@ export class StepNodeSpec extends Base { } get formItems() { + const { context: { clusterTemplate = {} } = {} } = this.props; + const { selectedRows = [] } = clusterTemplate; + const { master_flavor_id, flavor_id } = selectedRows[0] || {}; + return [ { name: 'master_count', @@ -59,24 +64,26 @@ export class StepNodeSpec extends Base { label: t('Flavor of Master Nodes'), type: 'select-table', component: this.getFlavorComponent(), - required: true, + required: !master_flavor_id, + tip: defaultTip, }, { type: 'divider', }, { name: 'node_count', - label: t('Number of Worker Nodes'), + label: t('Number of Nodes'), type: 'input-int', min: 1, required: true, }, { name: 'flavor', - label: t('Flavor of Worker Nodes'), + label: t('Flavor of Nodes'), type: 'select-table', component: this.getFlavorComponent(), - required: true, + required: !flavor_id, + tip: defaultTip, }, ]; } diff --git a/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx b/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx index 534e18c2..d5477668 100644 --- a/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx +++ b/src/pages/container-infra/containers/Clusters/actions/StepCreate/index.jsx @@ -103,13 +103,22 @@ export class StepCreate extends StepAction { auto_healing_enabled: `${!!auto_healing_enabled}`, auto_scaling_enabled: `${!!auto_scaling_enabled}`, }, - master_flavor_id: masterFlavor.selectedRowKeys[0], - flavor_id: flavor.selectedRowKeys[0], cluster_template_id: clusterTemplate.selectedRowKeys[0], - keypair: keypair.selectedRowKeys[0], ...rest, }; + if (keypair) { + data.keypair = keypair.selectedRowKeys[0]; + } + + if (masterFlavor) { + data.master_flavor_id = masterFlavor.selectedRowKeys[0]; + } + + if (flavor) { + data.flavor_id = flavor.selectedRowKeys[0]; + } + if (!newNetwork && fixed_network) { const { selectedRowKeys = [] } = fixed_network; data.fixed_network = selectedRowKeys[0]; diff --git a/src/resources/magnum/cluster.js b/src/resources/magnum/cluster.js index d2d119ff..f7a637ad 100644 --- a/src/resources/magnum/cluster.js +++ b/src/resources/magnum/cluster.js @@ -38,3 +38,7 @@ export const healthStatus = { UNHEALTHY: t('UNHEALTHY'), UNKNOWN: t('UNKNOWN'), }; + +export const defaultTip = t( + 'If it’s not set, the value of this in template will be used.' +);