From eae1e272565981c1cde3c1b5cd2b5bf637a6ed35 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Wed, 25 May 2022 13:37:07 +0800 Subject: [PATCH] fix: Fix GB/MB unit to GiB/MiB 1. Fix size unit to GiB/MiB for volume/snapshot/backup/image/flavor/monitor 2. Update i18n for Zun Change-Id: I97bc881b438c9922a2123c36b7e8ea40e5307fd2 --- .../FormItem/InstanceVolume/index.jsx | 2 +- src/components/FormItem/NUMAInput/index.jsx | 2 +- src/components/FormItem/ZunVolume/index.jsx | 53 +++++------ src/locales/en.json | 84 +++++++++++++++--- src/locales/zh.json | 88 +++++++++++++++---- .../components/VirtualResource.jsx | 2 +- .../containers/Flavor/Detail/BaseDetail.jsx | 4 +- .../actions/StepCreate/ParamSetting.jsx | 6 +- .../Hypervisors/Hypervisor/Detail/index.jsx | 2 +- .../containers/Image/Detail/BaseDetail.jsx | 6 +- .../containers/Image/actions/Create.jsx | 4 +- .../containers/Image/actions/CreateVolume.jsx | 4 +- .../compute/containers/Image/actions/Edit.jsx | 4 +- .../Instance/Detail/BaseDetail/index.jsx | 4 +- .../CreateIronic/ConfirmStep/index.jsx | 4 +- .../Instance/actions/DetachVolume.jsx | 2 +- .../actions/StepCreate/BaseStep/index.jsx | 6 +- .../actions/StepCreate/ConfirmStep/index.jsx | 8 +- .../monitor/containers/Overview/config.jsx | 4 +- .../containers/Backup/Detail/index.jsx | 2 +- .../Backup/actions/CreateVolume.jsx | 4 +- .../containers/Snapshot/Detail/index.jsx | 2 +- .../Snapshot/actions/CreateVolume.jsx | 4 +- .../storage/containers/Snapshot/index.jsx | 2 +- .../containers/Volume/actions/Attach.jsx | 2 +- .../containers/Volume/actions/ChangeType.jsx | 2 +- .../Volume/actions/Create/index.jsx | 12 +-- .../Volume/actions/CreateBackup.jsx | 2 +- .../Volume/actions/CreateSnapshot.jsx | 2 +- .../containers/Volume/actions/Detach.jsx | 2 +- .../Volume/actions/ExtendVolume.jsx | 8 +- .../containers/Volume/actions/Migrate.jsx | 2 +- .../containers/Volume/actions/Restore.jsx | 4 +- .../Volume/actions/UpdateStatus.jsx | 2 +- src/resources/cinder/backup.jsx | 2 +- src/resources/cinder/volume.jsx | 4 +- src/resources/nova/flavor.js | 2 +- src/resources/nova/hypervisor.jsx | 2 +- src/stores/keystone/project.js | 6 +- src/stores/nova/hypervisor.js | 18 ++-- src/stores/prometheus/monitor-base.js | 2 +- src/stores/prometheus/storage-cluster.js | 4 +- src/utils/index.js | 25 ++++-- src/utils/index.test.js | 46 +++++----- 44 files changed, 285 insertions(+), 167 deletions(-) diff --git a/src/components/FormItem/InstanceVolume/index.jsx b/src/components/FormItem/InstanceVolume/index.jsx index 382df453..b10d4a8e 100644 --- a/src/components/FormItem/InstanceVolume/index.jsx +++ b/src/components/FormItem/InstanceVolume/index.jsx @@ -181,7 +181,7 @@ export default class InstanceVolume extends React.Component { {t('Size')} {input} - GB + GiB {checkbox} diff --git a/src/components/FormItem/NUMAInput/index.jsx b/src/components/FormItem/NUMAInput/index.jsx index 26058277..3bd3e876 100644 --- a/src/components/FormItem/NUMAInput/index.jsx +++ b/src/components/FormItem/NUMAInput/index.jsx @@ -86,7 +86,7 @@ export default class index extends Component { <> {t('CPU(Core)')} - {t('RAM(MB)')} + {t('RAM(MiB)')} ); diff --git a/src/components/FormItem/ZunVolume/index.jsx b/src/components/FormItem/ZunVolume/index.jsx index 20033eed..3a6e5796 100644 --- a/src/components/FormItem/ZunVolume/index.jsx +++ b/src/components/FormItem/ZunVolume/index.jsx @@ -29,15 +29,21 @@ export default class ZunVolume extends React.Component { this.state = { type: [], source: [], - destination: "", + destination: '', cinderVolumeSize: 0, - isCinderVolume: false + isCinderVolume: false, }; } static getDerivedStateFromProps(nextProps, prevState) { - const { type, source, cinderVolumeSize, destination } = nextProps.value || {}; - if (type !== prevState.type || source !== prevState.source || cinderVolumeSize !== prevState.cinderVolumeSize || destination !== prevState.destination) { + const { type, source, cinderVolumeSize, destination } = + nextProps.value || {}; + if ( + type !== prevState.type || + source !== prevState.source || + cinderVolumeSize !== prevState.cinderVolumeSize || + destination !== prevState.destination + ) { return { type, source, @@ -56,19 +62,15 @@ export default class ZunVolume extends React.Component { }; onTypeChange = (value) => { - if (value === "cinder-new") { - this.setState( - { - isCinderVolume: true, - }, - ); + if (value === 'cinder-new') { + this.setState({ + isCinderVolume: true, + }); } - if (value === "cinder-available") { - this.setState( - { - isCinderVolume: false, - }, - ); + if (value === 'cinder-available') { + this.setState({ + isCinderVolume: false, + }); } this.onChange({ ...this.state, @@ -86,25 +88,20 @@ export default class ZunVolume extends React.Component { onCinderVolumeSizeChange = (e) => { this.onChange({ ...this.state, - cinderVolumeSize: e + cinderVolumeSize: e, }); }; onDestinationChange = (e) => { this.onChange({ ...this.state, - destination: e.target.value + destination: e.target.value, }); }; render() { - const { - type, - source, - destination, - cinderVolumeSize, - isCinderVolume - } = this.state; + const { type, source, destination, cinderVolumeSize, isCinderVolume } = + this.state; const { name } = this.props; const selectType = (