diff --git a/pkg/harvester/config/harvester-map.js b/pkg/harvester/config/harvester-map.js index 796ad222..75f2b5ad 100644 --- a/pkg/harvester/config/harvester-map.js +++ b/pkg/harvester/config/harvester-map.js @@ -1,3 +1,4 @@ +// TODO: delete this not used variable export const MemoryUnit = [{ label: 'Mi', value: 'Mi' diff --git a/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue b/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue index 385f3504..8ff3d5b5 100644 --- a/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue +++ b/pkg/harvester/detail/harvesterhci.io.host/HarvesterHostBasic.vue @@ -4,6 +4,7 @@ import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units'; import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations'; import { LONGHORN, METRIC } from '@shell/config/types'; import { Banner } from '@components/Banner'; +import { UNIT_SUFFIX } from '../../utils/unit'; import HarvesterCPUUsed from '../../formatters/HarvesterCPUUsed'; import HarvesterMemoryUsed from '../../formatters/HarvesterMemoryUsed'; import HarvesterStorageUsed from '../../formatters/HarvesterStorageUsed'; @@ -121,7 +122,7 @@ export default { memoryUnits() { const exponent = exponentNeeded(this.memoryTotal, 1024); - return `${ UNITS[exponent] }iB`; + return `${ UNITS[exponent] }${ UNIT_SUFFIX }`; }, nodeType() { diff --git a/pkg/harvester/detail/harvesterhci.io.host/index.vue b/pkg/harvester/detail/harvesterhci.io.host/index.vue index bf51a2f0..a2734e15 100644 --- a/pkg/harvester/detail/harvesterhci.io.host/index.vue +++ b/pkg/harvester/detail/harvesterhci.io.host/index.vue @@ -9,7 +9,7 @@ import ArrayListGrouped from '@shell/components/form/ArrayListGrouped'; import Loading from '@shell/components/Loading.vue'; import SortableTable from '@shell/components/SortableTable'; import Banner from '@components/Banner/Banner.vue'; - +import { UNIT_SUFFIX } from '../../utils/unit'; import metricPoller from '@shell/mixins/metric-poller'; import { METRIC, NODE, LONGHORN, POD, EVENT @@ -178,7 +178,7 @@ export default { minExponent: 3, maxExponent: 3, maxPrecision: 2, - suffix: 'iB', + suffix: UNIT_SUFFIX, }; const longhornDisks = Object.keys(diskStatus).map((key) => { diff --git a/pkg/harvester/dialog/HarvesterQuotaDialog.vue b/pkg/harvester/dialog/HarvesterQuotaDialog.vue index a3851ad9..3129951b 100644 --- a/pkg/harvester/dialog/HarvesterQuotaDialog.vue +++ b/pkg/harvester/dialog/HarvesterQuotaDialog.vue @@ -5,6 +5,7 @@ import { Banner } from '@components/Banner'; import AsyncButton from '@shell/components/AsyncButton'; import UnitInput from '@shell/components/form/UnitInput'; import { exceptionToErrorsArray } from '@shell/utils/error'; +import { GIBIBYTE } from '../utils/unit'; export default { name: 'HarvesterVMQuotaDialog', @@ -29,6 +30,7 @@ export default { data() { return { + GIBIBYTE, totalSnapshotSize: '', errors: [] }; @@ -44,7 +46,6 @@ export default { }, methods: { - close() { this.totalSnapshotSize = ''; this.$emit('close'); @@ -92,7 +93,7 @@ export default { :input-exponent="3" :increment="1024" :output-modifier="true" - suffix="GiB" + :suffix="GIBIBYTE" class="mb-20" /> diff --git a/pkg/harvester/edit/harvesterhci.io.host/index.vue b/pkg/harvester/edit/harvesterhci.io.host/index.vue index 4cd03be5..6f65c402 100644 --- a/pkg/harvester/edit/harvesterhci.io.host/index.vue +++ b/pkg/harvester/edit/harvesterhci.io.host/index.vue @@ -20,7 +20,7 @@ import Loading from '@shell/components/Loading.vue'; import MessageLink from '@shell/components/MessageLink'; import { ADD_ONS } from '@pkg/harvester/config/harvester-map'; import { PRODUCT_NAME as HARVESTER_PRODUCT } from '@pkg/harvester/config/harvester'; - +import { UNIT_SUFFIX } from '../../utils/unit'; import { _EDIT } from '@shell/config/query-params'; import { sortBy } from '@shell/utils/sort'; import { Banner } from '@components/Banner'; @@ -185,7 +185,7 @@ export default { minExponent: 3, maxExponent: 3, maxPrecision: 2, - suffix: 'iB', + suffix: UNIT_SUFFIX, }; const longhornDisks = Object.keys(diskStatus).map((key) => { @@ -457,7 +457,7 @@ export default { const devPath = d.spec?.devPath; const deviceType = d.status?.deviceStatus?.details?.deviceType; const sizeBytes = d.status?.deviceStatus?.capacity?.sizeBytes; - const size = formatSi(sizeBytes, { increment: 1024 }); + const size = formatSi(sizeBytes, { increment: 1024, suffix: UNIT_SUFFIX }); const parentDevice = d.status?.deviceStatus?.parentDevice; const isChildAdded = this.newDisks.find((newDisk) => newDisk.blockDevice?.status?.deviceStatus?.parentDevice === devPath); const name = d.displayName; diff --git a/pkg/harvester/edit/harvesterhci.io.volume.vue b/pkg/harvester/edit/harvesterhci.io.volume.vue index d5072d32..f9e36d84 100644 --- a/pkg/harvester/edit/harvesterhci.io.volume.vue +++ b/pkg/harvester/edit/harvesterhci.io.volume.vue @@ -21,6 +21,7 @@ import { InterfaceOption, VOLUME_DATA_SOURCE_KIND } from '../config/harvester-ma import { HCI, VOLUME_SNAPSHOT } from '../types'; import { LVM_DRIVER } from '../models/harvester/storage.k8s.io.storageclass'; import { DATA_ENGINE_V2 } from '../models/harvester/persistentvolumeclaim'; +import { GIBIBYTE } from '../utils/unit'; export default { name: 'HarvesterVolume', @@ -86,6 +87,7 @@ export default { imageId, snapshots: [], images: [], + GIBIBYTE }; }, @@ -288,7 +290,7 @@ export default { const imageSize = Math.max(imageResource?.status?.size, imageResource?.status?.virtualSize); if (imageSize) { - this.storage = `${ Math.ceil(imageSize / 1024 / 1024 / 1024) }Gi`; + this.storage = `${ Math.ceil(imageSize / 1024 / 1024 / 1024) }${ GIBIBYTE }`; } } this.update(); @@ -377,6 +379,7 @@ export default { :disabled="value?.isLonghornV2 && isEdit" required class="mb-20" + :suffix="GIBIBYTE" @update:value="update" /> diff --git a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCpuMemory.vue b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCpuMemory.vue index d91bdcb0..b71333aa 100644 --- a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCpuMemory.vue +++ b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineCpuMemory.vue @@ -1,6 +1,7 @@