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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(recovery): add a real history item filter
rcourtman4c0f307a4396
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 175c15e332..be4952e86d 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -111,14 +111,14 @@ querying, and the operator-facing storage health presentation layer.9. Letting whitespace-padded recovery timeline params fall off canonical route state; shared recovery URLs must trim and normalize `day`, `range`, `scope`, `status`, `verification`, `cluster`, `node`, `namespace`, `itemType`, and adjacent history filters before the page model validates them so pasted or hand-edited links resolve to the same canonical timeline and filter state as UI-authored routes10. Letting explicit recovery `all` sentinels survive in canonical route state; shared recovery URLs must collapse case- or whitespace-variant `all` values for `cluster`, `node`, `namespace`, and `itemType` back to the canonical unset route state so copied links do not preserve fake active filters11. Letting non-canonical recovery platform values survive in route or transport state; shared recovery URLs must collapse unsupported or fake `platform` values back to the canonical unset state, and only owned source-platform options or canonical legacy aliases may reach rollups, points, series, and facets transport filters-11c. Letting route-owned recovery platform selections disappear while filter options are still hydrating; the recovery page state owner must keep the current canonical `platform` query value present in the platform option set until transport-backed facets and records arrive so shared filter selects keep the user-visible TrueNAS or other owned platform selection instead of flashing back to `All Platforms`-11a. Letting adjacent workload-route changes in shared `frontend-modern/src/routing/resourceLinks.ts` perturb recovery parse/build semantics; expanding canonical `/workloads` platform scoping must not alter the owned `/recovery` `platform` and `itemType` vocabulary, legacy alias rewrites, or recovery drill-down workspace selection-11b. Letting adjacent storage-link additions in shared `frontend-modern/src/routing/resourceLinks.ts` perturb recovery route semantics; expanding canonical `/storage` deep links for unified resources must not reuse recovery-owned query names or alter the owned `/recovery` parse/build contract while those surfaces continue sharing the same route-helper module+ 11c. Letting route-owned recovery platform selections disappear while filter options are still hydrating; the recovery page state owner must keep the current canonical `platform` query value present in the platform option set until transport-backed facets and records arrive so shared filter selects keep the user-visible TrueNAS or other owned platform selection instead of flashing back to `All Platforms`+ 11a. Letting adjacent workload-route changes in shared `frontend-modern/src/routing/resourceLinks.ts` perturb recovery parse/build semantics; expanding canonical `/workloads` platform scoping must not alter the owned `/recovery` `platform` and `itemType` vocabulary, legacy alias rewrites, or recovery drill-down workspace selection+ 11b. Letting adjacent storage-link additions in shared `frontend-modern/src/routing/resourceLinks.ts` perturb recovery route semantics; expanding canonical `/storage` deep links for unified resources must not reuse recovery-owned query names or alter the owned `/recovery` parse/build contract while those surfaces continue sharing the same route-helper module12. Letting protected-item recovery outcome filtering fork from the canonical history status filter; the protected inventory status control must drive the same route-backed `status` field and the same rollups, points, series, and facets transport filters as the history surface instead of keeping a protected-only local outcome branch13. 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/paste14. 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 screen15. 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. Treating a selected protected-item rollup as header-only state instead of a canonical history filter; when a protected-item row focuses recovery history, the governed recovery events controls must surface that focus inside the shared filter surface, count it with the rest of the active filters, and let the same filter reset path clear it+16. Treating a selected protected-item rollup as row-click-only or header-only state instead of a canonical history filter; when a protected-item row focuses recovery history, the governed recovery events controls must surface that focus inside the shared filter surface through the same user-creatable item filter control, count it with the rest of the active filters, and let the same filter reset path clear it## Completion Obligations@@ -320,7 +320,7 @@ describes the monitored platform families Pulse covers rather than exposingbackend transport vocabulary as the primary UI model.That same operator-facing vocabulary should also prefer `item` over backend`subject` wording, and `platform` over generic `source` wording, across the-primary recovery headers, tables, focus chips, and detail metadata labels.+primary recovery headers, tables, filter controls, and detail metadata labels.The data model can keep its internal subject/provider fields, but the pageframe that operators read should present one consistent protected-item andplatform model from summary through drill-in. Shared recovery URLs and@@ -1572,15 +1572,15 @@ trusts the backend canonical metadata directly instead of re-normalizing itlocally, so storage and recovery views see the same policy posture the APIpublishes. The same hook and the resource-identity helpers it depends on nowshare the canonical trimmed-string utility instead of each surface rebuilding- its own whitespace cleanup, so storage and recovery identity checks stay- aligned with the other unified-resource consumers. That same decode path- also projects Kubernetes cluster identity through the shared cluster-context- helper, so storage and recovery surfaces see the same canonical cluster- prefix as the dashboard and unified-resource store instead of rebuilding- their own fallback. That same boundary now also owns the backend facet-bundle- route for timeline history and related change counts, so storage and recovery- surfaces must continue to consume the shared bundle rather than issuing- separate local resource-detail fetches.+its own whitespace cleanup, so storage and recovery identity checks stay+aligned with the other unified-resource consumers. That same decode path+also projects Kubernetes cluster identity through the shared cluster-context+helper, so storage and recovery surfaces see the same canonical cluster+prefix as the dashboard and unified-resource store instead of rebuilding+their own fallback. That same boundary now also owns the backend facet-bundle+route for timeline history and related change counts, so storage and recovery+surfaces must continue to consume the shared bundle rather than issuing+separate local resource-detail fetches.That same shared `internal/api/` dependency now also assumes canonicalsecurity-token lifecycle reads. Storage- and recovery-adjacent consumers ofshared auth/security helpers may inspect token metadata, but they must notdiff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsxindex d801148c38..4f1d432a00 100644--- a/frontend-modern/src/components/Recovery/Recovery.tsx+++ b/frontend-modern/src/components/Recovery/Recovery.tsx@@ -13,6 +13,7 @@ import { useBreakpoint } from '@/hooks/useBreakpoint';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import type { ColumnDef } from '@/hooks/useColumnVisibility';import { useKioskMode } from '@/hooks/useKioskMode';+import { useRecoveryRollups } from '@/hooks/useRecoveryRollups';import type { ProtectionRollup, RecoveryOutcome, RecoveryPoint } from '@/types/recovery';import { STORAGE_KEYS } from '@/utils/localStorage';import {@@ -26,6 +27,7 @@ import { normalizeRecoveryOutcome as normalizeOutcome } from '@/utils/recoveryOuimport {getRecoveryPointItemLabel,getRecoveryPointTimestampMs,+ getRecoveryRollupItemSecondaryLabel,getRecoveryRollupItemLabel,} from '@/utils/recoveryRecordPresentation';import {@@ -41,6 +43,7 @@ import {} from '@/utils/recoveryTablePresentation';import { getRecoveryTimelineLabelEvery } from '@/utils/recoveryTimelineChartPresentation';import { getRecoveryRollupPlatforms } from '@/utils/recoveryPlatformModel';+import { getSourcePlatformLabel } from '@/utils/sourcePlatforms';import { createVisibleCanonicalTypeColumn } from '@/utils/typeColumnDefinition';const MOBILE_RECOVERY_COLUMNS = new Set(['time', 'item', 'outcome']);@@ -107,6 +110,16 @@ const Recovery: Component = () => {workspaceView,} = useRecoverySurfaceState();+ const rollupCatalogWindow = createMemo(() => {+ const days = chartRangeDays();+ const end = new Date();+ end.setHours(23, 59, 59, 999);+ const start = new Date(end);+ start.setDate(start.getDate() - (days - 1));+ start.setHours(0, 0, 0, 0);+ return { from: start.toISOString(), to: end.toISOString() };+ });+const baseRollups = createMemo<ProtectionRollup[]>(() => {const query = queryFilter().trim().toLowerCase();const platform = platformFilter() === 'all' ? '' : platformFilter();@@ -206,11 +219,87 @@ const Recovery: Component = () => {return rollups().find((rollup) => rollup.rollupId === selected) || null;});+ const recoveryHistoryItemCatalog = useRecoveryRollups(() => {+ if (!rollupId().trim()) return null;+ const window = rollupCatalogWindow();+ const vf = verificationFilter();+ return {+ platform: platformFilter() === 'all' ? null : platformFilter(),+ itemType: itemTypeFilter() === 'all' ? null : itemTypeFilter(),+ mode: modeFilter() === 'all' ? null : modeFilter(),+ outcome: historyOutcomeFilter() === 'all' ? null : historyOutcomeFilter(),+ q: queryFilter().trim() || null,+ cluster: clusterFilter() === 'all' ? null : clusterFilter(),+ node: nodeFilter() === 'all' ? null : nodeFilter(),+ namespace: namespaceFilter() === 'all' ? null : namespaceFilter(),+ scope: scopeFilter() === 'workload' ? 'workload' : null,+ verification: vf === 'all' ? null : vf,+ from: window.from,+ to: window.to,+ };+ });++ const selectableRollups = createMemo<ProtectionRollup[]>(() => {+ const selected = rollupId().trim();+ if (!selected) return rollups();+ const catalog = recoveryHistoryItemCatalog.rollups() || [];+ if (catalog.length > 0) return catalog;+ const focused = selectedRollup();+ return focused ? [focused] : [];+ });++ const selectedHistoryRollup = createMemo<ProtectionRollup | null>(() => {+ const selected = rollupId().trim();+ if (!selected) return null;+ return (+ selectableRollups().find((rollup) => rollup.rollupId === selected) || selectedRollup() || null+ );+ });+const selectedHistoryItemLabel = createMemo(() => {- const rollup = selectedRollup();+ const rollup = selectedHistoryRollup();return rollup ? getRecoveryRollupItemLabel(rollup, resourcesById()) : null;});+ const historyItemOptions = createMemo(() => {+ const resourceIndex = resourcesById();+ const options = selectableRollups().map((rollup) => {+ const itemTypeLabel =+ getRecoveryItemTypePresentation(getRecoveryRollupItemTypeKey(rollup))?.label || null;+ const platformLabels = getRecoveryRollupPlatforms(rollup)+ .map((platform) => getSourcePlatformLabel(String(platform || '').trim()))+ .filter(Boolean)+ .sort((left, right) => left.localeCompare(right));+ return {+ rollupId: rollup.rollupId,+ label: getRecoveryRollupItemLabel(rollup, resourceIndex),+ secondaryLabel: getRecoveryRollupItemSecondaryLabel(rollup),+ contextLabel: [itemTypeLabel, platformLabels.join(', ')].filter(Boolean).join(' · '),+ };+ });++ const selected = selectedHistoryRollup();+ if (!selected) return options;+ if (options.some((option) => option.rollupId === selected.rollupId)) return options;++ const itemTypeLabel =+ getRecoveryItemTypePresentation(getRecoveryRollupItemTypeKey(selected))?.label || null;+ const platformLabels = getRecoveryRollupPlatforms(selected)+ .map((platform) => getSourcePlatformLabel(String(platform || '').trim()))+ .filter(Boolean)+ .sort((left, right) => left.localeCompare(right));++ return [+ {+ rollupId: selected.rollupId,+ label: getRecoveryRollupItemLabel(selected, resourceIndex),+ secondaryLabel: getRecoveryRollupItemSecondaryLabel(selected),+ contextLabel: [itemTypeLabel, platformLabels.join(', ')].filter(Boolean).join(' · '),+ },+ ...options,+ ];+ });+const filteredPoints = createMemo<RecoveryPoint[]>(() => {const points = recoveryPoints.points() || [];const selected = selectedDateKey();@@ -633,12 +722,12 @@ const Recovery: Component = () => {availableOutcomes={['all', 'success', 'warning', 'failed', 'running']}clusterFilter={clusterFilter}clusterOptions={clusterOptions}- clearFocusedRollup={() => setRollupId('')}currentPage={currentPage}groupedByDay={groupedByDay}hasActiveArtifactFilters={hasActiveArtifactFilters}hasFocusedRollup={() => rollupId().trim().length > 0}historyOutcomeFilter={historyOutcomeFilter}+ historyItemOptions={historyItemOptions}isMobile={isMobile()}kioskMode={kioskMode()}mobileVisibleArtifactColumns={mobileVisibleArtifactColumns}@@ -656,6 +745,7 @@ const Recovery: Component = () => {resetAdvancedArtifactFilters={resetAdvancedArtifactFilters}resetAllArtifactFilters={resetAllArtifactFilters}resourcesById={resourcesById}+ rollupId={rollupId}scopeFilter={scopeFilter}selectedHistoryItemLabel={selectedHistoryItemLabel}setClusterFilter={setClusterFilter}@@ -667,6 +757,7 @@ const Recovery: Component = () => {setNodeFilter={setNodeFilter}setPlatformFilter={setPlatformFilter}setQueryFilter={setQueryFilter}+ setRollupId={setRollupId}setScopeFilter={setScopeFilter}setVerificationFilter={setVerificationFilter}showClusterFilter={showClusterFilter}diff --git a/frontend-modern/src/components/Recovery/RecoveryHistoryItemFilter.tsx b/frontend-modern/src/components/Recovery/RecoveryHistoryItemFilter.tsxnew file mode 100644index 0000000000..fff265fd0f--- /dev/null+++ b/frontend-modern/src/components/Recovery/RecoveryHistoryItemFilter.tsx@@ -0,0 +1,245 @@+import { For, Show, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';+import type { Accessor, Component } from 'solid-js';+import ChevronDownIcon from 'lucide-solid/icons/chevron-down';++import { SearchField } from '@/components/shared/SearchField';+import {+ filterGroupClass,+ filterLabelClass,+ filterPanelDescriptionClass,+ filterPanelTitleClass,+ filterSelectClass,+} from '@/components/shared/FilterToolbar';++export interface RecoveryHistoryItemFilterOption {+ rollupId: string;+ label: string;+ secondaryLabel?: string | null;+ contextLabel?: string | null;+}++interface RecoveryHistoryItemFilterProps {+ options: Accessor<RecoveryHistoryItemFilterOption[]>;+ selectedRollupId: Accessor<string>;+ selectedLabel: Accessor<string | null>;+ onSelect: (rollupId: string) => void;+ onClear: () => void;+}++const OPTION_LIMIT = 40;++export const RecoveryHistoryItemFilter: Component<RecoveryHistoryItemFilterProps> = (props) => {+ const [isOpen, setIsOpen] = createSignal(false);+ const [query, setQuery] = createSignal('');+ const [activeIndex, setActiveIndex] = createSignal(0);+ let rootRef: HTMLDivElement | undefined;+ let searchInputRef: HTMLInputElement | undefined;++ const filteredOptions = createMemo(() => {+ const normalizedQuery = query().trim().toLowerCase();+ const selected = props.selectedRollupId().trim();+ const ranked = props+ .options()+ .filter((option) => {+ if (!normalizedQuery) return true;+ const haystack = [+ option.label,+ option.secondaryLabel || '',+ option.contextLabel || '',+ option.rollupId,+ ]+ .join(' ')+ .toLowerCase();+ return haystack.includes(normalizedQuery);+ })+ .sort((left, right) => {+ const leftSelected = left.rollupId === selected ? 1 : 0;+ const rightSelected = right.rollupId === selected ? 1 : 0;+ if (leftSelected !== rightSelected) return rightSelected - leftSelected;+ return left.label.localeCompare(right.label);+ });++ return ranked.slice(0, OPTION_LIMIT);+ });++ const close = () => {+ setIsOpen(false);+ setQuery('');+ setActiveIndex(0);+ };++ const handleClickOutside = (event: MouseEvent) => {+ const target = event.target as Node | null;+ if (target && rootRef?.contains(target)) return;+ close();+ };++ createEffect(() => {+ if (!isOpen()) return;+ document.addEventListener('mousedown', handleClickOutside);+ queueMicrotask(() => searchInputRef?.focus());+ onCleanup(() => document.removeEventListener('mousedown', handleClickOutside));+ });++ onCleanup(() => {+ document.removeEventListener('mousedown', handleClickOutside);+ });++ createEffect(() => {+ filteredOptions();+ setActiveIndex(0);+ });++ return (+ <div ref={rootRef} class={`relative ${filterGroupClass}`}>+ <span class={filterLabelClass}>Item</span>+ <button+ type="button"+ class={`${filterSelectClass} flex min-w-[12rem] max-w-[18rem] items-center gap-2 pr-2 text-left`}+ aria-haspopup="dialog"+ aria-expanded={isOpen()}+ aria-controls="recovery-history-item-filter-panel"+ aria-label="Item filter"+ data-testid="recovery-history-item-filter-trigger"+ onClick={() => {+ if (isOpen()) {+ close();+ return;+ }+ setIsOpen(true);+ }}+ >+ <span class="truncate">{props.selectedLabel() || 'Any Item'}</span>+ <ChevronDownIcon+ class={`ml-auto h-3.5 w-3.5 shrink-0 transition-transform ${isOpen() ? 'rotate-180' : ''}`}+ />+ </button>++ <Show when={isOpen()}>+ <div+ id="recovery-history-item-filter-panel"+ data-testid="recovery-history-item-filter-panel"+ class="absolute left-0 top-[calc(100%+0.5rem)] z-20 w-[min(28rem,calc(100vw-2rem))] rounded-md border border-border bg-surface p-3 shadow-lg"+ role="dialog"+ aria-label="Choose recovery item"+ >+ <div class="mb-3 flex items-start justify-between gap-3">+ <div>+ <div class={filterPanelTitleClass}>Filter by item</div>+ <div class={filterPanelDescriptionClass}>+ Pick an exact protected item or clear the selection.+ </div>+ </div>+ <Show when={props.selectedRollupId().trim() !== ''}>+ <button+ type="button"+ class="text-xs font-medium text-muted transition-colors hover:text-base-content"+ data-testid="recovery-history-item-filter-clear"+ onClick={() => {+ props.onClear();+ close();+ }}+ >+ Clear item+ </button>+ </Show>+ </div>++ <SearchField+ value={query()}+ onChange={setQuery}+ inputRef={(element) => {+ searchInputRef = element;+ }}+ onKeyDown={(event) => {+ const options = filteredOptions();+ if (event.key === 'Escape') {+ event.preventDefault();+ close();+ return;+ }+ if (!options.length) return;+ if (event.key === 'ArrowDown') {+ event.preventDefault();+ setActiveIndex((current) => Math.min(current + 1, options.length - 1));+ return;+ }+ if (event.key === 'ArrowUp') {+ event.preventDefault();+ setActiveIndex((current) => Math.max(current - 1, 0));+ return;+ }+ if (event.key === 'Enter') {+ event.preventDefault();+ const option = options[activeIndex()];+ if (!option) return;+ props.onSelect(option.rollupId);+ close();+ }+ }}+ placeholder="Search protected items..."+ inputClass="py-2 text-sm"+ clearOnFocusedEscape={false}+ />++ <div class="mt-3 max-h-[18rem] overflow-y-auto">+ <Show+ when={filteredOptions().length > 0}+ fallback={+ <div class="rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted">+ No matching protected items.+ </div>+ }+ >+ <div class="flex flex-col gap-1">+ <For each={filteredOptions()}>+ {(option, index) => {+ const isSelected = () => option.rollupId === props.selectedRollupId().trim();+ const isActive = () => index() === activeIndex();+ return (+ <button+ type="button"+ data-testid={`recovery-history-item-filter-option-${option.rollupId}`}+ class={`flex w-full flex-col rounded-md px-3 py-2 text-left transition-colors ${+ isSelected()+ ? 'bg-blue-50 text-base-content ring-1 ring-blue-200 dark:bg-blue-950/40 dark:ring-blue-900'+ : isActive()+ ? 'bg-surface-hover text-base-content'+ : 'text-base-content hover:bg-surface-hover'+ }`}+ onClick={() => {+ props.onSelect(option.rollupId);+ close();+ }}+ onMouseEnter={() => setActiveIndex(index())}+ >+ <div class="flex items-center gap-2">+ <span class="truncate font-medium">{option.label}</span>+ <Show when={isSelected()}>+ <span class="shrink-0 rounded-full bg-surface-alt px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted">+ Selected+ </span>+ </Show>+ </div>+ <Show when={option.secondaryLabel || option.contextLabel}>+ <div class="mt-0.5 flex flex-wrap gap-x-2 gap-y-1 text-xs text-muted">+ <Show when={option.secondaryLabel}>+ <span>{option.secondaryLabel}</span>+ </Show>+ <Show when={option.contextLabel}>+ <span>{option.contextLabel}</span>+ </Show>+ </div>+ </Show>+ </button>+ );+ }}+ </For>+ </div>+ </Show>+ </div>+ </div>+ </Show>+ </div>+ );+};diff --git a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsxindex f31c47452f..64b96b35e4 100644--- a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx+++ b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx@@ -17,8 +17,10 @@ import { STORAGE_KEYS } from '@/utils/localStorage';import type { RecoveryOutcome } from '@/types/recovery';import type { Resource } from '@/types/resource';import { getRecoveryFilterPanelClearClass } from '@/utils/recoveryActionPresentation';-import { getRecoveryArtifactModePresentation, type RecoveryArtifactMode } from '@/utils/recoveryArtifactModePresentation';-import { getRecoveryFilterChipPresentation } from '@/utils/recoveryFilterChipPresentation';+import {+ getRecoveryArtifactModePresentation,+ type RecoveryArtifactMode,+} from '@/utils/recoveryArtifactModePresentation';import {getRecoveryItemTypePresentation,normalizeRecoveryItemTypeQueryValue,@@ -41,6 +43,10 @@ import {type RecoveryPointGroup,type RecoveryPointsModel,} from '@/components/Recovery/RecoveryHistoryTable';+import {+ RecoveryHistoryItemFilter,+ type RecoveryHistoryItemFilterOption,+} from '@/components/Recovery/RecoveryHistoryItemFilter';import { useRecoveryHistorySectionState } from '@/components/Recovery/useRecoveryHistorySectionState';type ArtifactMode = RecoveryArtifactMode;@@ -59,12 +65,12 @@ interface RecoveryHistorySectionProps {availableOutcomes: readonly ('all' | 'success' | 'warning' | 'failed' | 'running')[];clusterFilter: Accessor<string>;clusterOptions: Accessor<string[]>;- clearFocusedRollup: () => void;currentPage: Accessor<number>;groupedByDay: Accessor<RecoveryPointGroup[]>;hasActiveArtifactFilters: Accessor<boolean>;hasFocusedRollup: Accessor<boolean>;historyOutcomeFilter: Accessor<'all' | RecoveryOutcome>;+ historyItemOptions: Accessor<RecoveryHistoryItemFilterOption[]>;itemTypeFilter: Accessor<string>;itemTypeOptions: Accessor<string[]>;isMobile: boolean;@@ -82,6 +88,7 @@ interface RecoveryHistorySectionProps {resetAdvancedArtifactFilters: () => void;resetAllArtifactFilters: () => void;resourcesById: Accessor<Map<string, Resource>>;+ rollupId: Accessor<string>;scopeFilter: Accessor<'all' | 'workload'>;selectedHistoryItemLabel: Accessor<string | null>;setClusterFilter: (value: string) => void;@@ -93,6 +100,7 @@ interface RecoveryHistorySectionProps {setNodeFilter: (value: string) => void;setPlatformFilter: (value: string) => void;setQueryFilter: (value: string) => void;+ setRollupId: (value: string) => void;setScopeFilter: (value: 'all' | 'workload') => void;setVerificationFilter: (value: VerificationFilter) => void;showClusterFilter: Accessor<boolean>;@@ -132,35 +140,6 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (pverificationFilter: props.verificationFilter,});- const focusedRollupFilter = () => {- const chip = getRecoveryFilterChipPresentation('focused-item');- return (- <div- data-testid="recovery-history-focused-filter"- class={`${chip.className} max-w-full shrink-0`}- >- <span class="font-medium uppercase tracking-wide">{chip.label}</span>- <span- class="max-w-[18rem] truncate font-mono text-[10px]"- title={props.selectedHistoryItemLabel() ?? undefined}- >- {props.selectedHistoryItemLabel()}- </span>- <button- type="button"- onClick={() => {- props.clearFocusedRollup();- props.setCurrentPage(1);- }}- class={chip.clearButtonClass}- aria-label="Clear focused item filter"- >- Clear- </button>- </div>- );- };-return (<div class="flex flex-col gap-2"><Show when={!props.kioskMode}>@@ -169,9 +148,6 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p<PageControlsrole="group"aria-label="Recovery events controls"- mobileLeading={- props.isMobile && props.hasFocusedRollup() ? focusedRollupFilter() : undefined- }search={<SearchInputvalue={props.queryFilter}@@ -234,140 +210,144 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p</div><div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">- <label class="flex min-w-0 flex-col gap-1">- <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>Scope</span>- <select- value={props.scopeFilter()}- onChange={(event) => {- props.setScopeFilter(- event.currentTarget.value === 'workload' ? 'workload' : 'all',- );- props.setCurrentPage(1);- }}- class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}- >- <option value="all">All history</option>- <option value="workload">Workloads only</option>- </select>- </label>-- <label class="flex min-w-0 flex-col gap-1">- <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>Method</span>- <select- value={props.modeFilter()}- onChange={(event) => {- props.setModeFilter(- normalizeRecoveryModeQueryValue(event.currentTarget.value),- );- props.setCurrentPage(1);- }}- class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}- >- <option value="all">Any method</option>- <option value="snapshot">- {getRecoveryArtifactModePresentation('snapshot').label}- </option>- <option value="local">- {getRecoveryArtifactModePresentation('local').label}- </option>- <option value="remote">- {getRecoveryArtifactModePresentation('remote').label}- </option>- </select>- </label>-- <Show when={props.showVerificationFilter()}><label class="flex min-w-0 flex-col gap-1">- <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>Verification</span>+ <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>Scope</span><select- value={props.verificationFilter()}+ value={props.scopeFilter()}onChange={(event) => {- props.setVerificationFilter(- event.currentTarget.value as VerificationFilter,+ props.setScopeFilter(+ event.currentTarget.value === 'workload' ? 'workload' : 'all',);- if (event.currentTarget.value !== 'all') {- props.setHistoryOutcomeFilter('all');- }props.setCurrentPage(1);}}class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}>- <option value="all">Any verification</option>- <option value="verified">Verified</option>- <option value="unverified">Unverified</option>- <option value="unknown">Unknown</option>+ <option value="all">All history</option>+ <option value="workload">Workloads only</option></select></label>- </Show>- <Show when={props.showClusterFilter()}><label class="flex min-w-0 flex-col gap-1">- <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>- {getRecoveryLocationFacetLabel('cluster')}- </span>+ <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>Method</span><select- value={props.clusterFilter()}+ value={props.modeFilter()}onChange={(event) => {- props.setClusterFilter(event.currentTarget.value);+ props.setModeFilter(+ normalizeRecoveryModeQueryValue(event.currentTarget.value),+ );props.setCurrentPage(1);}}class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}>- <option value="all">- {getRecoveryLocationFacetAllLabel('cluster')}+ <option value="all">Any method</option>+ <option value="snapshot">+ {getRecoveryArtifactModePresentation('snapshot').label}</option>- <For each={props.clusterOptions().filter((value) => value !== 'all')}>- {(cluster) => <option value={cluster}>{cluster}</option>}- </For>- </select>- </label>- </Show>-- <Show when={props.showNodeFilter()}>- <label class="flex min-w-0 flex-col gap-1">- <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>- {getRecoveryLocationFacetLabel('node')}- </span>- <select- value={props.nodeFilter()}- onChange={(event) => {- props.setNodeFilter(event.currentTarget.value);- props.setCurrentPage(1);- }}- class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}- >- <option value="all">- {getRecoveryLocationFacetAllLabel('node')}+ <option value="local">+ {getRecoveryArtifactModePresentation('local').label}</option>- <For each={props.nodeOptions().filter((value) => value !== 'all')}>- {(node) => <option value={node}>{node}</option>}- </For>- </select>- </label>- </Show>-- <Show when={props.showNamespaceFilter()}>- <label class="flex min-w-0 flex-col gap-1">- <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>- {getRecoveryLocationFacetLabel('namespace')}- </span>- <select- value={props.namespaceFilter()}- onChange={(event) => {- props.setNamespaceFilter(event.currentTarget.value);- props.setCurrentPage(1);- }}- class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}- >- <option value="all">- {getRecoveryLocationFacetAllLabel('namespace')}+ <option value="remote">+ {getRecoveryArtifactModePresentation('remote').label}</option>- <For each={props.namespaceOptions().filter((value) => value !== 'all')}>- {(namespace) => <option value={namespace}>{namespace}</option>}- </For></select></label>- </Show>++ <Show when={props.showVerificationFilter()}>+ <label class="flex min-w-0 flex-col gap-1">+ <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>Verification</span>+ <select+ value={props.verificationFilter()}+ onChange={(event) => {+ props.setVerificationFilter(+ event.currentTarget.value as VerificationFilter,+ );+ if (event.currentTarget.value !== 'all') {+ props.setHistoryOutcomeFilter('all');+ }+ props.setCurrentPage(1);+ }}+ class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}+ >+ <option value="all">Any verification</option>+ <option value="verified">Verified</option>+ <option value="unverified">Unverified</option>+ <option value="unknown">Unknown</option>+ </select>+ </label>+ </Show>++ <Show when={props.showClusterFilter()}>+ <label class="flex min-w-0 flex-col gap-1">+ <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>+ {getRecoveryLocationFacetLabel('cluster')}+ </span>+ <select+ value={props.clusterFilter()}+ onChange={(event) => {+ props.setClusterFilter(event.currentTarget.value);+ props.setCurrentPage(1);+ }}+ class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}+ >+ <option value="all">+ {getRecoveryLocationFacetAllLabel('cluster')}+ </option>+ <For+ each={props.clusterOptions().filter((value) => value !== 'all')}+ >+ {(cluster) => <option value={cluster}>{cluster}</option>}+ </For>+ </select>+ </label>+ </Show>++ <Show when={props.showNodeFilter()}>+ <label class="flex min-w-0 flex-col gap-1">+ <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>+ {getRecoveryLocationFacetLabel('node')}+ </span>+ <select+ value={props.nodeFilter()}+ onChange={(event) => {+ props.setNodeFilter(event.currentTarget.value);+ props.setCurrentPage(1);+ }}+ class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}+ >+ <option value="all">+ {getRecoveryLocationFacetAllLabel('node')}+ </option>+ <For each={props.nodeOptions().filter((value) => value !== 'all')}>+ {(node) => <option value={node}>{node}</option>}+ </For>+ </select>+ </label>+ </Show>++ <Show when={props.showNamespaceFilter()}>+ <label class="flex min-w-0 flex-col gap-1">+ <span class={RECOVERY_ADVANCED_FILTER_LABEL_CLASS}>+ {getRecoveryLocationFacetLabel('namespace')}+ </span>+ <select+ value={props.namespaceFilter()}+ onChange={(event) => {+ props.setNamespaceFilter(event.currentTarget.value);+ props.setCurrentPage(1);+ }}+ class={RECOVERY_ADVANCED_FILTER_FIELD_CLASS}+ >+ <option value="all">+ {getRecoveryLocationFacetAllLabel('namespace')}+ </option>+ <For+ each={props.namespaceOptions().filter((value) => value !== 'all')}+ >+ {(namespace) => <option value={namespace}>{namespace}</option>}+ </For>+ </select>+ </label>+ </Show></div></FilterToolbarPanel></Show>@@ -383,9 +363,19 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (pshowFilters={!props.isMobile || historyFiltersOpen()}toolbarClass="lg:flex-nowrap">- <Show when={!props.isMobile && props.hasFocusedRollup()}>- {focusedRollupFilter()}- </Show>+ <RecoveryHistoryItemFilter+ options={props.historyItemOptions}+ selectedRollupId={props.rollupId}+ selectedLabel={props.selectedHistoryItemLabel}+ onSelect={(value) => {+ props.setRollupId(value);+ props.setCurrentPage(1);+ }}+ onClear={() => {+ props.setRollupId('');+ props.setCurrentPage(1);+ }}+ /><LabeledFilterSelectid="recovery-item-type-filter-history"diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsxindex 3ff1c46815..ccfeab131a 100644--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx@@ -749,12 +749,8 @@ describe('Recovery', () => {});const controls = await screen.findByRole('group', { name: /recovery events controls/i });- const focusedFilter = within(controls).getByTestId('recovery-history-focused-filter');- expect(focusedFilter).toHaveTextContent('Focused Item');- expect(focusedFilter).toHaveTextContent('VM 123');- expect(- within(controls).getByRole('button', { name: /clear focused item filter/i }),- ).toBeInTheDocument();+ const itemFilterTrigger = within(controls).getByTestId('recovery-history-item-filter-trigger');+ expect(itemFilterTrigger).toHaveTextContent('VM 123');await screen.findByText(/Showing 1 - 1 of 1 recovery points/i);const tables = await screen.findAllByRole('table');const table = tables[tables.length - 1];@@ -886,17 +882,70 @@ describe('Recovery', () => {await screen.findByText(/Showing 1 - 1 of 1 recovery points/i);const controls = await screen.findByRole('group', { name: /recovery events controls/i });- expect(within(controls).getByTestId('recovery-history-focused-filter')).toBeInTheDocument();+ expect(within(controls).getByTestId('recovery-history-item-filter-trigger')).toHaveTextContent(+ 'VM 123',+ );fireEvent.click(within(controls).getByRole('button', { name: 'Reset all' }));await waitFor(() => {- expect(navigateSpy).toHaveBeenCalledWith('/recovery?view=events', ROUTE_STATE_REPLACE_OPTIONS);- expect(screen.queryByTestId('recovery-history-focused-filter')).not.toBeInTheDocument();+ expect(navigateSpy).toHaveBeenCalledWith(+ '/recovery?view=events',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ expect(screen.getByTestId('recovery-history-item-filter-trigger')).toHaveTextContent(+ 'Any Item',+ );expect(screen.queryByRole('button', { name: 'Reset all' })).not.toBeInTheDocument();});});+ it('lets operators create and clear the item filter from the recovery events controls', async () => {+ render(() => <Recovery />);++ fireEvent.click(screen.getByRole('tab', { name: /recovery events/i }));++ await waitFor(() => {+ expect(navigateSpy).toHaveBeenCalledWith(+ '/recovery?view=events',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ });++ const controls = await screen.findByRole('group', { name: /recovery events controls/i });+ const itemFilterTrigger = within(controls).getByTestId('recovery-history-item-filter-trigger');+ expect(itemFilterTrigger).toHaveTextContent('Any Item');++ fireEvent.click(itemFilterTrigger);+ expect(await screen.findByTestId('recovery-history-item-filter-panel')).toBeInTheDocument();++ fireEvent.click(screen.getByTestId('recovery-history-item-filter-option-ext:truenas-1'));++ await waitFor(() => {+ expect(navigateSpy).toHaveBeenCalledWith(+ '/recovery?rollupId=ext%3Atruenas-1',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ });++ expect(screen.getByTestId('recovery-history-item-filter-trigger')).toHaveTextContent(+ 'tank/apps',+ );++ fireEvent.click(screen.getByTestId('recovery-history-item-filter-trigger'));+ fireEvent.click(await screen.findByTestId('recovery-history-item-filter-clear'));++ await waitFor(() => {+ expect(navigateSpy).toHaveBeenCalledWith(+ '/recovery?view=events',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ expect(screen.getByTestId('recovery-history-item-filter-trigger')).toHaveTextContent(+ 'Any Item',+ );+ });+ });+it('keeps recovery filter surfaces on canonical platform vocabulary', async () => {render(() => <Recovery />);diff --git a/tests/integration/tests/17-recovery-layout.spec.ts b/tests/integration/tests/17-recovery-layout.spec.tsindex 694cbba91c..8067b61dae 100644--- a/tests/integration/tests/17-recovery-layout.spec.ts+++ b/tests/integration/tests/17-recovery-layout.spec.ts@@ -1,30 +1,30 @@-import { expect, test, type Page } from '@playwright/test';+import { expect, test, type Page } from "@playwright/test";-import { ensureAuthenticated } from './helpers';+import { ensureAuthenticated } from "./helpers";const DESKTOP_VIEWPORT = { width: 1280, height: 900 };-const RECOVERY_SUBJECT_LABEL = 'Archive VM For Production Ledger Services';+const RECOVERY_SUBJECT_LABEL = "Archive VM For Production Ledger Services";const mockRecoveryData = {rollups: {data: [{- rollupId: 'res:vm-archive-01',- subjectResourceId: 'vm-archive-01',+ rollupId: "res:vm-archive-01",+ subjectResourceId: "vm-archive-01",subjectRef: {- type: 'proxmox-vm',- namespace: 'prod',- name: 'archive-ledger',- id: 'vm-archive-01',- class: 'cluster-a',+ type: "proxmox-vm",+ namespace: "prod",+ name: "archive-ledger",+ id: "vm-archive-01",+ class: "cluster-a",},display: {subjectLabel: RECOVERY_SUBJECT_LABEL,},- lastAttemptAt: '2026-03-24T04:03:04Z',- lastSuccessAt: '2026-03-24T04:03:04Z',- lastOutcome: 'success',- providers: ['proxmox-pbs'],+ lastAttemptAt: "2026-03-24T04:03:04Z",+ lastSuccessAt: "2026-03-24T04:03:04Z",+ lastOutcome: "success",+ providers: ["proxmox-pbs"],},],meta: { page: 1, limit: 500, total: 1, totalPages: 1 },@@ -32,40 +32,42 @@ const mockRecoveryData = {points: {data: [{- id: 'pbs-backup:archive-ledger-01',- provider: 'proxmox-pbs',- kind: 'backup',- mode: 'remote',- outcome: 'success',- startedAt: '2026-03-24T04:02:12Z',- completedAt: '2026-03-24T04:03:04Z',+ id: "pbs-backup:archive-ledger-01",+ provider: "proxmox-pbs",+ kind: "backup",+ mode: "remote",+ outcome: "success",+ startedAt: "2026-03-24T04:02:12Z",+ completedAt: "2026-03-24T04:03:04Z",sizeBytes: 30546730222,verified: true,immutable: false,encrypted: true,- entityId: '201',- subjectResourceId: 'vm-archive-01',+ entityId: "201",+ subjectResourceId: "vm-archive-01",subjectRef: {- type: 'proxmox-vm',- namespace: 'prod',- name: 'archive-ledger',- id: 'vm-archive-01',- class: 'cluster-a',+ type: "proxmox-vm",+ namespace: "prod",+ name: "archive-ledger",+ id: "vm-archive-01",+ class: "cluster-a",},repositoryRef: {- type: 'proxmox-pbs-datastore',- namespace: 'pbs-prod',- name: 'vault-main',- class: 'cluster-a',+ type: "proxmox-pbs-datastore",+ namespace: "pbs-prod",+ name: "vault-main",+ class: "cluster-a",},details: {- summary: 'Nightly immutable backup retained for compliance validation.',+ summary:+ "Nightly immutable backup retained for compliance validation.",},display: {subjectLabel: RECOVERY_SUBJECT_LABEL,- subjectType: 'proxmox-vm',- repositoryLabel: 'pbs-prod/vault-main',- detailsSummary: 'Nightly immutable backup retained for compliance validation.',+ subjectType: "proxmox-vm",+ repositoryLabel: "pbs-prod/vault-main",+ detailsSummary:+ "Nightly immutable backup retained for compliance validation.",},},],@@ -82,73 +84,82 @@ const mockRecoveryData = {},},series: {- data: [{ day: '2026-03-24', total: 1, snapshot: 0, local: 0, remote: 1 }],+ data: [{ day: "2026-03-24", total: 1, snapshot: 0, local: 0, remote: 1 }],},};async function mockRecoveryEndpoints(page: Page): Promise<void> {- await page.route('**/api/recovery/rollups*', async (route) => {+ await page.route("**/api/recovery/rollups*", async (route) => {await route.fulfill({status: 200,- contentType: 'application/json',+ contentType: "application/json",body: JSON.stringify(mockRecoveryData.rollups),});});- await page.route('**/api/recovery/points*', async (route) => {+ await page.route("**/api/recovery/points*", async (route) => {await route.fulfill({status: 200,- contentType: 'application/json',+ contentType: "application/json",body: JSON.stringify(mockRecoveryData.points),});});- await page.route('**/api/recovery/facets*', async (route) => {+ await page.route("**/api/recovery/facets*", async (route) => {await route.fulfill({status: 200,- contentType: 'application/json',+ contentType: "application/json",body: JSON.stringify(mockRecoveryData.facets),});});- await page.route('**/api/recovery/series*', async (route) => {+ await page.route("**/api/recovery/series*", async (route) => {await route.fulfill({status: 200,- contentType: 'application/json',+ contentType: "application/json",body: JSON.stringify(mockRecoveryData.series),});});}-test.describe('Recovery desktop layout guards', () => {- test('history table keeps outcome visible within the desktop wrapper', async ({+test.describe("Recovery desktop layout guards", () => {+ test("history table keeps outcome visible within the desktop wrapper", async ({page,}, testInfo) => {- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only recovery layout coverage');+ test.skip(+ testInfo.project.name.startsWith("mobile-"),+ "Desktop-only recovery layout coverage",+ );await page.setViewportSize(DESKTOP_VIEWPORT);await ensureAuthenticated(page);await mockRecoveryEndpoints(page);- await page.goto('/recovery', { waitUntil: 'domcontentloaded' });- await expect(page.getByTestId('recovery-page')).toBeVisible();+ await page.goto("/recovery", { waitUntil: "domcontentloaded" });+ await expect(page.getByTestId("recovery-page")).toBeVisible();- const protectedRow = page.locator('[data-testid="recovery-page"] table tbody tr').first();+ const protectedRow = page+ .locator('[data-testid="recovery-page"] table tbody tr')+ .first();await expect(protectedRow).toBeVisible();await protectedRow.click();- await expect(page.getByText('Focused', { exact: true })).toBeVisible();- await expect(page.getByText(/Showing 1 - 1 of 1 recovery points/i)).toBeVisible();+ await expect(+ page.getByTestId("recovery-history-item-filter-trigger"),+ ).toContainText(RECOVERY_SUBJECT_LABEL);+ await expect(+ page.getByText(/Showing 1 - 1 of 1 recovery points/i),+ ).toBeVisible();const historyWrapper = page.locator('[data-testid="recovery-page"] div.overflow-x-auto')- .filter({ has: page.locator('table') })+ .filter({ has: page.locator("table") }).last();await expect(historyWrapper).toBeVisible();const overflowMetrics = await historyWrapper.evaluate((el) => {const wrapper = el as HTMLElement;- const table = wrapper.querySelector('table') as HTMLElement | null;+ const table = wrapper.querySelector("table") as HTMLElement | null;const style = window.getComputedStyle(wrapper);return {overflowX: style.overflowX,@@ -158,24 +169,29 @@ test.describe('Recovery desktop layout guards', () => {};});- expect(['auto', 'scroll']).toContain(overflowMetrics.overflowX);+ expect(["auto", "scroll"]).toContain(overflowMetrics.overflowX);expect(overflowMetrics.wrapperScrollWidth,`Recovery history wrapper should fit the default desktop column set without horizontal scrolling (wrapper=${overflowMetrics.wrapperClientWidth}, table=${overflowMetrics.tableScrollWidth})`,).toBeLessThanOrEqual(overflowMetrics.wrapperClientWidth + 1);- const outcomeHeader = historyWrapper.locator('th').filter({ hasText: /^Outcome$/ }).first();+ const outcomeHeader = historyWrapper+ .locator("th")+ .filter({ hasText: /^Outcome$/ })+ .first();await expect(outcomeHeader).toBeVisible();const wrapperBox = await historyWrapper.boundingBox();const outcomeBox = await outcomeHeader.boundingBox();- expect(wrapperBox, 'Expected recovery history wrapper bounds').toBeTruthy();- expect(outcomeBox, 'Expected outcome column header bounds').toBeTruthy();+ expect(wrapperBox, "Expected recovery history wrapper bounds").toBeTruthy();+ expect(outcomeBox, "Expected outcome column header bounds").toBeTruthy();- const wrapperRight = (wrapperBox as { x: number; width: number }).x ++ const wrapperRight =+ (wrapperBox as { x: number; width: number }).x +(wrapperBox as { width: number }).width;- const outcomeRight = (outcomeBox as { x: number; width: number }).x ++ const outcomeRight =+ (outcomeBox as { x: number; width: number }).x +(outcomeBox as { width: number }).width;expect(outcomeRight,diff --git a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts b/tests/integration/tests/47-inline-selection-scroll-stability.spec.tsnew file mode 100644index 0000000000..4c25367dbc--- /dev/null+++ b/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts@@ -0,0 +1,195 @@+import fs from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";+import {+ expect,+ test as base,+ type Locator,+ type Page,+} from "@playwright/test";++import {+ apiRequest,+ createAuthenticatedStorageState,+ getMockMode,+ setMockMode,+} from "./helpers";++const __dirname = path.dirname(fileURLToPath(import.meta.url));++type WorkerFixtures = {+ authStorageStatePath: string;+};++type ResourceSummary = {+ name?: string;+};++let mockModeWasEnabled: boolean | null = null;++const test = base.extend<{}, WorkerFixtures>({+ storageState: async ({ authStorageStatePath }, use) => {+ await use(authStorageStatePath);+ },+ authStorageStatePath: [+ async ({ browser }, use, workerInfo) => {+ const storageStatePath = path.resolve(+ __dirname,+ "..",+ "..",+ "tmp",+ "playwright-auth",+ `inline-selection-scroll-stability-${workerInfo.project.name}.json`,+ );+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });+ await createAuthenticatedStorageState(browser, storageStatePath);+ try {+ await use(storageStatePath);+ } finally {+ fs.rmSync(storageStatePath, { force: true });+ }+ },+ { scope: "worker" },+ ],+});++async function ensureMockModeEnabled(page: Page): Promise<void> {+ const state = await getMockMode(page);+ if (mockModeWasEnabled === null) {+ mockModeWasEnabled = state.enabled;+ }+ if (!state.enabled) {+ await setMockMode(page, true);+ }+}++async function fetchMockInfrastructureResourceName(+ page: Page,+): Promise<string> {+ const response = await apiRequest(+ page,+ "/api/resources?source=proxmox&limit=200&type=agent",+ );+ expect(response.ok()).toBeTruthy();+ const payload = (await response.json()) as { data?: ResourceSummary[] };+ const resources = Array.isArray(payload.data) ? payload.data : [];+ const chosen = resources.find((resource) => resource.name?.trim());+ if (!chosen?.name?.trim()) {+ throw new Error(+ "Expected at least one Proxmox mock infrastructure resource",+ );+ }+ return chosen.name.trim();+}++async function scrollSectionIntoView(+ page: Page,+ locator: Locator,+ offset = 180,+): Promise<number> {+ const top = await locator.evaluate(+ (element, sectionOffset) =>+ Math.max(+ 0,+ window.scrollY + element.getBoundingClientRect().top - sectionOffset,+ ),+ offset,+ );+ await page.evaluate((nextTop) => window.scrollTo(0, nextTop), top);+ await page.waitForTimeout(150);+ return page.evaluate(() => window.scrollY);+}++test.describe.serial("Inline selection scroll stability", () => {+ test.setTimeout(180_000);++ test.afterAll(async ({ browser }) => {+ if (mockModeWasEnabled === null) return;++ const context = await browser.newContext();+ const page = await context.newPage();+ try {+ const current = await getMockMode(page);+ if (current.enabled !== mockModeWasEnabled) {+ await setMockMode(page, mockModeWasEnabled);+ }+ } finally {+ await context.close();+ }+ });++ test("keeps the infrastructure viewport stable when opening an inline resource drawer", async ({+ page,+ }, testInfo) => {+ test.skip(+ testInfo.project.name.startsWith("mobile-"),+ "Desktop-only drawer stability proof",+ );++ await ensureMockModeEnabled(page);+ const resourceName = await fetchMockInfrastructureResourceName(page);++ await page.goto("/infrastructure?source=proxmox-pve", {+ waitUntil: "domcontentloaded",+ });+ await expect(page.getByTestId("infrastructure-page")).toBeVisible();++ const table = page+ .locator('[data-testid="infrastructure-page"] table')+ .first();+ const beforeScroll = await scrollSectionIntoView(page, table);+ expect(beforeScroll).toBeGreaterThan(10);++ const row = table+ .locator("tbody tr")+ .filter({ hasText: resourceName })+ .first();+ await expect(row).toBeVisible();+ await row.click();++ await expect(page).toHaveURL(+ /\/infrastructure\?source=proxmox-pve&resource=/,+ );+ await expect(+ page.getByRole("button", { name: /show access|hide access/i }),+ ).toBeVisible();++ const afterScroll = await page.evaluate(() => window.scrollY);+ expect(afterScroll).toBeGreaterThanOrEqual(Math.max(10, beforeScroll - 60));+ });++ test("keeps the recovery viewport stable when selecting a protected item", async ({+ page,+ }, testInfo) => {+ test.skip(+ testInfo.project.name.startsWith("mobile-"),+ "Desktop-only recovery interaction proof",+ );++ await ensureMockModeEnabled(page);++ await page.goto("/recovery", { waitUntil: "domcontentloaded" });+ await expect(page.getByTestId("recovery-page")).toBeVisible();++ const protectedItemsTable = page+ .locator('[data-testid="recovery-page"] table')+ .first();+ const beforeScroll = await scrollSectionIntoView(page, protectedItemsTable);+ expect(beforeScroll).toBeGreaterThan(10);++ const row = protectedItemsTable.locator("tbody tr").first();+ await expect(row).toBeVisible();+ await row.click();++ await expect(page).toHaveURL(/\/recovery\?rollupId=/);+ await expect(+ page.getByRole("tab", { name: /recovery events/i }),+ ).toHaveAttribute("aria-selected", "true");+ await expect(+ page.getByTestId("recovery-history-item-filter-trigger"),+ ).not.toContainText("Any Item");++ const afterScroll = await page.evaluate(() => window.scrollY);+ expect(afterScroll).toBeGreaterThanOrEqual(Math.max(10, beforeScroll - 60));+ });+});