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): unify workspace shell into one card

rcourtman19f1cb858f5a
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index ba781fcdc6..e2270d989b 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -753,9 +753,11 @@ 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 `Subtabs.tsx` row first, then one shared page-controls
-card, then the active data card, instead of burying the workspace switcher
-inside the filter row or table-card header.
+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.
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
@@ -768,10 +770,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 in its own canonical subtabs row above the controls card,
-not inside the controls card and not inside a table-card header strip, so the
-page hands off from summary into tabs, then filters, then data the same way the
-storage surface does.
+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.
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.
@@ -796,9 +798,10 @@ canonical short Pulse vocabulary like `Platform` and `Status` instead of
recovery-only variants such as `History platform` or `History status`.
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 tabs to `RecoveryActivitySection.tsx`, then shared controls,
-then the recovery history table, so the timeline frames the event list without
-turning the page back into stacked primary tables.
+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.
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 08e4ee6b80..d0b1586a8c 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -473,6 +473,76 @@ const Recovery: Component = () => {
);
};
+ const workspaceControls = () => (
+ <Subtabs
+ value={workspaceView()}
+ onChange={(value) => setWorkspaceView(value as RecoveryWorkspaceView)}
+ ariaLabel="Recovery data view"
+ class="px-4 sm:px-5"
+ tabs={[
+ {
+ value: 'inventory',
+ label: 'Protected items',
+ },
+ {
+ value: 'events',
+ label: 'Recovery events',
+ },
+ ]}
+ />
+ );
+
+ const eventsActivity = () => (
+ <RecoveryActivitySection
+ activitySummary={activitySummary}
+ activeClusterLabel={activeClusterLabel}
+ activeItemTypeLabel={activeItemTypeLabel}
+ activeNamespaceLabel={activeNamespaceLabel}
+ activeNodeLabel={activeNodeLabel}
+ chartRangeDays={chartRangeDays}
+ clearClusterFilter={() => {
+ setClusterFilter('all');
+ setCurrentPage(1);
+ }}
+ clearFocusedRollup={() => setRollupId('')}
+ clearItemTypeFilter={() => {
+ setItemTypeFilter('all');
+ setCurrentPage(1);
+ }}
+ clearNamespaceFilter={() => {
+ setNamespaceFilter('all');
+ setCurrentPage(1);
+ }}
+ clearNodeFilter={() => {
+ setNodeFilter('all');
+ setCurrentPage(1);
+ }}
+ clearSelectedDate={() => {
+ setSelectedDateKey(null);
+ setCurrentPage(1);
+ }}
+ hasFocusedRollup={() => rollupId().trim().length > 0}
+ isMobile={isMobile()}
+ loading={() => recoverySeries.response.loading}
+ overallRollupsSummary={overallRollupsSummary}
+ selectedDateKey={selectedDateKey}
+ selectedDateLabel={selectedDateLabel}
+ selectedHistoryItemLabel={selectedHistoryItemLabel}
+ setChartRangeDays={(range) => {
+ setChartRangeDays(range);
+ setSelectedDateKey(null);
+ setCurrentPage(1);
+ }}
+ timeline={timeline}
+ toggleSelectedDate={(key) => {
+ setWorkspaceView('events');
+ setSelectedDateKey((previous) => (previous === key ? null : key));
+ setCurrentPage(1);
+ }}
+ embedded
+ />
+ );
+
return (
<div data-testid="recovery-page" class="flex flex-col gap-3">
<RecoverySummary
@@ -488,22 +558,6 @@ const Recovery: Component = () => {
{(() => {
return (
<>
- <Subtabs
- value={workspaceView()}
- onChange={(value) => setWorkspaceView(value as RecoveryWorkspaceView)}
- ariaLabel="Recovery data view"
- tabs={[
- {
- value: 'inventory',
- label: 'Protected items',
- },
- {
- value: 'events',
- label: 'Recovery events',
- },
- ]}
- />
-
<Show when={workspaceView() === 'inventory'}>
<RecoveryProtectedInventorySection
filteredRollups={filteredRollups}
@@ -528,66 +582,23 @@ const Recovery: Component = () => {
setPlatformFilter={setPlatformFilter}
setQueryFilter={setQueryFilter}
setVerificationFilter={setVerificationFilter}
+ workspaceControls={workspaceControls()}
/>
</Show>
<Show when={workspaceView() === 'events'}>
- <RecoveryActivitySection
- activitySummary={activitySummary}
- activeClusterLabel={activeClusterLabel}
- activeItemTypeLabel={activeItemTypeLabel}
- activeNamespaceLabel={activeNamespaceLabel}
- activeNodeLabel={activeNodeLabel}
- chartRangeDays={chartRangeDays}
- clearClusterFilter={() => {
- setClusterFilter('all');
- setCurrentPage(1);
- }}
- clearFocusedRollup={() => setRollupId('')}
- clearItemTypeFilter={() => {
- setItemTypeFilter('all');
- setCurrentPage(1);
- }}
- clearNamespaceFilter={() => {
- setNamespaceFilter('all');
- setCurrentPage(1);
- }}
- clearNodeFilter={() => {
- setNodeFilter('all');
- setCurrentPage(1);
- }}
- clearSelectedDate={() => {
- setSelectedDateKey(null);
- setCurrentPage(1);
- }}
- hasFocusedRollup={() => rollupId().trim().length > 0}
- isMobile={isMobile()}
- loading={() => recoverySeries.response.loading}
- overallRollupsSummary={overallRollupsSummary}
- selectedDateKey={selectedDateKey}
- selectedDateLabel={selectedDateLabel}
- selectedHistoryItemLabel={selectedHistoryItemLabel}
- setChartRangeDays={(range) => {
- setChartRangeDays(range);
- setSelectedDateKey(null);
- setCurrentPage(1);
- }}
- timeline={timeline}
- toggleSelectedDate={(key) => {
- setWorkspaceView('events');
- setSelectedDateKey((previous) => (previous === key ? null : key));
- setCurrentPage(1);
- }}
- />
-
<Show when={!recoveryPoints.response.loading && recoveryPoints.response.error}>
- <Card padding="sm">
- <EmptyState
- title={getRecoveryPointsFailureState().title}
- description={String(
- (recoveryPoints.response.error as Error)?.message || recoveryPoints.response.error,
- )}
- />
+ <Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
+ {workspaceControls()}
+ <div class="border-b border-border-subtle">{eventsActivity()}</div>
+ <div class="p-6">
+ <EmptyState
+ title={getRecoveryPointsFailureState().title}
+ description={String(
+ (recoveryPoints.response.error as Error)?.message || recoveryPoints.response.error,
+ )}
+ />
+ </div>
</Card>
</Show>
@@ -639,6 +650,8 @@ const Recovery: Component = () => {
tableMinWidth={tableMinWidth}
totalPages={totalPages}
verificationFilter={verificationFilter}
+ workspaceControls={workspaceControls()}
+ workspaceIntro={eventsActivity()}
/>
</Show>
</Show>
diff --git a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
index 5d45a3752f..f483a7abc3 100644
--- a/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryActivitySection.tsx
@@ -1,5 +1,5 @@
import { For, Show } from 'solid-js';
-import type { Accessor, Component } from 'solid-js';
+import type { Accessor, Component, JSX } from 'solid-js';
import { Card } from '@/components/shared/Card';
import { hideTooltip, showTooltip } from '@/components/shared/Tooltip';
@@ -76,160 +76,159 @@ 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];
-export const RecoveryActivitySection: Component<RecoveryActivitySectionProps> = (props) => (
- <Card
- padding="sm"
- class="h-full border-border-subtle bg-surface"
- >
- <div class="mb-2.5 flex flex-col gap-2.5">
- <div class="flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between">
- <div class="flex min-w-0 flex-col gap-1.5">
- <div class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
- <div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">
- Recovery Activity
+function RecoveryActivitySectionContent(props: RecoveryActivitySectionProps): JSX.Element {
+ return (
+ <>
+ <div class="mb-2.5 flex flex-col gap-2.5">
+ <div class="flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between">
+ <div class="flex min-w-0 flex-col gap-1.5">
+ <div class="flex flex-wrap items-baseline gap-x-2 gap-y-1">
+ <div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">
+ Recovery Activity
+ </div>
+ <div class="text-xs text-muted">
+ Daily recovery points across the selected history window.
+ </div>
</div>
- <div class="text-xs text-muted">
- Daily recovery points across the selected history window.
+ <div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted">
+ <span class="font-medium text-base-content">
+ {props.activitySummary().totalPoints} recovery points
+ </span>
+ <span>{props.activitySummary().averagePerDay.toFixed(1)} per day</span>
+ <span>{props.activitySummary().activeDays} active days</span>
+ <Show when={props.overallRollupsSummary().stale > 0}>
+ <span class="font-medium text-amber-600 dark:text-amber-400">
+ {props.overallRollupsSummary().stale} stale
+ </span>
+ </Show>
</div>
</div>
- <div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted">
- <span class="font-medium text-base-content">
- {props.activitySummary().totalPoints} recovery points
- </span>
- <span>{props.activitySummary().averagePerDay.toFixed(1)} per day</span>
- <span>{props.activitySummary().activeDays} active days</span>
- <Show when={props.overallRollupsSummary().stale > 0}>
- <span class="font-medium text-amber-600 dark:text-amber-400">
- {props.overallRollupsSummary().stale} stale
- </span>
+ <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.5 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>
</Show>
</div>
</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.5 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>
+ </div>
+
+ <Show
+ when={
+ props.selectedDateKey() ||
+ props.activeItemTypeLabel() ||
+ props.activeClusterLabel() ||
+ props.activeNodeLabel() ||
+ props.activeNamespaceLabel()
+ }
+ >
+ <div class="mb-2 flex flex-wrap items-center gap-1.5">
+ <Show when={props.selectedDateKey()}>
+ {(() => {
+ const chip = getRecoveryFilterChipPresentation('day');
+ return (
+ <div class={chip.className}>
+ <span class="font-medium uppercase tracking-wide">{chip.label}</span>
+ <span class="truncate font-mono text-[10px]" title={props.selectedDateLabel()}>
+ {props.selectedDateLabel()}
+ </span>
+ <button type="button" onClick={props.clearSelectedDate} class={chip.clearButtonClass}>
+ Clear
+ </button>
+ </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>
+ <Show when={props.activeClusterLabel()}>
+ {(() => {
+ const chip = getRecoveryFilterChipPresentation('cluster');
+ return (
+ <div class={chip.className}>
+ <span class="font-medium uppercase tracking-wide">{chip.label}</span>
+ <span class="truncate font-mono text-[10px]" title={props.activeClusterLabel()}>
+ {props.activeClusterLabel()}
+ </span>
+ <button type="button" onClick={props.clearClusterFilter} class={chip.clearButtonClass}>
+ Clear
+ </button>
+ </div>
+ );
+ })()}
+ </Show>
+ <Show when={props.activeItemTypeLabel()}>
+ {(() => {
+ const chip = getRecoveryFilterChipPresentation('item-type');
+ return (
+ <div class={chip.className}>
+ <span class="font-medium uppercase tracking-wide">{chip.label}</span>
+ <span class="truncate font-mono text-[10px]" title={props.activeItemTypeLabel()}>
+ {props.activeItemTypeLabel()}
+ </span>
+ <button
+ type="button"
+ onClick={props.clearItemTypeFilter}
+ class={chip.clearButtonClass}
+ >
+ Clear
+ </button>
+ </div>
+ );
+ })()}
+ </Show>
+ <Show when={props.activeNodeLabel()}>
+ {(() => {
+ const chip = getRecoveryFilterChipPresentation('node');
+ return (
+ <div class={chip.className}>
+ <span class="font-medium uppercase tracking-wide">{chip.label}</span>
+ <span class="truncate font-mono text-[10px]" title={props.activeNodeLabel()}>
+ {props.activeNodeLabel()}
+ </span>
+ <button type="button" onClick={props.clearNodeFilter} class={chip.clearButtonClass}>
+ Clear
+ </button>
+ </div>
+ );
+ })()}
+ </Show>
+ <Show when={props.activeNamespaceLabel()}>
+ {(() => {
+ const chip = getRecoveryFilterChipPresentation('namespace');
+ return (
+ <div data-testid="active-namespace-chip" class={chip.className}>
+ <span class="font-medium uppercase tracking-wide">{chip.label}</span>
+ <span class="truncate font-mono text-[10px]" title={props.activeNamespaceLabel()}>
+ {props.activeNamespaceLabel()}
+ </span>
+ <button
+ type="button"
+ onClick={props.clearNamespaceFilter}
+ class={chip.clearButtonClass}
+ >
+ Clear
+ </button>
+ </div>
+ );
+ })()}
</Show>
</div>
- </div>
- </div>
-
- <Show
- when={
- props.selectedDateKey() ||
- props.activeItemTypeLabel() ||
- props.activeClusterLabel() ||
- props.activeNodeLabel() ||
- props.activeNamespaceLabel()
- }
- >
- <div class="mb-2 flex flex-wrap items-center gap-1.5">
- <Show when={props.selectedDateKey()}>
- {(() => {
- const chip = getRecoveryFilterChipPresentation('day');
- return (
- <div class={chip.className}>
- <span class="font-medium uppercase tracking-wide">{chip.label}</span>
- <span class="truncate font-mono text-[10px]" title={props.selectedDateLabel()}>
- {props.selectedDateLabel()}
- </span>
- <button type="button" onClick={props.clearSelectedDate} class={chip.clearButtonClass}>
- Clear
- </button>
- </div>
- );
- })()}
- </Show>
- <Show when={props.activeClusterLabel()}>
- {(() => {
- const chip = getRecoveryFilterChipPresentation('cluster');
- return (
- <div class={chip.className}>
- <span class="font-medium uppercase tracking-wide">{chip.label}</span>
- <span class="truncate font-mono text-[10px]" title={props.activeClusterLabel()}>
- {props.activeClusterLabel()}
- </span>
- <button type="button" onClick={props.clearClusterFilter} class={chip.clearButtonClass}>
- Clear
- </button>
- </div>
- );
- })()}
- </Show>
- <Show when={props.activeItemTypeLabel()}>
- {(() => {
- const chip = getRecoveryFilterChipPresentation('item-type');
- return (
- <div class={chip.className}>
- <span class="font-medium uppercase tracking-wide">{chip.label}</span>
- <span class="truncate font-mono text-[10px]" title={props.activeItemTypeLabel()}>
- {props.activeItemTypeLabel()}
- </span>
- <button
- type="button"
- onClick={props.clearItemTypeFilter}
- class={chip.clearButtonClass}
- >
- Clear
- </button>
- </div>
- );
- })()}
- </Show>
- <Show when={props.activeNodeLabel()}>
- {(() => {
- const chip = getRecoveryFilterChipPresentation('node');
- return (
- <div class={chip.className}>
- <span class="font-medium uppercase tracking-wide">{chip.label}</span>
- <span class="truncate font-mono text-[10px]" title={props.activeNodeLabel()}>
- {props.activeNodeLabel()}
- </span>
- <button type="button" onClick={props.clearNodeFilter} class={chip.clearButtonClass}>
- Clear
- </button>
- </div>
- );
- })()}
- </Show>
- <Show when={props.activeNamespaceLabel()}>
- {(() => {
- const chip = getRecoveryFilterChipPresentation('namespace');
- return (
- <div data-testid="active-namespace-chip" class={chip.className}>
- <span class="font-medium uppercase tracking-wide">{chip.label}</span>
- <span class="truncate font-mono text-[10px]" title={props.activeNamespaceLabel()}>
- {props.activeNamespaceLabel()}
- </span>
- <button
- type="button"
- onClick={props.clearNamespaceFilter}
- class={chip.clearButtonClass}
- >
- Clear
- </button>
- </div>
- );
- })()}
- </Show>
- </div>
- </Show>
+ </Show>
<div class="rounded-lg border border-border-subtle bg-surface-alt/25 p-2.5">
<div class={`mb-2.5 flex flex-wrap items-center justify-between gap-3 ${RECOVERY_TIMELINE_RANGE_GROUP_CLASS}`}>
@@ -417,6 +416,18 @@ export const RecoveryActivitySection: Component<RecoveryActivitySectionProps> =
</div>
</div>
</Show>
+ </div>
+ </>
+ );
+}
+
+export const RecoveryActivitySection: Component<RecoveryActivitySectionProps> = (props) =>
+ props.embedded ? (
+ <div class="px-4 py-4 sm:px-5">
+ <RecoveryActivitySectionContent {...props} />
</div>
- </Card>
-);
+ ) : (
+ <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 c6b690c6bd..0c59359b0a 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 } from 'solid-js';
+import type { Accessor, Component, JSX } from 'solid-js';
import { Card } from '@/components/shared/Card';
import {
@@ -99,6 +99,8 @@ interface RecoveryHistorySectionProps {
tableMinWidth: Accessor<string>;
totalPages: Accessor<number>;
verificationFilter: Accessor<VerificationFilter>;
+ workspaceControls?: JSX.Element;
+ workspaceIntro?: JSX.Element;
}
export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (props) => {
@@ -128,9 +130,15 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
});
return (
- <div class="flex flex-col gap-3">
+ <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>
+
<Show when={!props.kioskMode}>
- <Card padding="sm" tone="card" class="border-border-subtle bg-surface">
+ <div class="border-b border-border-subtle px-4 py-3 sm:px-5">
<PageControls
role="group"
aria-label="Recovery events controls"
@@ -410,26 +418,25 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
</For>
</LabeledFilterSelect>
</PageControls>
- </Card>
+ </div>
</Show>
- <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>
+
+ <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>
);
};
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index 5226720797..35ae67fd1b 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 } from 'solid-js';
+import type { Accessor, Component, JSX } from 'solid-js';
import { Card } from '@/components/shared/Card';
import { EmptyState } from '@/components/shared/EmptyState';
@@ -80,6 +80,7 @@ interface RecoveryProtectedInventorySectionProps {
setVerificationFilter: (value: VerificationFilter) => void;
loading: Accessor<boolean>;
error: Accessor<unknown>;
+ workspaceControls?: JSX.Element;
}
const availableOutcomes = ['all', 'success', 'warning', 'failed', 'running'] as const;
@@ -205,9 +206,15 @@ export const RecoveryProtectedInventorySection: Component<
};
return (
- <div class="flex flex-col gap-3">
+ <Card
+ padding="none"
+ tone="card"
+ class="overflow-hidden border-border-subtle bg-surface"
+ >
+ <Show when={props.workspaceControls}>{props.workspaceControls}</Show>
+
<Show when={!props.kioskMode}>
- <Card padding="sm" tone="card" class="border-border-subtle bg-surface">
+ <div class="border-b border-border-subtle px-4 py-3 sm:px-5">
<PageControls
role="group"
aria-label="Protected items controls"
@@ -314,43 +321,36 @@ export const RecoveryProtectedInventorySection: Component<
Stale only
</button>
</PageControls>
- </Card>
+ </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.filteredRollups().length === 0}>
+ <div class="px-6 py-6 text-sm text-muted">
+ {getRecoveryProtectedItemsLoadingState().text}
+ </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()}>
+ <div class="p-6">
+ <EmptyState
+ title={getRecoveryProtectedItemsFailureState().title}
+ description={String((props.error() as Error)?.message || props.error())}
+ />
+ </div>
+ </Show>
- <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' }}
- >
+ <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">
+ <Table
+ class="w-full border-collapse whitespace-nowrap"
+ style={{ 'table-layout': 'fixed', 'min-width': props.isMobile ? '100%' : '640px' }}
+ >
<TableHeader>
<TableRow class="bg-surface-alt/95 text-muted">
{(
@@ -541,45 +541,44 @@ export const RecoveryProtectedInventorySection: Component<
}}
</For>
</TableBody>
- </Table>
- </div>
- <div class="flex items-center justify-between gap-2 border-t border-border bg-surface px-4 py-3 text-xs text-muted">
- <div>
- <Show
- when={sortedRollups().length > 0}
- fallback={<span>Showing 0 of 0 protected items</span>}
- >
- <span>
- Showing {pageStart()} - {pageEnd()} of {sortedRollups().length} protected items
- </span>
- </Show>
- </div>
- <div class="flex items-center gap-2">
- <button
- type="button"
- disabled={protectedPage() <= 1}
- onClick={() => setProtectedPage(Math.max(1, protectedPage() - 1))}
- class="rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-base-content disabled:opacity-50"
- >
- Prev
- </button>
+ </Table>
+ </div>
+ <div class="flex items-center justify-between gap-2 border-t border-border bg-surface px-4 py-3 text-xs text-muted">
+ <div>
+ <Show
+ when={sortedRollups().length > 0}
+ fallback={<span>Showing 0 of 0 protected items</span>}
+ >
<span>
- Page {protectedPage()} / {protectedTotalPages()}
+ Showing {pageStart()} - {pageEnd()} of {sortedRollups().length} protected items
</span>
- <button
- type="button"
- disabled={protectedPage() >= protectedTotalPages()}
- onClick={() =>
- setProtectedPage(Math.min(protectedTotalPages(), protectedPage() + 1))
- }
- class="rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-base-content disabled:opacity-50"
- >
- Next
- </button>
- </div>
+ </Show>
</div>
- </Show>
- </Card>
- </div>
+ <div class="flex items-center gap-2">
+ <button
+ type="button"
+ disabled={protectedPage() <= 1}
+ onClick={() => setProtectedPage(Math.max(1, protectedPage() - 1))}
+ class="rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-base-content disabled:opacity-50"
+ >
+ Prev
+ </button>
+ <span>
+ Page {protectedPage()} / {protectedTotalPages()}
+ </span>
+ <button
+ type="button"
+ disabled={protectedPage() >= protectedTotalPages()}
+ onClick={() =>
+ setProtectedPage(Math.min(protectedTotalPages(), protectedPage() + 1))
+ }
+ class="rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-base-content disabled:opacity-50"
+ >
+ Next
+ </button>
+ </div>
+ </div>
+ </Show>
+ </Card>
);
};
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 21a2e4dd62..260c569608 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
@@ -40,9 +40,10 @@ vi.mock('@/components/Recovery/RecoveryActivitySection', () => ({
}));
vi.mock('@/components/Recovery/RecoveryHistorySection', () => ({
- RecoveryHistorySection: (props: { workspaceControls?: any }) => (
+ RecoveryHistorySection: (props: { workspaceControls?: any; workspaceIntro?: any }) => (
<div>
{props.workspaceControls}
+ {props.workspaceIntro}
<div data-testid="history-section" />
</div>
),
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 37b1688acf..3d457b188f 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -238,7 +238,12 @@ describe('Recovery', () => {
expect(screen.getAllByRole('table')).toHaveLength(1);
});
const inventoryTable = screen.getAllByRole('table')[0];
+ const inventoryWorkspaceCard = workspaceTablist.closest('.overflow-hidden');
const inventoryBody = inventoryTable.querySelector('tbody');
+ expect(inventoryWorkspaceCard).not.toBeNull();
+ expect(inventoryWorkspaceCard).toContainElement(workspaceTablist);
+ expect(inventoryWorkspaceCard).toContainElement(inventoryControls);
+ expect(inventoryWorkspaceCard).toContainElement(inventoryTable);
expect(
workspaceTablist.compareDocumentPosition(inventoryControls) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
@@ -280,10 +285,16 @@ describe('Recovery', () => {
const historyTable = screen.getAllByRole('table')[0];
const historyControls = screen.getByRole('group', { name: /recovery events controls/i });
const historyTablist = screen.getByRole('tablist', { name: /recovery data view/i });
+ const eventsWorkspaceCard = historyTablist.closest('.overflow-hidden');
+ expect(eventsWorkspaceCard).not.toBeNull();
+ expect(eventsWorkspaceCard).toContainElement(historyTablist);
expect(
historyTablist.compareDocumentPosition(historyControls) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
const activityHeading = screen.getByText('Recovery Activity');
+ expect(eventsWorkspaceCard).toContainElement(activityHeading);
+ expect(eventsWorkspaceCard).toContainElement(historyControls);
+ expect(eventsWorkspaceCard).toContainElement(historyTable);
expect(
activityHeading.compareDocumentPosition(historyControls) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);