diff --git a/frontend-modern/browser-verification/839bb77464d7d781.json b/frontend-modern/browser-verification/839bb77464d7d781.json new file mode 100644 index 0000000000..e1c3c397a3 --- /dev/null +++ b/frontend-modern/browser-verification/839bb77464d7d781.json @@ -0,0 +1,39 @@ +{ + "version": 1, + "base_sha": "899fd2f1fffdcdfebd095d756f0a0a35157e1b1e", + "verified_at": "2026-12-02T16:17:10Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx" + ], + "content_sha256": { + "frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx": "4cc78f60157710b8ee53d0e4f7f3534da3898cfe3f872c670130758dbd0afee9" + }, + "routes": [ + "/truenas/protection" + ], + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light" + }, + { + "width": 390, + "height": 900, + "theme": "dark" + } + ], + "states": [ + "Paired All view with stale TrueNAS system (nas-east: tank/archive Failed, tank/media Running, tank/billing Stale data) and current system (nas-west: vault/docs Healthy) showing updated two-sentence stale-readings banner", + "Paired Healthy/OK filter narrowing to current-only vault/docs hides stale banner", + "Paired Stale filter showing stale nas-east events keeps stale banner visible", + "Paired live WebSocket recovery when nas-east returns online clears stale banner and Stale filter chip", + "Paired all-current control view with zero stale systems renders no banner" + ], + "interactions": [ + "Clicked Healthy, Stale, and All filters on desktop light (1440x900); opened Filters disclosure and clicked OK, Stale, and All on phone dark (390x900); pushed live WebSocket recovery; verified 0 console/page/HTTP errors and 0px horizontal overflow", + "All 20 paired before (5a8b55bc23) / after (4cc78f6015) PNGs visually inspected natively with read_file" + ], + "browser": "Playwright / Chromium via pulse-worker-browser" +} diff --git a/frontend-modern/browser-verification/aa085cb277cce7bc.json b/frontend-modern/browser-verification/aa085cb277cce7bc.json new file mode 100644 index 0000000000..af8c85cc2a --- /dev/null +++ b/frontend-modern/browser-verification/aa085cb277cce7bc.json @@ -0,0 +1,39 @@ +{ + "version": 1, + "base_sha": "efbfd69780b17dc682c229aa5f6e7c5c2bfdc86b", + "verified_at": "2026-12-02T13:07:12Z", + "result": "passed", + "changed_paths": [ + "frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx" + ], + "content_sha256": { + "frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx": "6fd3c77482a4a2b10ae92f42669ca77bdbe14e29fbd8857e8d24f9fc27986104" + }, + "routes": [ + "/truenas/protection" + ], + "viewports": [ + { + "width": 1440, + "height": 900, + "theme": "light" + }, + { + "width": 390, + "height": 900, + "theme": "dark" + } + ], + "states": [ + "Paired All view with stale TrueNAS system (nas-east: tank/archive Failed, tank/billing Healthy->Stale data, tank/media Running) and current system (nas-west: vault/docs Healthy)", + "Paired Healthy filter narrowing to current-only vault/docs hides stale banner", + "Paired Stale filter showing stale nas-east events keeps stale banner visible", + "Paired live recovery when nas-east returns online clears stale banner and Stale filter chip", + "Paired all-current control view with zero stale systems renders no banner" + ], + "interactions": [ + "Clicked Healthy, Stale, and All filters on desktop light (1440x900); opened Filters disclosure and clicked OK/Healthy, Stale, and All on phone dark (390x900); triggered live system recovery; verified 0 console/page/request errors and 0px horizontal overflow", + "All 20 paired before/after PNGs visually inspected natively with read_file" + ], + "browser": "Playwright / Chromium via pulse-worker-browser" +} diff --git a/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx b/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx index e933b4f511..e515c42acc 100644 --- a/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx +++ b/frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx @@ -383,6 +383,9 @@ export const TrueNASProtectionTable: Component<{ getTrueNASProtectionSortValue(point, key, staleNoticeByPointId().get(point.id)), ), ); + const hasStaleDisplayedRows = createMemo(() => + sortedRows().some((point) => staleNoticeByPointId().has(point.id)), + ); return ( - -

Could not refresh TrueNAS protection.

-

- Showing previously loaded events. Outcomes and counts may be out of date. Newer - activity may be missing. -

- - - -
-
+ <> + + +

Could not refresh TrueNAS protection.

+

+ Showing previously loaded events. Outcomes and counts may be out of date. Newer + activity may be missing. +

+ + + +
+
+ + + Some TrueNAS protection readings are stale. Affected snapshot and + replication outcomes reflect the last successful TrueNAS poll. Newer runs or + failures may be missing. + + + } title="Snapshots & Replication" actions={ diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.freshness.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.freshness.test.tsx index a537fd2afe..c43af955de 100644 --- a/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.freshness.test.tsx +++ b/frontend-modern/src/features/truenas/__tests__/TrueNASProtectionTable.freshness.test.tsx @@ -446,4 +446,191 @@ describe('TrueNASProtectionTable stale-reading UI', () => { .closest('tr'), ).toHaveTextContent('Healthy'); }); + + it('shows a filter-aware stale banner above the table and clears it on filter narrowing or live recovery', async () => { + const staleNas = makeSystem({ + id: 'truenas:agent:system:conn-east', + name: 'nas-east', + displayName: 'nas-east', + agent: { agentId: 'conn-east', hostname: 'nas-east' }, + truenas: { hostname: 'nas-east' }, + sourceStatus: { truenas: { status: 'stale', error: 'API connection refused' } }, + health: { + verdict: 'stale', + reasons: [{ code: 'telemetry_stale', detail: '14m' }], + }, + }); + const freshNas = makeSystem({ + id: 'truenas:agent:system:conn-west', + name: 'nas-west', + displayName: 'nas-west', + agent: { agentId: 'conn-west', hostname: 'nas-west' }, + truenas: { hostname: 'nas-west' }, + sourceStatus: { truenas: { status: 'online' } }, + }); + + const points: RecoveryPoint[] = [ + makePoint({ + id: 'snap-east-ok', + kind: 'snapshot', + mode: 'snapshot', + outcome: 'success', + display: { itemLabel: 'tank/billing', nodeHostLabel: 'nas-east' }, + details: { + connectionId: 'conn-east', + hostname: 'nas-east', + dataset: 'tank/billing', + snapshot: 'auto-20261127-1200', + }, + }), + makePoint({ + id: 'rep-east-failed', + kind: 'backup', + mode: 'remote', + outcome: 'failed', + display: { itemLabel: 'tank/archive', nodeHostLabel: 'nas-east' }, + details: { + connectionId: 'conn-east', + hostname: 'nas-east', + taskName: 'replicate-archive', + lastState: 'FAILED', + }, + }), + makePoint({ + id: 'snap-west-ok', + kind: 'snapshot', + mode: 'snapshot', + outcome: 'success', + display: { itemLabel: 'vault/docs', nodeHostLabel: 'nas-west' }, + details: { + connectionId: 'conn-west', + hostname: 'nas-west', + dataset: 'vault/docs', + snapshot: 'auto-20261127-1205', + }, + }), + ]; + + const [systems, setSystems] = createSignal([staleNas, freshNas]); + + renderInRouter(() => ( + } + emptyTitle="No protection" + emptyDescription="No protection" + /> + )); + + // All view includes stale rows -> banner is visible with role="status" + const banner = screen.getByTestId('truenas-protection-stale-banner'); + expect(banner).toHaveAttribute('role', 'status'); + expect(banner).toHaveTextContent('Some TrueNAS protection readings are stale.'); + expect(banner).toHaveTextContent( + 'Affected snapshot and replication outcomes reflect the last successful TrueNAS poll. Newer runs or failures may be missing.', + ); + + // Narrowing to Healthy (current-only) hides the banner + await fireEvent.click(screen.getByRole('button', { name: 'Healthy, 1' })); + expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull(); + + // Switching to Stale or Failed restores the banner + await fireEvent.click(screen.getByRole('button', { name: 'Stale, 2' })); + expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument(); + + await fireEvent.click(screen.getByRole('button', { name: 'Failed, 1' })); + expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument(); + + // Returning to All and narrowing search to the fresh system hides the banner + await fireEvent.click(screen.getByRole('button', { name: 'All, 3' })); + expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument(); + + const searchInput = screen.getByPlaceholderText('Search snapshots or replication'); + await fireEvent.input(searchInput, { target: { value: 'vault/docs' } }); + expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull(); + + // Searching with no matches also hides the banner + await fireEvent.input(searchInput, { target: { value: 'nonexistent-dataset' } }); + expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull(); + + // Clearing search restores the banner; live recovery clears it without reload + await fireEvent.input(searchInput, { target: { value: '' } }); + expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument(); + + setSystems([ + makeSystem({ + ...staleNas, + sourceStatus: { truenas: { status: 'online' } }, + health: { verdict: 'ok', reasons: [] }, + }), + freshNas, + ]); + expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull(); + }); + + it('omits the table stale banner when all systems are current and preserves refresh error coexistence', () => { + const freshNas = makeSystem({ + id: 'truenas:agent:system:conn-west', + name: 'nas-west', + displayName: 'nas-west', + agent: { agentId: 'conn-west', hostname: 'nas-west' }, + truenas: { hostname: 'nas-west' }, + sourceStatus: { truenas: { status: 'online' } }, + }); + const staleNas = makeSystem({ + id: 'truenas:agent:system:conn-east', + name: 'nas-east', + displayName: 'nas-east', + agent: { agentId: 'conn-east', hostname: 'nas-east' }, + truenas: { hostname: 'nas-east' }, + sourceStatus: { truenas: { status: 'stale' } }, + }); + + const points: RecoveryPoint[] = [ + makePoint({ + id: 'snap-west-ok', + kind: 'snapshot', + mode: 'snapshot', + outcome: 'success', + display: { itemLabel: 'vault/docs', nodeHostLabel: 'nas-west' }, + details: { connectionId: 'conn-west', hostname: 'nas-west', dataset: 'vault/docs' }, + }), + makePoint({ + id: 'snap-east-ok', + kind: 'snapshot', + mode: 'snapshot', + outcome: 'success', + display: { itemLabel: 'tank/billing', nodeHostLabel: 'nas-east' }, + details: { connectionId: 'conn-east', hostname: 'nas-east', dataset: 'tank/billing' }, + }), + ]; + + const [systems, setSystems] = createSignal([ + freshNas, + makeSystem({ ...staleNas, sourceStatus: { truenas: { status: 'online' } } }), + ]); + const [error, setError] = createSignal(undefined); + + renderInRouter(() => ( + } + emptyTitle="No protection" + emptyDescription="No protection" + /> + )); + + expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull(); + expect(screen.queryByRole('alert', { name: 'Protection refresh failed' })).toBeNull(); + + // Both refresh failure and stale TrueNAS source render together without suppressing either + setSystems([freshNas, staleNas]); + setError(new Error('503 Service Unavailable')); + + expect(screen.getByRole('alert', { name: 'Protection refresh failed' })).toBeInTheDocument(); + expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument(); + }); });