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): split workspace controls from content

rcourtman7c0dca001a44
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 1ae10cd925..3b79788496 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -815,11 +815,10 @@ of those separators and local duplicate row or header borders that make the
lines read heavier than other monitoring tables.
That same workspace-shell rule should also avoid a dedicated recovery-only
status strip above the control bar. Recovery should use the same handoff shape
-as storage: one canonical workspace card per active view, with the shared
-`Subtabs.tsx` row rendered at the top of that card before the workspace's
-controls and data, instead of splitting the same recovery workspace into
-stacked tabs, controls, and data cards or burying the switcher inside the
-filter row.
+as storage: a standalone shared `Subtabs.tsx` row, then any workspace-specific
+context like activity, then a shared controls card, then a data card. Recovery
+should not collapse controls and content back into one fused workspace slab or
+bury the switcher inside the filter row.
That same strip should not repeat page-level counts or posture cues once the
summary already owns those signals. The recovery workspace tabs should stay on
plain canonical labels like `Protected items` and `Recovery events` rather than
@@ -832,10 +831,10 @@ shared `Subtabs.tsx` shell, list, and button class pattern already used by
storage and other established Pulse tab surfaces instead of inventing a
recovery-only variant or recovery-only class stack.
That same workspace rule also means the protected-items versus recovery-events
-switcher should live at the top of the active workspace card, ahead of the
-embedded controls and table shell, so the page hands off from summary into one
-contained workspace the same way storage does rather than stepping through
-multiple recovery-only card layers.
+switcher should live in its own standalone row above the active workspace,
+ahead of activity, controls, and data, so the page hands off from summary into
+the active recovery surface the same way storage does rather than fusing the
+entire workspace into one recovery-only card.
That same canonical-row rule also means the subtabs row should stand on its own
full-width shell instead of sharing a flex line with recovery-only chips or
adjacent badges that break the storage-style border and spacing treatment.
@@ -864,9 +863,9 @@ controls denser and wider than storage for the same amount of operator input.
That same events-workspace rule should keep the activity strip as orientation
for the event list rather than burying it at the bottom. The events workspace
should move from the subtabs row to `RecoveryActivitySection.tsx`, then shared
-controls, then the recovery history table, all inside the same workspace card,
-so the timeline frames the event list without turning the page back into
-stacked primary tables.
+controls, then the recovery history table as sibling sections, so the timeline
+frames the event list without turning the page back into stacked primary
+tables or embedding the activity strip inside the history card.
That same events-shell contract should avoid repeating page-state bookkeeping
ahead of the history grid. Recovery events should keep the toolbar utility area
focused on actual controls like advanced filters and column visibility instead
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index 384368dc00..3029774c2d 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -539,7 +539,6 @@ const Recovery: Component = () => {
setSelectedDateKey((previous) => (previous === key ? null : key));
setCurrentPage(1);
}}
- embedded
/>
);
@@ -588,9 +587,10 @@ const Recovery: Component = () => {
</Show>
<Show when={workspaceView() === 'events'}>
+ {eventsActivity()}
+
<Show when={!recoveryPoints.response.loading && recoveryPoints.response.error}>
<Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
- <div class="border-b border-border-subtle">{eventsActivity()}</div>
<div class="p-6">
<EmptyState
title={getRecoveryPointsFailureState().title}
@@ -650,7 +650,6 @@ const Recovery: Component = () => {
tableMinWidth={tableMinWidth}
totalPages={totalPages}
verificationFilter={verificationFilter}
- workspaceIntro={eventsActivity()}
/>
</Show>
</Show>
diff --git a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
index d39fad6259..91fc36cf95 100644
--- a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
@@ -76,7 +76,6 @@ interface RecoveryActivitySectionProps {
setChartRangeDays: (value: 7 | 30 | 90 | 365) => void;
toggleSelectedDate: (key: string) => void;
timeline: Accessor<TimelineModel>;
- embedded?: boolean;
}
const rangeOptions: Array<7 | 30 | 90 | 365> = [7, 30, 90, 365];
@@ -413,13 +412,8 @@ function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JS
);
}
-export const RecoveryActivitySection: Component<RecoveryActivitySectionProps> = (props) =>
- props.embedded ? (
- <div class="px-4 py-3 sm:px-5">
- <RecoveryActivitySectionContent {...props} />
- </div>
- ) : (
- <Card padding="sm" class="h-full border-border-subtle bg-surface">
- <RecoveryActivitySectionContent {...props} />
- </Card>
- );
+export const RecoveryActivitySection: Component<RecoveryActivitySectionProps> = (props) => (
+ <Card padding="sm" class="h-full border-border-subtle bg-surface">
+ <RecoveryActivitySectionContent {...props} />
+ </Card>
+);
diff --git a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
index fc6eca21c7..717cfd2461 100644
--- a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
@@ -1,5 +1,5 @@
import { For, Show } from 'solid-js';
-import type { Accessor, Component, JSX } from 'solid-js';
+import type { Accessor, Component } from 'solid-js';
import { Card } from '@/components/shared/Card';
import {
@@ -99,8 +99,6 @@ interface RecoveryHistorySectionProps {
tableMinWidth: Accessor<string>;
totalPages: Accessor<number>;
verificationFilter: Accessor<VerificationFilter>;
- workspaceControls?: JSX.Element;
- workspaceIntro?: JSX.Element;
}
export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (props) => {
@@ -130,80 +128,75 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
});
return (
- <Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
- <Show when={props.workspaceControls}>{props.workspaceControls}</Show>
-
- <Show when={props.workspaceIntro}>
- <div class="border-b border-border-subtle">{props.workspaceIntro}</div>
- </Show>
-
+ <div class="flex flex-col gap-2">
<Show when={!props.kioskMode}>
- <div class="border-b border-border-subtle px-4 py-3 sm:px-5">
- <PageControls
- role="group"
- aria-label="Recovery events controls"
- search={
- <SearchInput
- value={props.queryFilter}
- onChange={(value) => {
- props.setQueryFilter(value);
- props.setCurrentPage(1);
- }}
- placeholder={getRecoveryHistorySearchPlaceholder()}
- inputClass="py-2 text-sm"
- clearOnEscape
- history={{
- storageKey: STORAGE_KEYS.RECOVERY_SEARCH_HISTORY,
- emptyMessage: getRecoverySearchHistoryEmptyMessage(),
- }}
- />
- }
- mobileFilters={{
- enabled: props.isMobile,
- onToggle: () => setHistoryFiltersOpen((open) => !open),
- count: historyActiveFilterCount(),
- }}
- utilityActions={
- <div class="ml-auto flex items-center gap-2">
- <div class="relative">
- <FilterActionButton
- ref={advancedFiltersButtonRef}
- aria-label="Filter"
- aria-expanded={moreFiltersOpen()}
- aria-controls="recovery-filter-panel"
- aria-haspopup="dialog"
- onClick={() => setMoreFiltersOpen((open) => !open)}
- active={moreFiltersOpen() || props.activeAdvancedFilterCount() > 0}
- >
- <span>Filter</span>
- <Show when={props.activeAdvancedFilterCount() > 0}>
- <span class={filterUtilityBadgeClass}>
- {props.activeAdvancedFilterCount()}
- </span>
- </Show>
- </FilterActionButton>
+ <Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
+ <div class="px-4 py-3 sm:px-5">
+ <PageControls
+ role="group"
+ aria-label="Recovery events controls"
+ search={
+ <SearchInput
+ value={props.queryFilter}
+ onChange={(value) => {
+ props.setQueryFilter(value);
+ props.setCurrentPage(1);
+ }}
+ placeholder={getRecoveryHistorySearchPlaceholder()}
+ inputClass="py-2 text-sm"
+ clearOnEscape
+ history={{
+ storageKey: STORAGE_KEYS.RECOVERY_SEARCH_HISTORY,
+ emptyMessage: getRecoverySearchHistoryEmptyMessage(),
+ }}
+ />
+ }
+ mobileFilters={{
+ enabled: props.isMobile,
+ onToggle: () => setHistoryFiltersOpen((open) => !open),
+ count: historyActiveFilterCount(),
+ }}
+ utilityActions={
+ <div class="ml-auto flex items-center gap-2">
+ <div class="relative">
+ <FilterActionButton
+ ref={advancedFiltersButtonRef}
+ aria-label="Filter"
+ aria-expanded={moreFiltersOpen()}
+ aria-controls="recovery-filter-panel"
+ aria-haspopup="dialog"
+ onClick={() => setMoreFiltersOpen((open) => !open)}
+ active={moreFiltersOpen() || props.activeAdvancedFilterCount() > 0}
+ >
+ <span>Filter</span>
+ <Show when={props.activeAdvancedFilterCount() > 0}>
+ <span class={filterUtilityBadgeClass}>
+ {props.activeAdvancedFilterCount()}
+ </span>
+ </Show>
+ </FilterActionButton>
- <Show when={moreFiltersOpen()}>
- <FilterToolbarPanel ref={advancedFiltersPanelRef} id="recovery-filter-panel">
- <div class="mb-3 flex items-center justify-between gap-3">
- <div>
- <div class={filterPanelTitleClass}>Filter results</div>
- <div class={filterPanelDescriptionClass}>
- Narrow by scope, method, verification, or placement.
+ <Show when={moreFiltersOpen()}>
+ <FilterToolbarPanel ref={advancedFiltersPanelRef} id="recovery-filter-panel">
+ <div class="mb-3 flex items-center justify-between gap-3">
+ <div>
+ <div class={filterPanelTitleClass}>Filter results</div>
+ <div class={filterPanelDescriptionClass}>
+ Narrow by scope, method, verification, or placement.
+ </div>
</div>
+ <Show when={props.activeAdvancedFilterCount() > 0}>
+ <button
+ type="button"
+ onClick={props.resetAdvancedArtifactFilters}
+ class={getRecoveryFilterPanelClearClass()}
+ >
+ Clear filters
+ </button>
+ </Show>
</div>
- <Show when={props.activeAdvancedFilterCount() > 0}>
- <button
- type="button"
- onClick={props.resetAdvancedArtifactFilters}
- class={getRecoveryFilterPanelClearClass()}
- >
- Clear filters
- </button>
- </Show>
- </div>
- <div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
+ <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
@@ -338,105 +331,108 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
</select>
</label>
</Show>
- </div>
- </FilterToolbarPanel>
- </Show>
+ </div>
+ </FilterToolbarPanel>
+ </Show>
+ </div>
</div>
- </div>
- }
- columnVisibility={props.artifactColumnVisibility}
- resetAction={{
- show: props.hasActiveArtifactFilters(),
- onClick: props.resetAllArtifactFilters,
- label: 'Reset all',
- }}
- showFilters={!props.isMobile || historyFiltersOpen()}
- toolbarClass="lg:flex-nowrap"
- >
- <LabeledFilterSelect
- id="recovery-item-type-filter-history"
- label="Item type"
- value={props.itemTypeFilter()}
- onChange={(event) => {
- props.setItemTypeFilter(
- normalizeRecoveryItemTypeQueryValue(event.currentTarget.value) || 'all',
- );
- props.setCurrentPage(1);
+ }
+ columnVisibility={props.artifactColumnVisibility}
+ resetAction={{
+ show: props.hasActiveArtifactFilters(),
+ onClick: props.resetAllArtifactFilters,
+ label: 'Reset all',
}}
- selectClass="py-1 text-xs"
+ showFilters={!props.isMobile || historyFiltersOpen()}
+ toolbarClass="lg:flex-nowrap"
>
- <For each={props.itemTypeOptions()}>
- {(itemType) => (
- <option value={itemType}>
- {itemType === 'all'
- ? 'All Item Types'
- : getRecoveryItemTypePresentation(itemType)?.label || itemType}
- </option>
- )}
- </For>
- </LabeledFilterSelect>
+ <LabeledFilterSelect
+ id="recovery-item-type-filter-history"
+ label="Item type"
+ value={props.itemTypeFilter()}
+ onChange={(event) => {
+ props.setItemTypeFilter(
+ normalizeRecoveryItemTypeQueryValue(event.currentTarget.value) || 'all',
+ );
+ props.setCurrentPage(1);
+ }}
+ selectClass="py-1 text-xs"
+ >
+ <For each={props.itemTypeOptions()}>
+ {(itemType) => (
+ <option value={itemType}>
+ {itemType === 'all'
+ ? 'All Item Types'
+ : getRecoveryItemTypePresentation(itemType)?.label || itemType}
+ </option>
+ )}
+ </For>
+ </LabeledFilterSelect>
- <LabeledFilterSelect
- id="recovery-platform-filter-history"
- label="Platform"
- value={props.platformFilter()}
- onChange={(event) => {
- props.setPlatformFilter(
- normalizeSourcePlatformQueryValue(event.currentTarget.value),
- );
- props.setCurrentPage(1);
- }}
- selectClass="py-1 text-xs"
- >
- <For each={props.platformOptions()}>
- {(platform) => (
- <option value={platform}>
- {platform === 'all' ? 'All Platforms' : getSourcePlatformLabel(platform)}
- </option>
- )}
- </For>
- </LabeledFilterSelect>
+ <LabeledFilterSelect
+ id="recovery-platform-filter-history"
+ label="Platform"
+ value={props.platformFilter()}
+ onChange={(event) => {
+ props.setPlatformFilter(
+ normalizeSourcePlatformQueryValue(event.currentTarget.value),
+ );
+ props.setCurrentPage(1);
+ }}
+ selectClass="py-1 text-xs"
+ >
+ <For each={props.platformOptions()}>
+ {(platform) => (
+ <option value={platform}>
+ {platform === 'all' ? 'All Platforms' : getSourcePlatformLabel(platform)}
+ </option>
+ )}
+ </For>
+ </LabeledFilterSelect>
- <LabeledFilterSelect
- id="recovery-status-filter"
- label="Status"
- value={props.historyOutcomeFilter()}
- onChange={(event) => {
- const value = event.currentTarget.value as 'all' | RecoveryOutcome;
- props.setHistoryOutcomeFilter(value);
- if (value !== 'all') props.setVerificationFilter('all');
- props.setCurrentPage(1);
- }}
- selectClass="py-1 text-xs"
- >
- <For each={props.availableOutcomes}>
- {(outcome) => (
- <option value={outcome}>
- {outcome === 'all' ? 'Any status' : titleCaseDelimitedLabel(outcome)}
- </option>
- )}
- </For>
- </LabeledFilterSelect>
- </PageControls>
- </div>
+ <LabeledFilterSelect
+ id="recovery-status-filter"
+ label="Status"
+ value={props.historyOutcomeFilter()}
+ onChange={(event) => {
+ const value = event.currentTarget.value as 'all' | RecoveryOutcome;
+ props.setHistoryOutcomeFilter(value);
+ if (value !== 'all') props.setVerificationFilter('all');
+ props.setCurrentPage(1);
+ }}
+ selectClass="py-1 text-xs"
+ >
+ <For each={props.availableOutcomes}>
+ {(outcome) => (
+ <option value={outcome}>
+ {outcome === 'all' ? 'Any status' : titleCaseDelimitedLabel(outcome)}
+ </option>
+ )}
+ </For>
+ </LabeledFilterSelect>
+ </PageControls>
+ </div>
+ </Card>
</Show>
- <RecoveryHistoryTable
- clearSelectedPoint={clearSelectedPoint}
- currentPage={props.currentPage}
- groupedByDay={props.groupedByDay}
- hasActiveArtifactFilters={props.hasActiveArtifactFilters}
- mobileVisibleArtifactColumns={props.mobileVisibleArtifactColumns}
- recoveryPoints={props.recoveryPoints}
- resetAllArtifactFilters={props.resetAllArtifactFilters}
- resourcesById={props.resourcesById}
- selectedPoint={selectedPoint}
- setCurrentPage={props.setCurrentPage}
- tableColumnCount={props.tableColumnCount}
- tableMinWidth={props.tableMinWidth}
- toggleSelectedPoint={toggleSelectedPoint}
- totalPages={props.totalPages}
- />
- </Card>
+ <Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
+ <RecoveryHistoryTable
+ clearSelectedPoint={clearSelectedPoint}
+ currentPage={props.currentPage}
+ groupedByDay={props.groupedByDay}
+ hasActiveArtifactFilters={props.hasActiveArtifactFilters}
+ mobileVisibleArtifactColumns={props.mobileVisibleArtifactColumns}
+ recoveryPoints={props.recoveryPoints}
+ resetAllArtifactFilters={props.resetAllArtifactFilters}
+ resourcesById={props.resourcesById}
+ selectedPoint={selectedPoint}
+ setCurrentPage={props.setCurrentPage}
+ tableColumnCount={props.tableColumnCount}
+ tableMinWidth={props.tableMinWidth}
+ toggleSelectedPoint={toggleSelectedPoint}
+ totalPages={props.totalPages}
+ />
+ </Card>
+ </div>
);
};
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index 44bff36eba..e942eb5292 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -1,5 +1,5 @@
import { For, Show, createEffect, createMemo, createSignal } from 'solid-js';
-import type { Accessor, Component, JSX } from 'solid-js';
+import type { Accessor, Component } from 'solid-js';
import { Card } from '@/components/shared/Card';
import { EmptyState } from '@/components/shared/EmptyState';
@@ -84,7 +84,6 @@ interface RecoveryProtectedInventorySectionProps {
setVerificationFilter: (value: VerificationFilter) => void;
loading: Accessor<boolean>;
error: Accessor<unknown>;
- workspaceControls?: JSX.Element;
}
const availableOutcomes = ['all', 'success', 'warning', 'failed', 'running'] as const;
@@ -210,147 +209,144 @@ export const RecoveryProtectedInventorySection: Component<
};
return (
- <Card
- padding="none"
- tone="card"
- class="overflow-hidden border-border-subtle bg-surface"
- >
- <Show when={props.workspaceControls}>{props.workspaceControls}</Show>
-
+ <div class="flex flex-col gap-2">
<Show when={!props.kioskMode}>
- <div class="border-b border-border-subtle px-4 py-3 sm:px-5">
- <PageControls
- role="group"
- aria-label="Protected items controls"
- search={
- <SearchInput
- value={props.queryFilter}
- onChange={(value) => props.setQueryFilter(value)}
- placeholder={getRecoveryProtectedSearchPlaceholder()}
- inputClass="py-1.5 text-sm"
- clearOnEscape
- history={{
- storageKey: STORAGE_KEYS.RECOVERY_SEARCH_HISTORY,
- emptyMessage: getRecoverySearchHistoryEmptyMessage(),
- }}
- />
- }
- mobileFilters={{
- enabled: props.isMobile,
- onToggle: () => setProtectedFiltersOpen((open) => !open),
- count: protectedActiveFilterCount(),
- }}
- resetAction={{
- show: protectedActiveFilterCount() > 0,
- onClick: resetProtectedFilters,
- label: 'Reset all',
- title: 'Reset protected item filters',
- }}
- showFilters={!props.isMobile || protectedFiltersOpen()}
- toolbarClass="gap-3 lg:flex-nowrap"
- >
- <LabeledFilterSelect
- id="recovery-item-type-filter"
- label="Item Type"
- value={props.itemTypeFilter()}
- onChange={(event) =>
- props.setItemTypeFilter(
- normalizeRecoveryItemTypeQueryValue(event.currentTarget.value) || 'all',
- )
- }
- groupClass="gap-1.5 px-1.5 py-0.5"
- selectClass="py-1 text-xs"
- >
- <For each={props.itemTypeOptions()}>
- {(itemType) => (
- <option value={itemType}>
- {itemType === 'all'
- ? 'All Item Types'
- : getRecoveryItemTypePresentation(itemType)?.label || itemType}
- </option>
- )}
- </For>
- </LabeledFilterSelect>
-
- <LabeledFilterSelect
- id="recovery-platform-filter"
- label="Platform"
- value={props.platformFilter()}
- onChange={(event) =>
- props.setPlatformFilter(
- normalizeSourcePlatformQueryValue(event.currentTarget.value),
- )
+ <Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
+ <div class="px-4 py-3 sm:px-5">
+ <PageControls
+ role="group"
+ aria-label="Protected items controls"
+ search={
+ <SearchInput
+ value={props.queryFilter}
+ onChange={(value) => props.setQueryFilter(value)}
+ placeholder={getRecoveryProtectedSearchPlaceholder()}
+ inputClass="py-1.5 text-sm"
+ clearOnEscape
+ history={{
+ storageKey: STORAGE_KEYS.RECOVERY_SEARCH_HISTORY,
+ emptyMessage: getRecoverySearchHistoryEmptyMessage(),
+ }}
+ />
}
- groupClass="gap-1.5 px-1.5 py-0.5"
- selectClass="py-1 text-xs"
- >
- <For each={props.platformOptions()}>
- {(platform) => (
- <option value={platform}>
- {platform === 'all' ? 'All Platforms' : getSourcePlatformLabel(platform)}
- </option>
- )}
- </For>
- </LabeledFilterSelect>
-
- <LabeledFilterSelect
- id="recovery-protected-status-filter"
- label="Latest status"
- value={props.historyOutcomeFilter()}
- onChange={(event) => {
- const value = event.currentTarget.value as 'all' | RecoveryOutcome;
- props.setHistoryOutcomeFilter(value);
- if (value !== 'all') props.setVerificationFilter('all');
+ mobileFilters={{
+ enabled: props.isMobile,
+ onToggle: () => setProtectedFiltersOpen((open) => !open),
+ count: protectedActiveFilterCount(),
}}
- groupClass="gap-1.5 px-1.5 py-0.5"
- selectClass="py-1 text-xs"
- >
- <For each={availableOutcomes}>
- {(outcome) => (
- <option value={outcome}>
- {outcome === 'all' ? 'Any status' : titleCaseDelimitedLabel(outcome)}
- </option>
- )}
- </For>
- </LabeledFilterSelect>
-
- <button
- type="button"
- aria-pressed={props.protectedStaleOnly()}
- onClick={() => props.setProtectedStaleOnly((value) => !value)}
- class={`rounded-md border px-2.5 py-1 text-xs font-medium transition-colors ${getRecoveryProtectedToggleClass(
- props.protectedStaleOnly(),
- )}`}
+ resetAction={{
+ show: protectedActiveFilterCount() > 0,
+ onClick: resetProtectedFilters,
+ label: 'Reset all',
+ title: 'Reset protected item filters',
+ }}
+ showFilters={!props.isMobile || protectedFiltersOpen()}
+ toolbarClass="gap-3 lg:flex-nowrap"
>
- Stale only
- </button>
- </PageControls>
- </div>
- </Show>
-
- <Show when={props.loading() && props.filteredRollups().length === 0}>
- <div class="px-6 py-6 text-sm text-muted">
- {getRecoveryProtectedItemsLoadingState().text}
- </div>
+ <LabeledFilterSelect
+ id="recovery-item-type-filter"
+ label="Item Type"
+ value={props.itemTypeFilter()}
+ onChange={(event) =>
+ props.setItemTypeFilter(
+ normalizeRecoveryItemTypeQueryValue(event.currentTarget.value) || 'all',
+ )
+ }
+ groupClass="gap-1.5 px-1.5 py-0.5"
+ selectClass="py-1 text-xs"
+ >
+ <For each={props.itemTypeOptions()}>
+ {(itemType) => (
+ <option value={itemType}>
+ {itemType === 'all'
+ ? 'All Item Types'
+ : getRecoveryItemTypePresentation(itemType)?.label || itemType}
+ </option>
+ )}
+ </For>
+ </LabeledFilterSelect>
+
+ <LabeledFilterSelect
+ id="recovery-platform-filter"
+ label="Platform"
+ value={props.platformFilter()}
+ onChange={(event) =>
+ props.setPlatformFilter(
+ normalizeSourcePlatformQueryValue(event.currentTarget.value),
+ )
+ }
+ groupClass="gap-1.5 px-1.5 py-0.5"
+ selectClass="py-1 text-xs"
+ >
+ <For each={props.platformOptions()}>
+ {(platform) => (
+ <option value={platform}>
+ {platform === 'all' ? 'All Platforms' : getSourcePlatformLabel(platform)}
+ </option>
+ )}
+ </For>
+ </LabeledFilterSelect>
+
+ <LabeledFilterSelect
+ id="recovery-protected-status-filter"
+ label="Latest status"
+ value={props.historyOutcomeFilter()}
+ onChange={(event) => {
+ const value = event.currentTarget.value as 'all' | RecoveryOutcome;
+ props.setHistoryOutcomeFilter(value);
+ if (value !== 'all') props.setVerificationFilter('all');
+ }}
+ groupClass="gap-1.5 px-1.5 py-0.5"
+ selectClass="py-1 text-xs"
+ >
+ <For each={availableOutcomes}>
+ {(outcome) => (
+ <option value={outcome}>
+ {outcome === 'all' ? 'Any status' : titleCaseDelimitedLabel(outcome)}
+ </option>
+ )}
+ </For>
+ </LabeledFilterSelect>
+
+ <button
+ type="button"
+ aria-pressed={props.protectedStaleOnly()}
+ onClick={() => props.setProtectedStaleOnly((value) => !value)}
+ class={`rounded-md border px-2.5 py-1 text-xs font-medium transition-colors ${getRecoveryProtectedToggleClass(
+ props.protectedStaleOnly(),
+ )}`}
+ >
+ Stale only
+ </button>
+ </PageControls>
+ </div>
+ </Card>
</Show>
- <Show when={!props.loading() && props.error()}>
- <div class="p-6">
- <EmptyState
- title={getRecoveryProtectedItemsFailureState().title}
- description={String((props.error() as Error)?.message || props.error())}
- />
- </div>
- </Show>
+ <Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
+ <Show when={props.loading() && props.filteredRollups().length === 0}>
+ <div class="px-6 py-6 text-sm text-muted">
+ {getRecoveryProtectedItemsLoadingState().text}
+ </div>
+ </Show>
+
+ <Show when={!props.loading() && props.error()}>
+ <div class="p-6">
+ <EmptyState
+ title={getRecoveryProtectedItemsFailureState().title}
+ description={String((props.error() as Error)?.message || props.error())}
+ />
+ </div>
+ </Show>
- <Show when={!props.loading() && !props.error() && props.filteredRollups().length === 0}>
- <div class="p-6">
- <EmptyState {...getRecoveryProtectedItemsEmptyState()} />
- </div>
- </Show>
+ <Show when={!props.loading() && !props.error() && props.filteredRollups().length === 0}>
+ <div class="p-6">
+ <EmptyState {...getRecoveryProtectedItemsEmptyState()} />
+ </div>
+ </Show>
- <Show when={props.filteredRollups().length > 0}>
- <div class="overflow-x-auto bg-surface">
+ <Show when={props.filteredRollups().length > 0}>
+ <div class="overflow-x-auto bg-surface">
<Table
class="w-full border-collapse whitespace-nowrap"
style={{ 'table-layout': 'fixed', 'min-width': props.isMobile ? '100%' : '640px' }}
@@ -586,7 +582,8 @@ export const RecoveryProtectedInventorySection: Component<
</button>
</div>
</div>
- </Show>
- </Card>
+ </Show>
+ </Card>
+ </div>
);
};
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx
index 260c569608..1bb3b276af 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.layout-guards.test.tsx
@@ -27,12 +27,7 @@ vi.mock('@/hooks/useColumnVisibility', () => ({
}));
vi.mock('@/components/Recovery/RecoveryProtectedInventorySection', () => ({
- RecoveryProtectedInventorySection: (props: { workspaceControls?: any }) => (
- <div>
- {props.workspaceControls}
- <div data-testid="protected-inventory" />
- </div>
- ),
+ RecoveryProtectedInventorySection: () => <div data-testid="protected-inventory" />,
}));
vi.mock('@/components/Recovery/RecoveryActivitySection', () => ({
@@ -40,13 +35,7 @@ vi.mock('@/components/Recovery/RecoveryActivitySection', () => ({
}));
vi.mock('@/components/Recovery/RecoveryHistorySection', () => ({
- RecoveryHistorySection: (props: { workspaceControls?: any; workspaceIntro?: any }) => (
- <div>
- {props.workspaceControls}
- {props.workspaceIntro}
- <div data-testid="history-section" />
- </div>
- ),
+ RecoveryHistorySection: () => <div data-testid="history-section" />,
}));
import Recovery from '@/components/Recovery/Recovery';
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index bcd7d7cb47..16180ec133 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -257,6 +257,9 @@ describe('Recovery', () => {
expect(
inventoryControls.compareDocumentPosition(inventoryTable) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
+ expect(inventoryControls.closest('.rounded-md')).not.toBeNull();
+ expect(inventoryTable.closest('.rounded-md')).not.toBeNull();
+ expect(inventoryControls.closest('.rounded-md')).not.toBe(inventoryTable.closest('.rounded-md'));
expect(within(inventoryTable).getByText('Item')).toBeInTheDocument();
expect(within(inventoryTable).getByText('Item Type')).toBeInTheDocument();
expect(within(inventoryTable).getByText('Platform')).toBeInTheDocument();
@@ -321,6 +324,11 @@ describe('Recovery', () => {
expect(
historyControls.compareDocumentPosition(historyTable) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
+ expect(activityHeading.closest('.rounded-md')).not.toBeNull();
+ expect(historyControls.closest('.rounded-md')).not.toBeNull();
+ expect(historyTable.closest('.rounded-md')).not.toBeNull();
+ expect(activityHeading.closest('.rounded-md')).not.toBe(historyControls.closest('.rounded-md'));
+ expect(historyControls.closest('.rounded-md')).not.toBe(historyTable.closest('.rounded-md'));
const historySearch = within(historyControls).getByPlaceholderText('Search recovery history...');
expect(historySearch).toBeInTheDocument();
expect(historySearch.closest('div.relative')?.className).toContain('w-full');