From eec23aebf01d902300ee8aa6a182cfb2db4aab1e Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Fri, 27 May 2022 11:02:00 +0800 Subject: [PATCH] fix: Add unit to memory quota 1. Add GiB unit to memory quota 2. Fix database && container volume size unit to GiB Change-Id: I553a20e9fa620f2cda3509b52d801894d230040c --- src/locales/en.json | 13 +- src/locales/zh.json | 15 +-- .../Overview/components/QuotaOverview.jsx | 12 +- .../actions/StepCreate/ParamSetting.jsx | 2 +- .../actions/StepCreate/StepNodeSpec/index.jsx | 117 ++++++++---------- src/resources/cinder/cinder-pool.jsx | 2 +- 6 files changed, 78 insertions(+), 83 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 62f8a992..a190a48e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -204,6 +204,7 @@ "Backup File Location": "Backup File Location", "Backup Mode": "Backup Mode", "Backup Name": "Backup Name", + "Backup gigabytes (GiB)": "Backup gigabytes (GiB)", "Backups": "Backups", "Backups & Snapshots": "Backups & Snapshots", "Bad Gateway (code: 502) ": "Bad Gateway (code: 502) ", @@ -722,7 +723,7 @@ "Docker Swarm": "Docker Swarm", "Docker Swarm Mode": "Docker Swarm Mode", "Docker Volume Size": "Docker Volume Size", - "Docker Volume Size (GB)": "Docker Volume Size (GB)", + "Docker Volume Size (GiB)": "Docker Volume Size (GiB)", "Domain": "Domain", "Domain Detail": "Domain Detail", "Domain Edit": "Domain Edit", @@ -965,7 +966,7 @@ "Get {name} error.": "Get {name} error.", "Ghana": "Ghana", "Gibraltar": "Gibraltar", - "Gigabytes(GB)": "Gigabytes(GB)", + "Gigabytes (GiB)": "Gigabytes (GiB)", "Given IP": "Given IP", "Glance": "Glance", "Global Setting": "Global Setting", @@ -1373,6 +1374,7 @@ "Member in group": "Member in group", "Members": "Members", "Memory": "Memory", + "Memory (GiB)": "Memory (GiB)", "Memory Optimized": "Memory Optimized", "Memory Page": "Memory Page", "Memory Page Size": "Memory Page Size", @@ -1633,7 +1635,7 @@ "Please enter a correct domain, format is refer to the left tip!": "Please enter a correct domain, format is refer to the left tip!", "Please enter a correct private key, format is refer to the left tip!": "Please enter a correct private key, format is refer to the left tip!", "Please enter a file link starting with \"http://\" or \"https://\"!": "Please enter a file link starting with \"http://\" or \"https://\"!", - "Please enter a memory page size, such as: 1024, 1024MB": "Please enter a memory page size, such as: 1024, 1024MB", + "Please enter a memory page size, such as: 1024, 1024MiB": "Please enter a memory page size, such as: 1024, 1024MiB", "Please enter a valid ASCII code": "Please enter a valid ASCII code", "Please enter a valid Email Address!": "Please enter a valid Email Address!", "Please enter a valid Phone Number": "Please enter a valid Phone Number", @@ -2100,7 +2102,7 @@ "Stopped": "Stopped", "Storage": "Storage", "Storage Backend": "Storage Backend", - "Storage Capacity(GB)": "Storage Capacity(GB)", + "Storage Capacity(GiB)": "Storage Capacity(GiB)", "Storage Cluster": "Storage Cluster", "Storage Cluster Bandwidth": "Storage Cluster Bandwidth", "Storage Cluster IOPS": "Storage Cluster IOPS", @@ -2505,7 +2507,6 @@ "availability zones": "availability zones", "available": "available", "backup": "backup", - "backup gigabytes (GiB)": "backup gigabytes (GiB)", "backups": "backups", "bare metal node": "bare metal node", "bare metal nodes": "bare metal nodes", @@ -2780,7 +2781,7 @@ "{interval, plural, =1 {one week} other {# weeks} } later delete": "{interval, plural, =1 {one week} other {# weeks} } later delete", "{minutes} minutes {leftSeconds} seconds": "{minutes} minutes {leftSeconds} seconds", "{name} type": "{name} type", - "{name} type gigabytes(GB)": "{name} type gigabytes(GB)", + "{name} type gigabytes(GiB)": "{name} type gigabytes(GiB)", "{name} type snapshots": "{name} type snapshots", "{name} {id} could not be found.": "{name} {id} could not be found.", "{number} port forwarding rules": "{number} port forwarding rules", diff --git a/src/locales/zh.json b/src/locales/zh.json index ca89a15f..b271b216 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -204,6 +204,7 @@ "Backup File Location": "备份文件地址", "Backup Mode": "备份方式", "Backup Name": "备份名称", + "Backup gigabytes (GiB)": "备份容量 (GiB)", "Backups": "备份", "Backups & Snapshots": "备份和快照", "Bad Gateway (code: 502) ": "无效网关(错误码:502)", @@ -722,7 +723,7 @@ "Docker Swarm": "Docker集群", "Docker Swarm Mode": "Docker集群模式", "Docker Volume Size": "Docker硬盘大小", - "Docker Volume Size (GB)": "Docker硬盘大小(GB)", + "Docker Volume Size (GiB)": "Docker硬盘大小(GiB)", "Domain": "域", "Domain Detail": "域详情", "Domain Edit": "编辑域", @@ -965,7 +966,7 @@ "Get {name} error.": "获取{name}失败。", "Ghana": "加纳", "Gibraltar": "直布罗陀", - "Gigabytes(GB)": "云硬盘容量(GB)", + "Gigabytes (GiB)": "", "Given IP": "指定IP", "Glance": "", "Global Setting": "平台配置", @@ -1373,6 +1374,7 @@ "Member in group": "组内成员", "Members": "成员", "Memory": "内存", + "Memory (GiB)": "内存 (GiB)", "Memory Optimized": "内存型", "Memory Page": "内存页", "Memory Page Size": "内存页大小", @@ -1633,7 +1635,7 @@ "Please enter a correct domain, format is refer to the left tip!": "请输入正确的域名,格式参考左边提示!", "Please enter a correct private key, format is refer to the left tip!": "请输入正确的密钥,格式参考左边提示!", "Please enter a file link starting with \"http://\" or \"https://\"!": "请输入以“http://”或“https://”开头的文件链接!", - "Please enter a memory page size, such as: 1024, 1024MB": "请输入内存页大小,如:1024, 1024MB", + "Please enter a memory page size, such as: 1024, 1024MiB": "请输入内存页大小,如:1024, 1024MiB", "Please enter a valid ASCII code": "请输入有效的ASCII码", "Please enter a valid Email Address!": "请输入一个有效的邮箱地址", "Please enter a valid Phone Number": "请输入一个有效的手机号", @@ -1800,7 +1802,7 @@ "RSVP": "", "Raid Interface": "Raid接口", "Ram Size(GiB)": "内存容量(GiB)", - "Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ": "内存是 { ram }MB,NUMA节点的内存是{ totalRam }MB,需要一致。", + "Ram value is { ram }, NUMA RAM value is { totalRam }, need to be equal. ": "内存是 { ram }MiB,NUMA节点的内存是{ totalRam }MiB,需要一致。", "Ramdisk ID": "内存盘ID", "Ramdisk Image": "Ramdisk镜像", "Read And Write": "", @@ -2100,7 +2102,7 @@ "Stopped": "已关闭", "Storage": "存储", "Storage Backend": "存储后端", - "Storage Capacity(GB)": "存储容量(GB)", + "Storage Capacity(GiB)": "存储容量(GiB)", "Storage Cluster": "存储集群", "Storage Cluster Bandwidth": "存储集群带宽", "Storage Cluster IOPS": "存储集群IOPS", @@ -2505,7 +2507,6 @@ "availability zones": "可用域", "available": "可用", "backup": "备份", - "backup gigabytes (GiB)": "备份容量(GiB)", "backups": "备份", "bare metal node": "裸机节点", "bare metal nodes": "裸机节点", @@ -2780,7 +2781,7 @@ "{interval, plural, =1 {one week} other {# weeks} } later delete": "{interval}周后删除", "{minutes} minutes {leftSeconds} seconds": "{minutes}分{leftSeconds}秒", "{name} type": "{name} 类型", - "{name} type gigabytes(GB)": "{name} 类型容量(GB)", + "{name} type gigabytes(GiB)": "{name} 类型容量(GiB)", "{name} type snapshots": "{name} 类型快照", "{name} {id} could not be found.": "您查看的资源{name} {id} 无法获取", "{number} port forwarding rules": "{number}个端口转发规则", diff --git a/src/pages/base/containers/Overview/components/QuotaOverview.jsx b/src/pages/base/containers/Overview/components/QuotaOverview.jsx index 42ed5439..8d04ea77 100644 --- a/src/pages/base/containers/Overview/components/QuotaOverview.jsx +++ b/src/pages/base/containers/Overview/components/QuotaOverview.jsx @@ -34,7 +34,7 @@ export const quotaCardList = [ value: [ { text: t('Instances'), key: 'instances' }, { text: t('vCPUs'), key: 'cores' }, - { text: t('Memory'), key: 'ram' }, + { text: t('Memory (GiB)'), key: 'ram' }, { text: t('Key Pair'), key: 'key_pairs' }, { text: t('Server Group'), key: 'server_groups' }, ], @@ -44,11 +44,11 @@ export const quotaCardList = [ type: 'storage', value: [ { - text: t('volumes'), + text: t('Volumes'), key: 'volumes', }, { - text: t('Gigabytes(GB)'), + text: t('Gigabytes (GiB)'), key: 'gigabytes', }, { @@ -56,11 +56,11 @@ export const quotaCardList = [ key: 'snapshots', }, { - text: t('backups'), + text: t('Backups'), key: 'backups', }, { - text: t('backup gigabytes (GiB)'), + text: t('Backup gigabytes (GiB)'), key: 'backup_gigabytes', }, ], @@ -104,7 +104,7 @@ export const getVolumeTypeCards = (data) => { key: `volumes_${item.name}`, }, { - text: t('{name} type gigabytes(GB)', { name: item.name }), + text: t('{name} type gigabytes(GiB)', { name: item.name }), key: `gigabytes_${item.name}`, }, { diff --git a/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx b/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx index 623026c4..35bc4914 100644 --- a/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx +++ b/src/pages/compute/containers/Flavor/actions/StepCreate/ParamSetting.jsx @@ -305,7 +305,7 @@ export class ParamSetting extends Base { 'The unit suffix must be one of the following: Kb(it), Kib(it), Mb(it), Mib(it), Gb(it), Gib(it), Tb(it), Tib(it), KB, KiB, MB, MiB, GB, GiB, TB, TiB. If the unit suffix is not provided, it is assumed to be KB.' ); const pageSizePlaceholder = t( - 'Please enter a memory page size, such as: 1024, 1024MB' + 'Please enter a memory page size, such as: 1024, 1024MiB' ); return [ 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 e525aa95..52e7db3c 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 @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. - -import globalImageStore from "src/stores/glance/image"; -import globalKeypairStore from "src/stores/nova/keypair"; -import Base from "components/Form"; -import { inject, observer } from "mobx-react"; +import globalImageStore from 'src/stores/glance/image'; +import globalKeypairStore from 'src/stores/nova/keypair'; +import Base from 'components/Form'; +import { inject, observer } from 'mobx-react'; import React from 'react'; -import FlavorSelectTable from "src/pages/compute/containers/Instance/components/FlavorSelectTable"; +import FlavorSelectTable from 'src/pages/compute/containers/Instance/components/FlavorSelectTable'; export class StepNodeSpec extends Base { init() { @@ -27,11 +26,11 @@ export class StepNodeSpec extends Base { } get title() { - return t("Node Spec"); + return t('Node Spec'); } get name() { - return t("Node Spec"); + return t('Node Spec'); } async getImageOsDistro() { @@ -69,25 +68,23 @@ export class StepNodeSpec extends Base { get getVolumeDriver() { const { context = {} } = this.props; - const { - coeSelectRows = "", - coe = "" - } = context; - let volumeDriver = []; + const { coeSelectRows = '', coe = '' } = context; + const volumeDriver = []; if (!coeSelectRows || !coe) { - volumeDriver.push({ val: "cinder", name: "Cinder" }, { val: "rexray", name: "Rexray" }) + volumeDriver.push( + { val: 'cinder', name: 'Cinder' }, + { val: 'rexray', name: 'Rexray' } + ); } - if (coeSelectRows === "kubernetes") { - volumeDriver.push({ val: "cinder", name: "Cinder" }) + if (coeSelectRows === 'kubernetes') { + volumeDriver.push({ val: 'cinder', name: 'Cinder' }); + } else if (coeSelectRows) { + volumeDriver.push({ val: 'rexray', name: 'Rexray' }); } - else if (coeSelectRows) { - volumeDriver.push({ val: "rexray", name: "Rexray" }) - } - return (volumeDriver || []) - .map((it) => ({ - value: it.val, - label: it.name, - })); + return (volumeDriver || []).map((it) => ({ + value: it.val, + label: it.name, + })); } onFlavorChange = (value) => { @@ -116,20 +113,20 @@ export class StepNodeSpec extends Base { get formItems() { return [ { - name: "image", - label: t("Image"), - type: "select", + name: 'image', + label: t('Image'), + type: 'select', options: this.getImageOsDistroList, allowClear: true, - showSearch: true + showSearch: true, }, { - name: "keypair", - label: t("Keypair"), - type: "select", + name: 'keypair', + label: t('Keypair'), + type: 'select', options: this.getKeypairList, allowClear: true, - showSearch: true + showSearch: true, }, { name: 'flavorCurrent', @@ -141,9 +138,7 @@ export class StepNodeSpec extends Base { name: 'flavor', label: t('Flavor'), type: 'select-table', - component: ( - - ), + component: , }, { name: 'masterFlavorCurrent', @@ -152,47 +147,45 @@ export class StepNodeSpec extends Base { iconType: 'flavor', }, { - name: "masterFlavor", - label: t("Master Flavor"), - type: "select-table", - component: ( - - ), + name: 'masterFlavor', + label: t('Master Flavor'), + type: 'select-table', + component: , }, { - name: "volumeDriver", - label: t("Volume Driver"), - type: "select", + name: 'volumeDriver', + label: t('Volume Driver'), + type: 'select', options: this.getVolumeDriver, allowClear: true, - showSearch: true + showSearch: true, }, { - name: "dockerStorageDriver", - label: t("Docker Storage Driver"), - type: "select", + name: 'dockerStorageDriver', + label: t('Docker Storage Driver'), + type: 'select', options: [ { - label: t("Overlay"), - value: "overlay" + label: t('Overlay'), + value: 'overlay', }, { - label: t("Overlay2"), - value: "overlay2" - } + label: t('Overlay2'), + value: 'overlay2', + }, ], allowClear: true, - showSearch: true + showSearch: true, }, { - name: "dockerVolumeSize", - label: t("Docker Volume Size (GB)"), - type: "input-number", - min: "1", - placeholder: "Spec" - } - ] + name: 'dockerVolumeSize', + label: t('Docker Volume Size (GiB)'), + type: 'input-number', + min: '1', + placeholder: 'Spec', + }, + ]; } } -export default inject("rootStore")(observer(StepNodeSpec)) \ No newline at end of file +export default inject('rootStore')(observer(StepNodeSpec)); diff --git a/src/resources/cinder/cinder-pool.jsx b/src/resources/cinder/cinder-pool.jsx index 855a09d2..e201ea31 100644 --- a/src/resources/cinder/cinder-pool.jsx +++ b/src/resources/cinder/cinder-pool.jsx @@ -30,7 +30,7 @@ export const poolColumns = [ isHideable: true, }, { - title: t('Storage Capacity(GB)'), + title: t('Storage Capacity(GiB)'), dataIndex: 'usedGBPercent', isHideable: true, render: (value, record) => (