Extract variables to utils/unit

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee
2025-03-03 16:57:25 +08:00
parent 8f76d5ad30
commit 8db4de1c4a
18 changed files with 57 additions and 34 deletions
@@ -12,6 +12,7 @@ import { HCI } from '../types';
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../config/harvester';
import HarvesterResource from './harvester';
import { CSI_SECRETS } from '@pkg/harvester/config/harvester-map';
import { UNIT_SUFFIX } from '../utils/unit';
const {
CSI_PROVISIONER_SECRET_NAME,
@@ -243,8 +244,8 @@ export default class HciVmImage extends HarvesterResource {
return formatSi(size, {
increment: 1024,
maxPrecision: 2,
suffix: 'i',
firstSuffix: 'i',
suffix: UNIT_SUFFIX,
firstSuffix: UNIT_SUFFIX,
});
}
@@ -258,8 +259,8 @@ export default class HciVmImage extends HarvesterResource {
return formatSi(virtualSize, {
increment: 1024,
maxPrecision: 2,
suffix: 'i',
firstSuffix: 'i',
suffix: UNIT_SUFFIX,
firstSuffix: UNIT_SUFFIX,
});
}