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): canonicalize activity focus labels

rcourtmand6d98426e33a
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index d0e2d4471a..ebd897eb44 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -192,6 +192,10 @@ summary helpers and platform filter renderers should use canonical `item` and
`platform` naming internally once compatibility boundaries already exist,
rather than keeping fresh `subject` or `provider` terminology alive in the
live recovery runtime path.
+The same runtime vocabulary rule applies to cross-section recovery props too.
+Live page-to-section boundaries should carry item-focused names like
+`selectedHistoryItemLabel` instead of preserving `subject` labels after the
+shared recovery presenters already expose canonical item terminology.
That same presenter boundary should also own canonical item-type derivation.
Recovery surfaces must resolve rollup and point item types through one shared
item-type helper instead of repeating `display.itemType` / `subjectType` /
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index 40235f96fb..3a2fea39b0 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -210,7 +210,7 @@ const Recovery: Component = () => {
return rollups().find((rollup) => rollup.rollupId === selected) || null;
});
- const selectedHistorySubjectLabel = createMemo(() => {
+ const selectedHistoryItemLabel = createMemo(() => {
const rollup = selectedRollup();
return rollup ? getRecoveryRollupItemLabel(rollup, resourcesById()) : null;
});
@@ -518,7 +518,7 @@ const Recovery: Component = () => {
overallRollupsSummary={overallRollupsSummary}
selectedDateKey={selectedDateKey}
selectedDateLabel={selectedDateLabel}
- selectedHistorySubjectLabel={selectedHistorySubjectLabel}
+ selectedHistoryItemLabel={selectedHistoryItemLabel}
setChartRangeDays={(range) => {
setChartRangeDays(range);
setSelectedDateKey(null);
diff --git a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
index d25e237f4e..2d3d65a48a 100644
--- a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
@@ -72,7 +72,7 @@ interface RecoveryActivitySectionProps {
overallRollupsSummary: Accessor<RecoveryRollupSummary>;
selectedDateKey: Accessor<string | null>;
selectedDateLabel: Accessor<string>;
- selectedHistorySubjectLabel: Accessor<string | null>;
+ selectedHistoryItemLabel: Accessor<string | null>;
setChartRangeDays: (value: 7 | 30 | 90 | 365) => void;
toggleSelectedDate: (key: string) => void;
timeline: Accessor<TimelineModel>;
@@ -113,11 +113,11 @@ export const RecoveryActivitySection: Component<RecoveryActivitySectionProps> =
</div>
</div>
<div class="flex flex-wrap items-center gap-2">
- <Show when={props.selectedHistorySubjectLabel()}>
+ <Show when={props.selectedHistoryItemLabel()}>
<div class="inline-flex items-center gap-2 rounded-md border border-border bg-surface-alt px-2.5 py-1.5 text-xs">
<span class="font-semibold uppercase tracking-wide text-muted">Focused Item</span>
<span class="max-w-[18rem] truncate font-medium text-base-content">
- {props.selectedHistorySubjectLabel()}
+ {props.selectedHistoryItemLabel()}
</span>
</div>
</Show>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx
index aea9d1010b..e7fd15ff46 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx
@@ -102,7 +102,7 @@ describe('Recovery layout guards', () => {
scopeFilter: () => 'all',
selectedDateKey: () => null,
selectedDateLabel: () => '',
- selectedHistorySubjectLabel: () => null,
+ selectedHistoryItemLabel: () => null,
setChartRangeDays: vi.fn(),
setClusterFilter: vi.fn(),
setCurrentPage: vi.fn(),
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index f9ccb7bcde..24a3d95536 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -410,8 +410,8 @@ describe('Recovery', () => {
it('focuses history when a rollup is clicked', async () => {
render(() => <Recovery />);
- const subject = await screen.findByText('VM 123');
- fireEvent.click(subject);
+ const item = await screen.findByText('VM 123');
+ fireEvent.click(item);
await waitFor(() => {
expect(navigateSpy).toHaveBeenCalledWith('/recovery?rollupId=res%3Avm-123', {
diff --git a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
index 16d064ec8f..4af4b8b58e 100644
--- a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
@@ -34,7 +34,7 @@ describe('RecoveryActivitySection', () => {
overallRollupsSummary={() => ({ total: 2, stale: 0, neverSucceeded: 0 })}
selectedDateKey={() => null}
selectedDateLabel={() => ''}
- selectedHistorySubjectLabel={() => null}
+ selectedHistoryItemLabel={() => null}
setChartRangeDays={() => undefined}
timeline={timeline}
toggleSelectedDate={() => undefined}
diff --git a/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts b/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts
index b4ef745e04..fd4c03b078 100644
--- a/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts
@@ -1,5 +1,7 @@
import { describe, expect, it } from 'vitest';
+import recoveryActivitySectionSource from '@/components/Recovery/RecoveryActivitySection.tsx?raw';
+import recoveryPageSource from '@/components/Recovery/Recovery.tsx?raw';
import recoverySummaryPresentationSource from '@/utils/recoverySummaryPresentation.ts?raw';
import recoveryHistorySectionSource from '@/components/Recovery/RecoveryHistorySection.tsx?raw';
import recoveryProtectedInventorySectionSource from '@/components/Recovery/RecoveryProtectedInventorySection.tsx?raw';
@@ -20,4 +22,13 @@ describe('recovery canonical vocabulary', () => {
expect(recoveryProtectedInventorySectionSource).not.toContain('{(provider) => (');
expect(recoveryHistorySectionSource).not.toContain('{(provider) => (');
});
+
+ it('keeps recovery activity focus labels item-first', () => {
+ expect(recoveryPageSource).toContain('const selectedHistoryItemLabel = createMemo(() => {');
+ expect(recoveryPageSource).not.toContain('const selectedHistorySubjectLabel = createMemo(() => {');
+ expect(recoveryActivitySectionSource).toContain('selectedHistoryItemLabel: Accessor<string | null>;');
+ expect(recoveryActivitySectionSource).not.toContain(
+ 'selectedHistorySubjectLabel: Accessor<string | null>;',
+ );
+ });
});