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.

fix(recovery): make focused item reset explicit

rcourtman3a925508c6e4
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 0790c34fd1..d9cb244434 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -118,6 +118,7 @@ querying, and the operator-facing storage health presentation layer.
13. Letting visible protected-item filters fall out of shared recovery links; the protected `Stale only` toggle must restore from the canonical recovery URL and rewrite to one owned `stale=1` route form instead of disappearing on refresh or copy/paste
14. Reintroducing stacked full-width recovery tables as the primary desktop layout; the governed recovery surface must expose one primary data region at a time with explicit protected-items versus recovery-events view switching so Pulse stays inventory-first for Proxmox operators without collapsing the page back into a single-platform backup screen
15. Letting the primary recovery workspace tabs drift out of canonical route state; when operators explicitly switch between protected items and recovery events, the shared recovery link builder and page model must preserve that selection in route state unless the active `rollupId` or `day` context already implies the default workspace
+16. Hiding the active recovery rollup reset behind header-only breadcrumb copy; when a protected-item row focuses recovery history, the governed activity surface must surface that focus in the shared active-filter chip row with an explicit clear action so operators can return to the full history set without guessing at incidental header text
## Completion Obligations
diff --git a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
index 9f3a8e13f6..2c6a74298b 100644
--- a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
@@ -3,9 +3,6 @@ import type { Accessor, Component, JSX } from 'solid-js';
import { Card } from '@/components/shared/Card';
import { hideTooltip, showTooltip } from '@/components/shared/Tooltip';
-import {
- getRecoveryBreadcrumbLinkClass,
-} from '@/utils/recoveryActionPresentation';
import { getRecoveryFilterChipPresentation } from '@/utils/recoveryFilterChipPresentation';
import {
getRecoveryActivityEmptyState,
@@ -96,21 +93,11 @@ function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JS
</Show>
</div>
<div class="flex flex-wrap items-center gap-2">
- <Show when={props.selectedHistoryItemLabel()}>
- <div class="inline-flex items-center gap-2 rounded-md border border-border-subtle bg-surface/70 px-2.5 py-1 text-xs">
- <span class="font-semibold uppercase tracking-[0.14em] text-muted">Focused Item</span>
- <span class="max-w-[18rem] truncate font-medium text-base-content">
- {props.selectedHistoryItemLabel()}
- </span>
- </div>
- </Show>
<Show
when={props.hasFocusedRollup()}
fallback={<span class="text-xs text-muted">All protected items</span>}
>
- <button type="button" onClick={props.clearFocusedRollup} class={getRecoveryBreadcrumbLinkClass()}>
- All history
- </button>
+ <span class="text-xs font-medium text-muted">Showing selected item history</span>
</Show>
</div>
</div>
@@ -118,6 +105,7 @@ function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JS
<Show
when={
+ props.selectedHistoryItemLabel() ||
props.selectedDateKey() ||
props.activeItemTypeLabel() ||
props.activeClusterLabel() ||
@@ -126,6 +114,30 @@ function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JS
}
>
<div class="mb-1 flex flex-wrap items-center gap-1.5">
+ <Show when={props.selectedHistoryItemLabel()}>
+ {(() => {
+ const chip = getRecoveryFilterChipPresentation('focused-item');
+ return (
+ <div data-testid="active-rollup-chip" class={chip.className}>
+ <span class="font-medium uppercase tracking-wide">{chip.label}</span>
+ <span
+ class="truncate font-mono text-[10px]"
+ title={props.selectedHistoryItemLabel() ?? undefined}
+ >
+ {props.selectedHistoryItemLabel()}
+ </span>
+ <button
+ type="button"
+ onClick={props.clearFocusedRollup}
+ class={chip.clearButtonClass}
+ aria-label="Clear focused item"
+ >
+ Clear
+ </button>
+ </div>
+ );
+ })()}
+ </Show>
<Show when={props.selectedDateKey()}>
{(() => {
const chip = getRecoveryFilterChipPresentation('day');
diff --git a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
index 4bd455a837..ccde1ce838 100644
--- a/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/RecoveryActivitySection.test.tsx
@@ -1,5 +1,5 @@
-import { render, screen } from '@solidjs/testing-library';
-import { describe, expect, it } from 'vitest';
+import { fireEvent, render, screen } from '@solidjs/testing-library';
+import { describe, expect, it, vi } from 'vitest';
import { RecoveryActivitySection } from '@/components/Recovery/RecoveryActivitySection';
@@ -50,4 +50,42 @@ describe('RecoveryActivitySection', () => {
expect(screen.queryByText(/1.5 \/ day/i)).not.toBeInTheDocument();
expect(screen.getAllByRole('button', { name: /recovery points/i })).toHaveLength(2);
});
+
+ it('shows the focused rollup as a clearable active filter chip', async () => {
+ const clearFocusedRollup = vi.fn();
+
+ render(() => (
+ <RecoveryActivitySection
+ activitySummary={() => ({ totalPoints: 3, activeDays: 2, averagePerDay: 1.5 })}
+ activeClusterLabel={() => ''}
+ activeItemTypeLabel={() => ''}
+ activeNamespaceLabel={() => ''}
+ activeNodeLabel={() => ''}
+ chartRangeDays={() => 30}
+ clearClusterFilter={() => undefined}
+ clearFocusedRollup={clearFocusedRollup}
+ clearItemTypeFilter={() => undefined}
+ clearNamespaceFilter={() => undefined}
+ clearNodeFilter={() => undefined}
+ clearSelectedDate={() => undefined}
+ hasFocusedRollup={() => true}
+ isMobile={false}
+ loading={() => false}
+ overallRollupsSummary={() => ({ total: 2, stale: 0, neverSucceeded: 0 })}
+ selectedDateKey={() => null}
+ selectedDateLabel={() => ''}
+ selectedHistoryItemLabel={() => 'Archive VM'}
+ timeline={() => ({ points: [], axisMax: 0, labelEvery: 1 })}
+ toggleSelectedDate={() => undefined}
+ />
+ ));
+
+ const chip = screen.getByTestId('active-rollup-chip');
+ expect(chip).toHaveTextContent('Focused Item');
+ expect(chip).toHaveTextContent('Archive VM');
+ expect(screen.getByText('Showing selected item history')).toBeInTheDocument();
+
+ await fireEvent.click(screen.getByRole('button', { name: /clear focused item/i }));
+ expect(clearFocusedRollup).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/frontend-modern/src/pages/__tests__/RecoveryRoute.test.tsx b/frontend-modern/src/pages/__tests__/RecoveryRoute.test.tsx
index cced4d2f47..75a1eca713 100644
--- a/frontend-modern/src/pages/__tests__/RecoveryRoute.test.tsx
+++ b/frontend-modern/src/pages/__tests__/RecoveryRoute.test.tsx
@@ -38,4 +38,14 @@ describe('RecoveryRoute', () => {
});
expect(navigateSpy).not.toHaveBeenCalled();
});
+
+ it('preserves focused rollup routes without redirecting away from the selected history view', async () => {
+ mockLocationSearch = '?view=events&rollupId=res%3Avm-123';
+ render(() => <RecoveryRoute />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId('recovery-component')).toBeInTheDocument();
+ });
+ expect(navigateSpy).not.toHaveBeenCalled();
+ });
});
diff --git a/frontend-modern/src/utils/recoveryFilterChipPresentation.ts b/frontend-modern/src/utils/recoveryFilterChipPresentation.ts
index ac193294d7..f42766ca9f 100644
--- a/frontend-modern/src/utils/recoveryFilterChipPresentation.ts
+++ b/frontend-modern/src/utils/recoveryFilterChipPresentation.ts
@@ -1,6 +1,12 @@
import { getRecoveryLocationFacetLabel } from '@/utils/recoveryLocationPresentation';
-export type RecoveryFilterChipKind = 'day' | 'cluster' | 'item-type' | 'node' | 'namespace';
+export type RecoveryFilterChipKind =
+ | 'day'
+ | 'cluster'
+ | 'item-type'
+ | 'node'
+ | 'namespace'
+ | 'focused-item';
type RecoveryFilterChipPresentation = {
clearButtonClass: string;
@@ -22,6 +28,11 @@ const CHIP_PRESENTATION: Record<RecoveryFilterChipKind, RecoveryFilterChipPresen
className: `${CHIP_BASE_CLASS} border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900 dark:text-blue-200`,
label: 'Day',
},
+ 'focused-item': {
+ clearButtonClass: `${CLEAR_BUTTON_BASE_CLASS} hover:bg-amber-100 dark:hover:bg-amber-900`,
+ className: `${CHIP_BASE_CLASS} border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-700 dark:bg-amber-900 dark:text-amber-200`,
+ label: 'Focused Item',
+ },
'item-type': {
clearButtonClass: `${CLEAR_BUTTON_BASE_CLASS} hover:bg-fuchsia-100 dark:hover:bg-fuchsia-900`,
className: `${CHIP_BASE_CLASS} border-fuchsia-200 bg-fuchsia-50 text-fuchsia-700 dark:border-fuchsia-700 dark:bg-fuchsia-900 dark:text-fuchsia-200`,