Extract variables to utils/unit

Signed-off-by: Andy Lee <andy.lee@suse.com>
(cherry picked from commit 8db4de1c4a)
This commit is contained in:
Andy Lee
2025-03-04 02:47:42 +00:00
committed by Mergify
parent a8f8f0d288
commit f02074a25e
18 changed files with 57 additions and 34 deletions
@@ -11,6 +11,7 @@ import { _CREATE } from '@shell/config/query-params';
import { HCI as HCI_ANNOTATIONS } from '@pkg/harvester/config/labels-annotations';
import { HCI } from '../../../../types';
import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map';
import { GIBIBYTE } from '../../../../utils/unit';
export default {
name: 'HarvesterEditExisting',
@@ -59,6 +60,7 @@ export default {
}
return {
GIBIBYTE,
VOLUME_TYPE,
InterfaceOption,
loading: false,
@@ -254,7 +256,7 @@ export default {
:label="t('harvester.fields.size')"
:mode="mode"
:disabled="true"
suffix="Gi"
:suffix="GIBIBYTE"
@update:value="update"
/>
</InputOrDisplay>
@@ -12,6 +12,7 @@ import { VOLUME_TYPE, InterfaceOption } from '../../../../config/harvester-map';
import { _VIEW } from '@shell/config/query-params';
import LabelValue from '@shell/components/LabelValue';
import { ucFirst } from '@shell/utils/string';
import { GIBIBYTE } from '../../../../utils/unit';
export default {
name: 'HarvesterEditVMImage',
@@ -67,6 +68,7 @@ export default {
data() {
return {
GIBIBYTE,
VOLUME_TYPE,
InterfaceOption,
loading: false,
@@ -187,7 +189,7 @@ export default {
minExponent: 3,
});
this.value.size = `${ formatSize }Gi`;
this.value.size = `${ formatSize }${ GIBIBYTE }`;
}
},
deep: true,
@@ -229,7 +231,7 @@ export default {
if (!isIsoImage) {
imageSizeGiB = Math.max(imageSizeGiB, 10);
}
this.value['size'] = `${ imageSizeGiB }Gi`;
this.value['size'] = `${ imageSizeGiB }${ GIBIBYTE }`;
}
this.update();
@@ -336,7 +338,7 @@ export default {
:mode="mode"
:required="validateRequired"
:disable="isLonghornV2"
suffix="Gi"
:suffix="GIBIBYTE"
@update:value="update"
/>
</InputOrDisplay>
@@ -12,6 +12,7 @@ import LabelValue from '@shell/components/LabelValue';
import { ucFirst } from '@shell/utils/string';
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: 'HarvesterEditVolume',
@@ -58,6 +59,7 @@ export default {
data() {
return {
GIBIBYTE,
VOLUME_TYPE,
InterfaceOption,
loading: false,
@@ -140,7 +142,7 @@ export default {
minExponent: 3,
});
this.value.size = `${ formatSize }Gi`;
this.value.size = `${ formatSize }${ GIBIBYTE }`;
}
},
deep: true,
@@ -258,7 +260,7 @@ export default {
:required="validateRequired"
:label="t('harvester.fields.size')"
:disabled="isLonghornV2"
suffix="Gi"
:suffix="GIBIBYTE"
@update:value="update"
/>
</InputOrDisplay>