diff --git a/pkg/harvester/config/harvester.js b/pkg/harvester/config/harvester.js index 3d54eb0c1e8..4cb4ecee538 100644 --- a/pkg/harvester/config/harvester.js +++ b/pkg/harvester/config/harvester.js @@ -28,6 +28,7 @@ import { import { IMAGE_DOWNLOAD_SIZE, + IMAGE_VIRTUAL_SIZE, FINGERPRINT, IMAGE_PROGRESS, SNAPSHOT_TARGET_VOLUME, @@ -220,6 +221,7 @@ export function init($plugin, store) { NAMESPACE_COL, IMAGE_PROGRESS, IMAGE_DOWNLOAD_SIZE, + IMAGE_VIRTUAL_SIZE, AGE ]); virtualType({ diff --git a/pkg/harvester/config/table-headers.js b/pkg/harvester/config/table-headers.js index ecd7afa808c..fa0c42bfcb4 100644 --- a/pkg/harvester/config/table-headers.js +++ b/pkg/harvester/config/table-headers.js @@ -11,6 +11,14 @@ export const IMAGE_DOWNLOAD_SIZE = { width: 120 }; +export const IMAGE_VIRTUAL_SIZE = { + name: 'virtualSize', + labelKey: 'harvester.tableHeaders.virtualSize', + value: 'virtualSize', + sort: 'status.virtualSize', + width: 120 +}; + export const IMAGE_PROGRESS = { name: 'Uploaded', labelKey: 'tableHeaders.progress', diff --git a/pkg/harvester/detail/harvesterhci.io.virtualmachineimage/index.vue b/pkg/harvester/detail/harvesterhci.io.virtualmachineimage/index.vue index fcb523d3a15..98677d4e27c 100644 --- a/pkg/harvester/detail/harvesterhci.io.virtualmachineimage/index.vue +++ b/pkg/harvester/detail/harvesterhci.io.virtualmachineimage/index.vue @@ -35,6 +35,10 @@ export default { return this.value?.downSize; }, + virtualSize() { + return this.value?.virtualSize; + }, + url() { return this.value?.spec?.url || '-'; }, @@ -100,6 +104,12 @@ export default { +
+
+ +
+
+
diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index 5bc93214246..55169d1233d 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -159,6 +159,7 @@ harvester: forceStop: Force Stop tableHeaders: size: Size + virtualSize: Virtual Size progress: Progress message: Message phase: Phase @@ -698,6 +699,7 @@ harvester: basics: Basics url: URL size: Size + virtualSize: Virtual Size urlTip: 'supports the raw and qcow2 image formats which are supported by qemu. Bootable ISO images can also be used and are treated like raw images.' fileName: File Name uploadFile: Upload File diff --git a/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js b/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js index 47d9cb2e6d5..5480a74c675 100644 --- a/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js +++ b/pkg/harvester/models/harvesterhci.io.virtualmachineimage.js @@ -168,6 +168,21 @@ export default class HciVmImage extends HarvesterResource { }); } + get virtualSize() { + const virtualSize = this.status?.virtualSize; + + if (!virtualSize) { + return '-'; + } + + return formatSi(virtualSize, { + increment: 1024, + maxPrecision: 2, + suffix: 'B', + firstSuffix: 'B', + }); + } + getStatusConditionOfType(type, defaultValue = []) { const conditions = Array.isArray(get(this, 'status.conditions')) ? this.status.conditions : defaultValue;