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): restore canonical workspace subtabs

rcourtman3b34a116ee9a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 41281611cf..d0a990bf49 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -647,11 +647,11 @@ search-row, filter-row, and inline-leading-slot layout surface. Monitoring
pages that need workspace tabs or count chips next to search should route that
through the shared `searchLeading` slot instead of recreating a second local
header strip above the control bar.
-When those workspace tabs need a denser embedded control-bar treatment, that
-presentation should live on the shared
-`frontend-modern/src/components/shared/Subtabs.tsx` owner as an explicit
-variant instead of each page layering local shell, list, and button class
-stacks onto the primitive.
+When those workspace tabs need an embedded control-bar treatment, they should
+still stay on the one canonical `frontend-modern/src/components/shared/Subtabs.tsx`
+primitive and reuse the established shell, list, and button class pattern
+already proven on owning surfaces like operations rather than introducing new
+variant APIs on the primitive.
The search-input enhancement surfaces now follow that same owner split.
`frontend-modern/src/components/shared/SearchInputEnhancements.tsx` stays the
render shell, `frontend-modern/src/components/shared/useSearchInputEnhancements.ts`
@@ -771,8 +771,9 @@ 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 shared subtabs
-variant boundary rather than from recovery-only class overrides.
+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.
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 c4ad21f5e2..79bb3ba4cb 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -758,8 +758,9 @@ 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 shared `Subtabs.tsx` control-surface variant instead of stacking
-recovery-only shell, list, and button classes on top of the primitive.
+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.
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
diff --git a/frontend-modern/src/components/Recovery/Recovery.tsx b/frontend-modern/src/components/Recovery/Recovery.tsx
index fe4254d045..4ad4245b7b 100644
--- a/frontend-modern/src/components/Recovery/Recovery.tsx
+++ b/frontend-modern/src/components/Recovery/Recovery.tsx
@@ -492,8 +492,9 @@ const Recovery: Component = () => {
value={workspaceView()}
onChange={(value) => setWorkspaceView(value as RecoveryWorkspaceView)}
ariaLabel="Recovery data view"
- variant="control"
- class="sm:w-max"
+ 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',
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 3f1331e6ca..8b20f565ce 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -227,7 +227,7 @@ describe('Recovery', () => {
within(inventoryControls)
.getByRole('tab', { name: /protected items 2/i })
.className,
- ).not.toContain('border-b-2');
+ ).toContain('border-b-2');
expect(
within(inventoryControls)
.getByRole('tab', { name: /protected items 2/i })
diff --git a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
index 20192788f9..4214a7f394 100644
--- a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
@@ -102,14 +102,14 @@ describe('page controls guardrails', () => {
expect(recoveryHistorySectionSource).not.toContain('<FilterHeader');
});
- it('keeps embedded workspace tabs on the shared subtabs control variant', () => {
- expect(subtabsSource).toContain("variant?: 'default' | 'control'");
- expect(subtabsSource).toContain('subtabsControlShellClass');
- expect(subtabsSource).toContain('subtabsControlListClass');
- expect(recoveryPageSource).toContain('variant="control"');
- expect(recoveryPageSource).not.toContain('listClass="gap-1 overflow-x-auto scrollbar-hide"');
- expect(recoveryPageSource).not.toContain(
- 'tabClass="min-h-8 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-xs"',
+ 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"',
);
});
});
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index ba85baf697..356b1ac7e6 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -228,12 +228,12 @@ describe('shared primitive guardrails', () => {
expect(activeUseTrialNudgeModelSource).toContain('ACTIVE_USE_TRIAL_NUDGE_TITLE');
});
- it('keeps shared subtabs variant-driven instead of page-local class stacks', () => {
- expect(subtabsSource).toContain("variant?: 'default' | 'control'");
- expect(subtabsSource).toContain('subtabsControlShellClass');
- expect(subtabsSource).toContain('subtabsControlListClass');
- expect(subtabsSource).toContain('subtabControlButtonClass');
- expect(subtabsSource).toContain("local.variant === 'control'");
+ it('keeps shared subtabs as one primitive and leaves shell styling to owning surfaces', () => {
+ expect(subtabsSource).not.toContain("variant?: 'default' | 'control'");
+ expect(subtabsSource).not.toContain('subtabsControlShellClass');
+ expect(subtabsSource).toContain('subtabsShellClass');
+ expect(subtabsSource).toContain('subtabsListClass');
+ expect(subtabsSource).toContain('subtabButtonClass');
});
it('keeps trial banner on shell, runtime, and model owners', () => {
diff --git a/frontend-modern/src/components/shared/Subtabs.tsx b/frontend-modern/src/components/shared/Subtabs.tsx
index ca0867696a..0c45a87d41 100644
--- a/frontend-modern/src/components/shared/Subtabs.tsx
+++ b/frontend-modern/src/components/shared/Subtabs.tsx
@@ -11,7 +11,6 @@ interface SubtabsProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChang
onChange: (value: string) => void;
tabs: SubtabOption[];
ariaLabel: string;
- variant?: 'default' | 'control';
listClass?: string;
tabClass?: string;
}
@@ -22,42 +21,23 @@ export const subtabButtonClass =
'inline-flex min-h-10 items-center border-b-2 px-1 py-2 text-sm font-medium transition-colors';
export const subtabButtonActiveClass = 'border-blue-600 text-base-content';
export const subtabButtonInactiveClass = 'border-transparent text-muted hover:text-base-content';
-export const subtabsControlShellClass = 'rounded-md border border-border bg-surface-alt p-0.5';
-export const subtabsControlListClass =
- 'flex flex-wrap items-center gap-1 overflow-x-auto scrollbar-hide';
-export const subtabControlButtonClass =
- 'inline-flex min-h-8 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-xs font-medium transition-colors';
-export const subtabControlButtonActiveClass =
- 'border-border-subtle bg-surface text-base-content shadow-sm';
-export const subtabControlButtonInactiveClass =
- 'text-muted hover:bg-surface-hover hover:text-base-content';
-
export const Subtabs: Component<SubtabsProps> = (props) => {
const [local, divProps] = splitProps(props, [
'value',
'onChange',
'tabs',
'ariaLabel',
- 'variant',
'class',
'listClass',
'tabClass',
]);
- const isControlVariant = () => local.variant === 'control';
return (
- <div
- {...divProps}
- class={`${
- isControlVariant() ? subtabsControlShellClass : subtabsShellClass
- } ${local.class ?? ''}`.trim()}
- >
+ <div {...divProps} class={`${subtabsShellClass} ${local.class ?? ''}`.trim()}>
<div
role="tablist"
aria-label={local.ariaLabel}
- class={`${
- isControlVariant() ? subtabsControlListClass : subtabsListClass
- } ${local.listClass ?? ''}`.trim()}
+ class={`${subtabsListClass} ${local.listClass ?? ''}`.trim()}
>
<For each={local.tabs}>
{(tab) => {
@@ -70,16 +50,8 @@ export const Subtabs: Component<SubtabsProps> = (props) => {
tabIndex={selected() ? 0 : -1}
disabled={tab.disabled}
onClick={() => local.onChange(tab.value)}
- class={`${
- isControlVariant() ? subtabControlButtonClass : subtabButtonClass
- } ${
- selected()
- ? isControlVariant()
- ? subtabControlButtonActiveClass
- : subtabButtonActiveClass
- : isControlVariant()
- ? subtabControlButtonInactiveClass
- : subtabButtonInactiveClass
+ class={`${subtabButtonClass} ${
+ selected() ? subtabButtonActiveClass : subtabButtonInactiveClass
} ${local.tabClass ?? ''}`.trim()}
>
{tab.label}