Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

refactor(recovery): restore canonical item type badges

rcourtmanbd0fc0a5e64c
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index eda978cc3f..d5956a9ef3 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -759,10 +759,11 @@ dedicated column. When `Item Type` and `Platform` columns are visible, the
primary item cell should not restate those same badges on desktop; duplicate
context belongs only as a small-screen fallback when those columns collapse.
That same scan rule applies to the supporting columns themselves. Recovery
-tables should keep one dominant identity cue and one canonical platform cue,
-while `Item Type`, `Method`, and similar supporting fields stay on restrained
-metadata text instead of turning every adjacent column into another colored
-badge.
+tables should keep one dominant identity cue and one canonical platform cue.
+`Item Type` should use the same shared workload/resource badge treatment that
+other Pulse tables use for `VM` and `Container`, while `Method` and similar
+supporting fields stay on restrained metadata text instead of turning every
+adjacent column into another colored badge.
That same item-identity contract also applies to synthetic Proxmox task
recovery points. When the persisted subject label is just a raw
`pve-task:*`/`UPID:*` identifier or `vmid=0`, the canonical recovery index
diff --git a/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx b/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx
index 4bdea9a746..533b5619b4 100644
--- a/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryHistoryTable.tsx
@@ -33,13 +33,16 @@ import {
normalizeRecoveryModeQueryValue,
} from '@/utils/recoveryRecordPresentation';
import { getRecoveryPointPlatform } from '@/utils/recoveryPlatformModel';
+import {
+ getRecoveryItemTypePresentation,
+ getRecoveryPointItemTypeKey,
+} from '@/utils/recoveryItemTypePresentation';
import {
getRecoveryArtifactColumnHeaderClass,
getRecoveryArtifactMetadataTextClass,
getRecoveryArtifactOutcomeTextClass,
getRecoveryArtifactRowClass,
getRecoveryEventTimeTextClass,
- getRecoveryPointItemTypeLabel,
RECOVERY_GROUP_HEADER_ROW_CLASS,
RECOVERY_GROUP_HEADER_TEXT_CLASS,
} from '@/utils/recoveryTablePresentation';
@@ -166,7 +169,8 @@ export const RecoveryHistoryTable: Component<RecoveryHistoryTableProps> = (props
point.completedAt && Number.isFinite(tsMs)
? formatRecoveryTimeOnly(tsMs)
: '—';
- const itemType = getRecoveryPointItemTypeLabel(point);
+ const itemTypePresentation =
+ getRecoveryItemTypePresentation(getRecoveryPointItemTypeKey(point));
const platform = normalizeSourcePlatformQueryValue(getRecoveryPointPlatform(point));
const mode =
normalizeRecoveryModeQueryValue(String(point.mode || '').toLowerCase()) ||
@@ -223,9 +227,12 @@ export const RecoveryHistoryTable: Component<RecoveryHistoryTableProps> = (props
case 'type':
return (
<TableCell class="whitespace-nowrap px-3 py-1 text-center">
- <Show when={itemType} fallback={<span class="text-muted">—</span>}>
- <span class={getRecoveryArtifactMetadataTextClass()}>
- {itemType}
+ <Show
+ when={itemTypePresentation}
+ fallback={<span class="text-muted">—</span>}
+ >
+ <span class={itemTypePresentation?.badgeClasses}>
+ {itemTypePresentation?.label}
</span>
</Show>
</TableCell>
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index c579f3b9d4..2528826829 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -471,7 +471,7 @@ export const RecoveryProtectedInventorySection: Component<
</div>
<div class="flex flex-wrap items-center gap-1.5 text-[10px] md:hidden">
<Show when={itemTypePresentation?.label}>
- <span class={getRecoveryArtifactMetadataTextClass('muted')}>
+ <span class={itemTypePresentation?.badgeClasses}>
{itemTypePresentation?.label}
</span>
</Show>
@@ -496,7 +496,7 @@ export const RecoveryProtectedInventorySection: Component<
when={itemTypePresentation}
fallback={<span class="text-muted">—</span>}
>
- <span class={getRecoveryArtifactMetadataTextClass()}>
+ <span class={itemTypePresentation?.badgeClasses}>
{itemTypePresentation?.label}
</span>
</Show>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 4e2d5fa9e4..4743b2d02e 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -268,7 +268,8 @@ describe('Recovery', () => {
expect(within(vmRow!).getByText('VMID 123').parentElement?.className).toContain(
'items-baseline',
);
- expect(within(vmRow!).getAllByText('VM')[0].className).not.toContain('bg-');
+ expect(within(vmRow!).getAllByText('VM')[0].className).toContain('bg-');
+ expect(within(vmRow!).getAllByText('VM')[0].className).toContain('rounded');
expect(within(vmRow!).getByText('Success').className).not.toContain('rounded');
expect(screen.queryByText('Backups By Date')).not.toBeInTheDocument();
expect(screen.queryByText('Recovery Activity')).not.toBeInTheDocument();
@@ -348,7 +349,8 @@ describe('Recovery', () => {
expect(within(historyRow!).getByText('VMID 123').parentElement?.className).toContain(
'items-baseline',
);
- expect(within(historyRow!).getByText('VM').className).not.toContain('bg-');
+ expect(within(historyRow!).getByText('VM').className).toContain('bg-');
+ expect(within(historyRow!).getByText('VM').className).toContain('rounded');
expect(within(historyRow!).getByText('Local Copy').className).not.toContain('rounded');
expect(within(historyRow!).getByText('Success').className).not.toContain('rounded');
expect(activityHeading).toBeInTheDocument();