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): align internal vocabulary

rcourtmand2d766a8bbaa
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index cbb3bd1243..d0e2d4471a 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -187,6 +187,11 @@ That same runtime-helper contract should prefer `item` terminology in shared
recovery presenters too. Helper exports that resolve labels or item-type badges
should expose canonical item-facing names, while any retained `subject` aliases
remain compatibility wrappers instead of the primary runtime boundary.
+The same rule applies inside recovery-owned helpers and selectors. Shared
+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.
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/RecoveryHistorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
index 06c537a358..ca4a127df3 100644
--- a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
@@ -382,9 +382,9 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
selectClass="min-w-[10rem] max-w-[14rem]"
>
<For each={props.platformOptions()}>
- {(provider) => (
- <option value={provider}>
- {provider === 'all' ? 'All Platforms' : getSourcePlatformLabel(provider)}
+ {(platform) => (
+ <option value={platform}>
+ {platform === 'all' ? 'All Platforms' : getSourcePlatformLabel(platform)}
</option>
)}
</For>
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index 9380ada6ed..2d91933103 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -246,9 +246,9 @@ export const RecoveryProtectedInventorySection: Component<
selectClass="min-w-[10rem] max-w-[14rem]"
>
<For each={props.platformOptions()}>
- {(provider) => (
- <option value={provider}>
- {provider === 'all' ? 'All Platforms' : getSourcePlatformLabel(provider)}
+ {(platform) => (
+ <option value={platform}>
+ {platform === 'all' ? 'All Platforms' : getSourcePlatformLabel(platform)}
</option>
)}
</For>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 0f38c4d064..f9ccb7bcde 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -504,6 +504,17 @@ describe('Recovery', () => {
});
});
+ it('keeps recovery filter surfaces on canonical platform vocabulary', async () => {
+ render(() => <Recovery />);
+
+ expect(await screen.findByLabelText('Platform')).toBeInTheDocument();
+ expect(screen.queryByText('All Providers')).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole('tab', { name: /Recovery events/i }));
+ expect(await screen.findByLabelText('History platform')).toBeInTheDocument();
+ expect(screen.queryByText('All Providers')).not.toBeInTheDocument();
+ });
+
it('filters recovery transport by canonical item type', async () => {
render(() => <Recovery />);
diff --git a/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts b/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts
new file mode 100644
index 0000000000..b4ef745e04
--- /dev/null
+++ b/frontend-modern/src/utils/__tests__/recoveryCanonicalVocabulary.test.ts
@@ -0,0 +1,23 @@
+import { describe, expect, it } from 'vitest';
+
+import recoverySummaryPresentationSource from '@/utils/recoverySummaryPresentation.ts?raw';
+import recoveryHistorySectionSource from '@/components/Recovery/RecoveryHistorySection.tsx?raw';
+import recoveryProtectedInventorySectionSource from '@/components/Recovery/RecoveryProtectedInventorySection.tsx?raw';
+
+describe('recovery canonical vocabulary', () => {
+ it('keeps shared recovery summary helpers item-first', () => {
+ expect(recoverySummaryPresentationSource).toContain(
+ 'const getRecoverySummaryItemTypePresentation = (',
+ );
+ expect(recoverySummaryPresentationSource).not.toContain(
+ 'const getRecoverySummarySubjectTypePresentation = (',
+ );
+ });
+
+ it('keeps recovery platform filter iterators platform-first', () => {
+ expect(recoveryProtectedInventorySectionSource).toContain('{(platform) => (');
+ expect(recoveryHistorySectionSource).toContain('{(platform) => (');
+ expect(recoveryProtectedInventorySectionSource).not.toContain('{(provider) => (');
+ expect(recoveryHistorySectionSource).not.toContain('{(provider) => (');
+ });
+});
diff --git a/frontend-modern/src/utils/recoverySummaryPresentation.ts b/frontend-modern/src/utils/recoverySummaryPresentation.ts
index 2c9fd4f628..c41978495f 100644
--- a/frontend-modern/src/utils/recoverySummaryPresentation.ts
+++ b/frontend-modern/src/utils/recoverySummaryPresentation.ts
@@ -177,7 +177,7 @@ const formatShortDate = (value: string): string => {
return date.toLocaleDateString([], { month: 'short', day: 'numeric' });
};
-const getRecoverySummarySubjectTypePresentation = (
+const getRecoverySummaryItemTypePresentation = (
value: string | null | undefined,
): { key: string; label: string; toneClass: string } | null => {
const presentation = getRecoveryItemTypePresentation(value);
@@ -432,7 +432,7 @@ export function buildRecoveryItemCoverage(
for (const rollup of rollups) {
const presentation =
- getRecoverySummarySubjectTypePresentation(getRecoveryRollupItemTypeKey(rollup)) || {
+ getRecoverySummaryItemTypePresentation(getRecoveryRollupItemTypeKey(rollup)) || {
key: 'unknown',
label: 'Unknown',
toneClass: 'bg-surface-alt text-base-content',