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.

Align recovery history table width budgeting

rcourtman8b60067871f0
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 99c803405a..4f72dfd84e 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -94,6 +94,7 @@ querying, and the operator-facing storage health presentation layer.
2. Keep recovery store/runtime changes aligned with the storage and recovery frontend proofs in `registry.json`
3. Tighten guardrails when legacy storage or recovery presentation paths are removed
4. Preserve the dependency split: API payload ownership stays in `api-contracts`, settings shell ownership stays in `frontend-primitives`, and canonical resource truth stays in `unified-resources`
+5. Keep recovery history table width budgeting derived from the canonical column specs in `frontend-modern/src/utils/recoveryTablePresentation.ts`, not from raw visible-column counts, so normalized subject labels and optional column sets cannot drift the right-edge badges and controls off-screen
## Current State
@@ -121,6 +122,11 @@ protected inventory, activity, and history presentation layers. The history
surface is further split so `RecoveryHistorySection.tsx` owns the toolbar and
controller boundary, `useRecoveryHistorySectionState.ts` owns local section UI
state, and `RecoveryHistoryTable.tsx` owns the row/detail renderer.
+That history table layout now also derives its minimum width from the same
+canonical column-width spec that owns the header sizing in
+`frontend-modern/src/utils/recoveryTablePresentation.ts`, so longer governed
+subject labels do not force the trailing outcome/status columns off-screen by
+budget drift.
That same shared `internal/api/` dependency now also assumes tenant-scoped
resource handlers seed registries from canonical unified resources only:
recovery- and storage-adjacent API helpers may not fall back to raw tenant
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index 05d3de9d76..1684ef0d8f 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -28,6 +28,7 @@ import {
} from '@/utils/recoveryRecordPresentation';
import {
getRecoveryGroupNoTimestampLabel,
+ getRecoveryArtifactTableMinWidth,
STALE_ISSUE_THRESHOLD_MS,
} from '@/utils/recoveryTablePresentation';
import { getRecoveryTimelineLabelEvery } from '@/utils/recoveryTimelineChartPresentation';
@@ -321,7 +322,9 @@ const Recovery: Component = () => {
);
const tableColumnCount = createMemo(() => mobileVisibleArtifactColumns().length);
const tableMinWidth = createMemo(() =>
- isMobile() ? 'auto' : `${Math.max(980, tableColumnCount() * 140)}px`,
+ isMobile()
+ ? 'auto'
+ : getRecoveryArtifactTableMinWidth(mobileVisibleArtifactColumns().map((column) => column.id)),
);
createEffect(() => {
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index bd2a98912e..c96fd5fe91 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -188,6 +188,19 @@ describe('Recovery', () => {
}
});
+ it('keeps recovery history width aligned with canonical column specs', async () => {
+ render(() => <Recovery />);
+
+ const subject = await screen.findByText('VM 123');
+ fireEvent.click(subject);
+
+ await screen.findByText(/Showing 1 - 1 of 1 recovery points/i);
+ const tables = await screen.findAllByRole('table');
+ const historyTable = tables.find((table) => within(table).queryByText('Local'));
+ expect(historyTable).toBeDefined();
+ expect(historyTable).toHaveStyle({ 'min-width': '1046px', 'table-layout': 'fixed' });
+ });
+
it('focuses history when a rollup is clicked', async () => {
render(() => <Recovery />);
diff --git a/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts b/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts
index 8f1b4e99cd..d31835fbf9 100644
--- a/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts
@@ -3,6 +3,7 @@ import type { ProtectionRollup, RecoveryPoint } from '@/types/recovery';
import {
getRecoveryArtifactColumnHeaderClass,
getRecoveryArtifactRowClass,
+ getRecoveryArtifactTableMinWidth,
getRecoveryEventTimeTextClass,
getRecoveryGroupNoTimestampLabel,
getRecoveryHistorySearchPlaceholder,
@@ -91,6 +92,21 @@ describe('recoveryTablePresentation', () => {
expect(getRecoveryArtifactColumnHeaderClass('time')).toContain('text-right');
expect(getRecoveryArtifactColumnHeaderClass('type')).toContain('w-[72px]');
expect(getRecoveryArtifactColumnHeaderClass('subject')).toContain('w-[248px]');
+ expect(getRecoveryArtifactTableMinWidth(['time', 'subject', 'outcome'])).toBe('980px');
+ expect(
+ getRecoveryArtifactTableMinWidth([
+ 'time',
+ 'type',
+ 'subject',
+ 'source',
+ 'verified',
+ 'size',
+ 'method',
+ 'repository',
+ 'details',
+ 'outcome',
+ ]),
+ ).toBe('1174px');
expect(getRecoveryArtifactRowClass(true)).toContain('outline-blue-200/80');
expect(getRecoveryArtifactRowClass(false)).toBe('hover:bg-surface-hover');
});
diff --git a/frontend-modern/src/utils/recoveryTablePresentation.ts b/frontend-modern/src/utils/recoveryTablePresentation.ts
index 2922016495..97d6a3d3ca 100644
--- a/frontend-modern/src/utils/recoveryTablePresentation.ts
+++ b/frontend-modern/src/utils/recoveryTablePresentation.ts
@@ -22,6 +22,23 @@ export const RECOVERY_PROTECTED_SEARCH_PLACEHOLDER = 'Search protected items...'
export const RECOVERY_HISTORY_SEARCH_PLACEHOLDER = 'Search recovery history...';
export const RECOVERY_SEARCH_HISTORY_EMPTY_MESSAGE = 'Recent searches appear here.';
+const RECOVERY_ARTIFACT_COLUMN_SPECS: Record<string, { headerClass: string; minWidthPx: number }> = {
+ time: { headerClass: 'w-[76px] text-right', minWidthPx: 76 },
+ type: { headerClass: 'w-[72px] text-center', minWidthPx: 72 },
+ subject: { headerClass: 'w-[248px]', minWidthPx: 248 },
+ entityId: { headerClass: 'w-[84px]', minWidthPx: 84 },
+ cluster: { headerClass: 'w-[120px]', minWidthPx: 120 },
+ nodeAgent: { headerClass: 'w-[120px]', minWidthPx: 120 },
+ namespace: { headerClass: 'w-[120px]', minWidthPx: 120 },
+ source: { headerClass: 'w-[78px] text-center', minWidthPx: 78 },
+ verified: { headerClass: 'w-[56px] text-center', minWidthPx: 56 },
+ size: { headerClass: 'w-[92px] text-right', minWidthPx: 92 },
+ method: { headerClass: 'w-[84px] text-center', minWidthPx: 84 },
+ repository: { headerClass: 'w-[160px]', minWidthPx: 160 },
+ details: { headerClass: 'w-[220px]', minWidthPx: 220 },
+ outcome: { headerClass: 'w-[88px] text-center', minWidthPx: 88 },
+};
+
export function getRecoveryEventTimeTextClass(
timestamp: number,
nowMs: number = Date.now(),
@@ -117,38 +134,15 @@ export function getRecoverySubjectTypeLabel(point: RecoveryPoint): string {
}
export function getRecoveryArtifactColumnHeaderClass(id: string): string {
- switch (id) {
- case 'time':
- return 'w-[76px] text-right';
- case 'type':
- return 'w-[72px] text-center';
- case 'subject':
- return 'w-[248px]';
- case 'entityId':
- return 'w-[84px]';
- case 'cluster':
- return 'w-[120px]';
- case 'nodeAgent':
- return 'w-[120px]';
- case 'namespace':
- return 'w-[120px]';
- case 'source':
- return 'w-[78px] text-center';
- case 'verified':
- return 'w-[56px] text-center';
- case 'size':
- return 'w-[92px] text-right';
- case 'method':
- return 'w-[84px] text-center';
- case 'repository':
- return 'w-[160px]';
- case 'details':
- return 'w-[220px]';
- case 'outcome':
- return 'w-[88px] text-center';
- default:
- return '';
- }
+ return RECOVERY_ARTIFACT_COLUMN_SPECS[id]?.headerClass || '';
+}
+
+export function getRecoveryArtifactTableMinWidth(columnIds: readonly string[]): string {
+ const totalWidth = columnIds.reduce(
+ (sum, id) => sum + (RECOVERY_ARTIFACT_COLUMN_SPECS[id]?.minWidthPx || 140),
+ 0,
+ );
+ return `${Math.max(980, totalWidth)}px`;
}
export function getRecoveryArtifactRowClass(selected: boolean): string {