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): match storage workspace layout

rcourtman24cb08e0f449
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index d0a990bf49..957de6aca6 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -771,9 +771,11 @@ protected-items versus recovery-events workspace switch. The recovery lane may
own the active view and route-state semantics, but the top-level tab framing
must stay on the canonical shared subtabs control instead of reviving a
recovery-local switcher pattern. When recovery embeds that switcher inside the
-page-controls row, the contained styling should come from the same canonical
-subtabs shell, list, and button class treatment already used by established
-Pulse surfaces rather than from a recovery-only variant boundary.
+page shell, it should follow the same ordering already used by storage: shared
+subtabs row first, shared controls card second, and data card after that. The
+contained styling should come from the same canonical subtabs shell, list, and
+button class treatment already used by established Pulse surfaces rather than
+from a recovery-only variant boundary or recovery-local filter-row embedding.
That same shared-boundary rule applies to summary density. The shared compact
mode on `SummaryPanel.tsx` and `SummaryMetricCard.tsx` exists for genuinely
dense monitoring surfaces, but pages that are trying to align with the normal
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 79bb3ba4cb..682c524d8c 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -747,25 +747,24 @@ title-case header typography, compact control heights, and thin row density as
the established Pulse monitoring tables instead of drifting into report-style
uppercase headers or oversized filter chrome.
That same workspace-shell rule should also avoid a dedicated recovery-only
-status strip above the control bar. Protected-items and recovery-events should
-surface their tabs, counts, and issue cues through the shared page-controls
-search row inside one standalone shared control card, so the page hands from
-summary into the same controls-card then table-card rhythm used by the stronger
-Pulse monitoring pages.
+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.
That same strip should not repeat the broad stale or never-succeeded posture
counts once the summary already owns those signals. The protected-items control
row should stay focused on workspace navigation, drill-in context, and active
filters instead of echoing page-wide posture pills above the same table.
That same workspace handoff should stay on shared primitive styling too. When
-recovery embeds its workspace tabs inside the page-controls row, the switcher
-should use the same canonical shared `Subtabs.tsx` shell, list, and button
-class pattern already used by established Pulse tab surfaces instead of
-inventing a recovery-only variant or recovery-only class stack.
+recovery renders its workspace tabs, the switcher should use the same canonical
+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 inside the shared controls card rather than a recovery-only
-band or a table-card header strip, so the page hands off from summary into one
-canonical active control surface before the data card the way infrastructure
-and workloads do.
+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.
That same handoff should keep recovery on the standard Pulse summary density.
`RecoverySummary.tsx` should use the shared default `SummaryPanel` /
`SummaryMetricCard` rhythm that infrastructure and workloads use, instead of
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index 4ad4245b7b..ce5e9f467d 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -486,36 +486,31 @@ const Recovery: Component = () => {
<div ref={historySectionRef} class="flex flex-col gap-3">
{(() => {
- const workspaceControls = (
- <div class="flex flex-wrap items-center gap-2">
- <Subtabs
- value={workspaceView()}
- onChange={(value) => setWorkspaceView(value as RecoveryWorkspaceView)}
- ariaLabel="Recovery data view"
- class="rounded-md border border-border bg-surface-alt p-1.5 sm:w-max"
- listClass="gap-2 overflow-x-auto scrollbar-hide"
- tabClass="min-h-10 whitespace-nowrap rounded-md border border-transparent px-4 py-2 text-sm"
- tabs={[
- {
- value: 'inventory',
- label: `Protected items ${filteredRollups().length}`,
- },
- {
- value: 'events',
- label: `Recovery events ${recoveryPoints.meta().total}`,
- },
- ]}
- />
- <Show when={rollupId().trim().length > 0}>
- <span class="inline-flex w-fit items-center rounded-md border border-border-subtle bg-surface-alt px-2 py-0.5 text-[11px] font-medium text-muted">
- Focused drill-in
- </span>
- </Show>
- </div>
- );
-
return (
<>
+ <div class="flex flex-wrap items-center gap-3">
+ <Subtabs
+ value={workspaceView()}
+ onChange={(value) => setWorkspaceView(value as RecoveryWorkspaceView)}
+ ariaLabel="Recovery data view"
+ tabs={[
+ {
+ value: 'inventory',
+ label: `Protected items ${filteredRollups().length}`,
+ },
+ {
+ value: 'events',
+ label: `Recovery events ${recoveryPoints.meta().total}`,
+ },
+ ]}
+ />
+ <Show when={rollupId().trim().length > 0}>
+ <span class="inline-flex w-fit items-center rounded-md border border-border-subtle bg-surface-alt px-2 py-0.5 text-[11px] font-medium text-muted">
+ Focused drill-in
+ </span>
+ </Show>
+ </div>
+
<Show when={workspaceView() === 'inventory'}>
<RecoveryProtectedInventorySection
filteredRollups={filteredRollups}
@@ -540,7 +535,6 @@ const Recovery: Component = () => {
setPlatformFilter={setPlatformFilter}
setQueryFilter={setQueryFilter}
setVerificationFilter={setVerificationFilter}
- workspaceControls={workspaceControls}
/>
</Show>
@@ -652,7 +646,6 @@ const Recovery: Component = () => {
tableMinWidth={tableMinWidth}
totalPages={totalPages}
verificationFilter={verificationFilter}
- workspaceControls={workspaceControls}
/>
</Show>
</Show>
diff --git a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
index 7ad96f6e5a..5baa678432 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,7 +99,6 @@ interface RecoveryHistorySectionProps {
tableMinWidth: Accessor<string>;
totalPages: Accessor<number>;
verificationFilter: Accessor<VerificationFilter>;
- workspaceControls?: JSX.Element;
}
export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (props) => {
@@ -136,17 +135,14 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
role="group"
aria-label="Recovery events controls"
searchLeading={
- <div class="flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted">
- <Show when={props.workspaceControls}>
- <div class="shrink-0">{props.workspaceControls}</div>
- </Show>
- <Show when={props.groupedByDay().length > 0}>
+ props.groupedByDay().length > 0 ? (
+ <div class="flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted">
<span>
{props.groupedByDay().length} day group
{props.groupedByDay().length === 1 ? '' : 's'}
</span>
- </Show>
- </div>
+ </div>
+ ) : undefined
}
search={
<SearchInput
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index 469963acbd..8d87c3eb2e 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';
@@ -80,7 +80,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;
@@ -203,13 +202,6 @@ export const RecoveryProtectedInventorySection: Component<
<PageControls
role="group"
aria-label="Protected items controls"
- searchLeading={
- <div class="flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted">
- <Show when={props.workspaceControls}>
- <div class="shrink-0">{props.workspaceControls}</div>
- </Show>
- </div>
- }
search={
<SearchInput
value={props.queryFilter}
@@ -424,11 +416,11 @@ export const RecoveryProtectedInventorySection: Component<
return (
<TableRow
- class="cursor-pointer border-b border-border/80 odd:bg-surface even:bg-surface-alt/35 transition-colors hover:bg-surface-hover/95"
+ class="cursor-pointer border-b border-border-subtle/70 odd:bg-surface even:bg-surface-alt/35 transition-colors hover:bg-surface-hover/95"
onClick={() => props.onSelectRollup(rollup.rollupId)}
>
<TableCell
- class="max-w-[420px] px-3 py-1 text-base-content"
+ class="max-w-[420px] px-3 py-1.5 text-base-content"
title={label}
>
<div class="flex min-w-0 flex-col gap-1">
@@ -474,7 +466,7 @@ export const RecoveryProtectedInventorySection: Component<
</div>
</TableCell>
- <TableCell class="hidden md:table-cell whitespace-nowrap px-3 py-1">
+ <TableCell class="hidden md:table-cell whitespace-nowrap px-3 py-1.5">
<Show
when={itemTypePresentation}
fallback={<span class="text-muted">—</span>}
@@ -485,7 +477,7 @@ export const RecoveryProtectedInventorySection: Component<
</Show>
</TableCell>
- <TableCell class="hidden lg:table-cell whitespace-nowrap px-3 py-1">
+ <TableCell class="hidden lg:table-cell whitespace-nowrap px-3 py-1.5">
<div class="flex flex-wrap gap-1.5">
<For each={platforms}>
{(platform) => {
@@ -501,7 +493,7 @@ export const RecoveryProtectedInventorySection: Component<
</TableCell>
<TableCell
- class={`whitespace-nowrap px-3 py-1 ${getRecoveryRollupAgeTextClass(
+ class={`whitespace-nowrap px-3 py-1.5 ${getRecoveryRollupAgeTextClass(
rollup,
nowMs,
)}`}
@@ -522,7 +514,7 @@ export const RecoveryProtectedInventorySection: Component<
)}
</TableCell>
- <TableCell class="whitespace-nowrap px-3 py-1">
+ <TableCell class="whitespace-nowrap px-3 py-1.5">
<span
class={`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${getRecoveryOutcomeBadgeClass(
outcome,
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 8b20f565ce..bcb0c01e2c 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -203,36 +203,26 @@ describe('Recovery', () => {
expect(await screen.findByTestId('recovery-summary')).toBeInTheDocument();
expect(screen.getByText('Recovery Posture')).toBeInTheDocument();
- expect(await screen.findByRole('tab', { name: /protected items/i })).toBeInTheDocument();
+ const workspaceTablist = await screen.findByRole('tablist', { name: /recovery data view/i });
+ expect(within(workspaceTablist).getByRole('tab', { name: /protected items 2/i })).toBeInTheDocument();
+ expect(within(workspaceTablist).getByRole('tab', { name: /recovery events 0/i })).toBeInTheDocument();
await screen.findByText('VM 123');
const inventoryControls = screen.getByRole('group', { name: /protected items controls/i });
expect(
within(inventoryControls).getByPlaceholderText('Search protected items...'),
).toBeInTheDocument();
- expect(
- within(inventoryControls).getByRole('tab', { name: /protected items/i }),
- ).toBeInTheDocument();
- expect(
- within(inventoryControls).getByRole('tab', { name: /recovery events/i }),
- ).toBeInTheDocument();
- expect(
- within(inventoryControls).getByRole('tab', { name: /protected items 2/i }),
- ).toBeInTheDocument();
- expect(
- within(inventoryControls).getByRole('tab', { name: /recovery events 0/i }),
- ).toBeInTheDocument();
expect(within(inventoryControls).queryByText(/^\d+ stale$/i)).not.toBeInTheDocument();
expect(within(inventoryControls).queryByText(/never succeeded/i)).not.toBeInTheDocument();
expect(
- within(inventoryControls)
+ within(workspaceTablist)
.getByRole('tab', { name: /protected items 2/i })
.className,
).toContain('border-b-2');
expect(
- within(inventoryControls)
+ within(workspaceTablist)
.getByRole('tab', { name: /protected items 2/i })
.className,
- ).toContain('rounded-md');
+ ).not.toContain('rounded-md');
expect(screen.queryByText('Protected inventory')).not.toBeInTheDocument();
expect(screen.queryByText('Needs Attention')).not.toBeInTheDocument();
expect(screen.getAllByText(/Page 1 \/ 1/i).length).toBeGreaterThan(0);
@@ -245,6 +235,9 @@ describe('Recovery', () => {
expect(screen.getAllByRole('table')).toHaveLength(1);
});
const inventoryTable = screen.getAllByRole('table')[0];
+ expect(
+ workspaceTablist.compareDocumentPosition(inventoryControls) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).not.toBe(0);
expect(
inventoryControls.compareDocumentPosition(inventoryTable) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
@@ -280,24 +273,18 @@ 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 });
+ expect(
+ historyTablist.compareDocumentPosition(historyControls) & Node.DOCUMENT_POSITION_FOLLOWING,
+ ).not.toBe(0);
expect(
historyControls.compareDocumentPosition(historyTable) & Node.DOCUMENT_POSITION_FOLLOWING,
).not.toBe(0);
expect(
within(historyControls).getByPlaceholderText('Search recovery history...'),
).toBeInTheDocument();
- expect(
- within(historyControls).getByRole('tab', { name: /protected items/i }),
- ).toBeInTheDocument();
- expect(
- within(historyControls).getByRole('tab', { name: /recovery events/i }),
- ).toBeInTheDocument();
- expect(
- within(historyControls).getByRole('tab', { name: /protected items 2/i }),
- ).toBeInTheDocument();
- expect(
- within(historyControls).getByRole('tab', { name: /recovery events 1/i }),
- ).toBeInTheDocument();
+ expect(within(historyTablist).getByRole('tab', { name: /protected items 2/i })).toBeInTheDocument();
+ expect(within(historyTablist).getByRole('tab', { name: /recovery events 1/i })).toBeInTheDocument();
expect(within(historyControls).getByText(/^1 day group$/i)).toBeInTheDocument();
expect(screen.getAllByText(/^1 event$/i)).toHaveLength(1);
expect(screen.getAllByText(/^1 day group$/i)).toHaveLength(1);
diff --git a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
index 4214a7f394..3286aa002c 100644
--- a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
@@ -104,12 +104,8 @@ describe('page controls guardrails', () => {
it('keeps embedded workspace tabs on the canonical shared subtabs class pattern', () => {
expect(subtabsSource).not.toContain("variant?: 'default' | 'control'");
- expect(recoveryPageSource).toContain(
- 'class="rounded-md border border-border bg-surface-alt p-1.5 sm:w-max"',
- );
- expect(recoveryPageSource).toContain('listClass="gap-2 overflow-x-auto scrollbar-hide"');
- expect(recoveryPageSource).toContain(
- 'tabClass="min-h-10 whitespace-nowrap rounded-md border border-transparent px-4 py-2 text-sm"',
- );
+ expect(recoveryPageSource).not.toContain('variant="control"');
+ expect(recoveryPageSource).not.toContain('listClass=');
+ expect(recoveryPageSource).not.toContain('tabClass=');
});
});