From a180372564a2a30fb3a9dbf01236b5730881d6be Mon Sep 17 00:00:00 2001 From: Marcelo Fukumoto Date: Thu, 28 May 2026 23:19:25 +0200 Subject: [PATCH] feat(forklift): small fixes after Copilot Signed-off-by: Marcelo Fukumoto --- .../vm-migration/ConfigureMappingsStep.vue | 6 +++--- .../components/vm-migration/MappingColumn.vue | 2 +- .../components/vm-migration/ReviewMigrationStep.vue | 10 +++++----- .../components/vm-migration/SelectVmsStep.vue | 12 ++++++------ pkg/harvester/l10n/en-us.yaml | 9 +++++++++ 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/pkg/harvester/components/vm-migration/ConfigureMappingsStep.vue b/pkg/harvester/components/vm-migration/ConfigureMappingsStep.vue index fe310d5e..55353a38 100644 --- a/pkg/harvester/components/vm-migration/ConfigureMappingsStep.vue +++ b/pkg/harvester/components/vm-migration/ConfigureMappingsStep.vue @@ -260,9 +260,9 @@ const formatStorageDetail = (entry) => { const gb = entry.capacity / (1024 * 1024 * 1024); if (gb >= 1024) { - parts.push(`${ (gb / 1024).toFixed(1) } TB`); + parts.push(t('harvester.addons.vmMigration.generic.memoryTb', { value: (gb / 1024).toFixed(1) })); } else { - parts.push(`${ Math.round(gb) } GB`); + parts.push(t('harvester.addons.vmMigration.generic.memoryGb', { value: Math.round(gb) })); } } @@ -532,7 +532,7 @@ init(); :clearable="useAllProviderData" > diff --git a/pkg/harvester/components/vm-migration/MappingColumn.vue b/pkg/harvester/components/vm-migration/MappingColumn.vue index 926d705e..3933e434 100644 --- a/pkg/harvester/components/vm-migration/MappingColumn.vue +++ b/pkg/harvester/components/vm-migration/MappingColumn.vue @@ -93,7 +93,7 @@ const selectOptions = computed(() => {
- Used by: {{ entry.usedBy.join(', ') }} + {{ t('harvester.addons.vmMigration.generic.usedBy') }} {{ entry.usedBy.join(', ') }}
diff --git a/pkg/harvester/components/vm-migration/ReviewMigrationStep.vue b/pkg/harvester/components/vm-migration/ReviewMigrationStep.vue index 92a9c229..ea49e798 100644 --- a/pkg/harvester/components/vm-migration/ReviewMigrationStep.vue +++ b/pkg/harvester/components/vm-migration/ReviewMigrationStep.vue @@ -66,7 +66,7 @@ const vmCards = computed(() => { return vms.value.map((vm) => { const cpus = vm.cpuCount || vm.numCPU || 0; const memMB = vm.memoryMB || vm.memory || 0; - const memGB = memMB ? `${ Math.round(memMB / 1024) } GB` : '-'; + const memGB = memMB ? t('harvester.addons.vmMigration.generic.memoryGb', { value: Math.round(memMB / 1024) }) : '-'; let totalDiskBytes = 0; @@ -74,7 +74,7 @@ const vmCards = computed(() => { totalDiskBytes = vm.disks.reduce((sum, d) => sum + (d.capacity || 0), 0); } - const diskDisplay = totalDiskBytes ? `${ Math.round(totalDiskBytes / (1024 * 1024 * 1024)) } GB` : '-'; + const diskDisplay = totalDiskBytes ? t('harvester.addons.vmMigration.generic.memoryGb', { value: Math.round(totalDiskBytes / (1024 * 1024 * 1024)) }) : '-'; const os = vm.guestName || vm.guestOS || vm.os || '-'; const vmNetworkMappings = networkMappings.value.filter((m) => m.usedBy && m.usedBy.includes(vm.name || vm.id)); @@ -301,11 +301,11 @@ defineExpose({ startMigration: startMigrationAction });
{{ t('harvester.addons.vmMigration.reviewMigration.memory') }} - {{ totalMemoryGB }} GB + {{ t('harvester.addons.vmMigration.generic.memoryGb', { value: totalMemoryGB }) }}
{{ t('harvester.addons.vmMigration.reviewMigration.storage') }} - {{ totalStorageGB }} GB + {{ t('harvester.addons.vmMigration.generic.memoryGb', { value: totalStorageGB }) }}
@@ -344,7 +344,7 @@ defineExpose({ startMigration: startMigrationAction }); class="icon icon-disk" aria-hidden="true" /> - {{ vm.cpus }} vCPU • {{ vm.memGB }} • {{ vm.diskDisplay }} + {{ t('harvester.addons.vmMigration.generic.vCpu', { count: vm.cpus }) }} • {{ vm.memGB }} • {{ vm.diskDisplay }}
{ const minutes = totalMinutes % 60; if (hours > 0 && minutes > 0) { - return `${ hours } ${ hours === 1 ? 'hour' : 'hours' } and ${ minutes } ${ minutes === 1 ? 'minute' : 'minutes' }`; + return t('harvester.addons.vmMigration.generic.elapsed.hoursAndMinutes', { hours, minutes }); } if (hours > 0) { - return `${ hours } ${ hours === 1 ? 'hour' : 'hours' }`; + return t('harvester.addons.vmMigration.generic.elapsed.hours', { hours }); } - return `${ Math.max(1, minutes) } ${ minutes <= 1 ? 'minute' : 'minutes' }`; + return t('harvester.addons.vmMigration.generic.elapsed.minutes', { minutes: Math.max(1, minutes) }); }; const lastSyncedTime = computed(() => { @@ -158,7 +158,7 @@ const buildTableRows = () => { return discoveredVMs.value.map((vm) => { const cpus = vm.cpuCount || vm.numCPU || '-'; const memMB = vm.memoryMB || vm.memory || 0; - const memGB = memMB ? `${ Math.round(memMB / 1024) } GB` : '-'; + const memGB = memMB ? t('harvester.addons.vmMigration.generic.memoryGb', { value: Math.round(memMB / 1024) }) : '-'; let totalDiskBytes = 0; @@ -166,7 +166,7 @@ const buildTableRows = () => { totalDiskBytes = vm.disks.reduce((sum, d) => sum + (d.capacity || 0), 0); } - const diskDisplay = totalDiskBytes ? `${ Math.round(totalDiskBytes / (1024 * 1024 * 1024)) } GB` : '-'; + const diskDisplay = totalDiskBytes ? t('harvester.addons.vmMigration.generic.memoryGb', { value: Math.round(totalDiskBytes / (1024 * 1024 * 1024)) }) : '-'; const rawPowerState = vm.powerState || vm.status?.phase || '-'; const powerState = rawPowerState.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, (c) => c.toUpperCase()); @@ -206,7 +206,7 @@ const buildTableRows = () => { vmName: vm.name || vm.metadata?.name || '-', vmId: vm.id || vm.vmId || vm.metadata?.name || '-', os: vm.guestName || vm.guestOS || vm.os || '-', - resourcesDisplay: `${ cpus } vCPU`, + resourcesDisplay: t('harvester.addons.vmMigration.generic.vCpu', { count: cpus }), resourcesSub: `${ memGB } • ${ diskDisplay }`, powerState, powerStateClass: powerState.toLowerCase().includes('on') || powerState.toLowerCase().includes('running') ? 'power-on' : 'power-off', diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index 5aad1626..3d4bd165 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -1817,6 +1817,15 @@ harvester: unknown: Unknown identifier: Identifier podNetwork: Pod Network + usedBy: "Used by:" + vlan: "VLAN {id}" + vCpu: "{count} vCPU" + memoryGb: "{value} GB" + memoryTb: "{value} TB" + elapsed: + hoursAndMinutes: "{hours} {hours, plural, one {hour} other {hours}} and {minutes} {minutes, plural, one {minute} other {minutes}}" + hours: "{hours} {hours, plural, one {hour} other {hours}}" + minutes: "{minutes} {minutes, plural, one {minute} other {minutes}}" errors: failedLoadVms: Failed to load virtual machines failedRefreshVms: Failed to refresh virtual machines