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.

Converge Proxmox backup view selector on shared primitive

rcourtmane73420d4d5fb
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 71476b022f..52707ccf2e 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1835,6 +1835,10 @@ SVGs.
resource, workload, and Docker host drawers: centered row layout, status
semantics, discovery loading copy, and canonical `LoadingSpinner` composition
live there rather than in drawer-local fallback markup.
+`FilterButtonGroup` owns feature table view toggles as well as settings
+segmented selectors: page-specific labels and selected values stay in the
+owning feature model, but the visible segmented selector shell must come from
+the shared primitive rather than a local bordered button group.
AI settings provider fields are a governed frontend primitive, not a
provider-local form fork. The shared provider configuration section must render
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index a8d8ba9e50..1a31792a46 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -95,6 +95,10 @@ Proxmox backup source/state chips are also a frontend-primitives boundary:
badge tones, `proxmoxBackupsTableShared.tsx` owns the backup table helper
composition, and visible source/state chips must render through `MetadataBadge`
instead of restoring local rounded-sm xs badge spans.
+The Proxmox backup view selector follows the same ownership split:
+storage/recovery owns the chronological-versus-coverage view values and backup
+semantics, while the visible segmented selector shell must compose the
+frontend-primitives `FilterButtonGroup`.
Tenant report branding settings are adjacent tenant-local configuration, not a
storage or recovery product state. `reportBranding` persisted in a tenant
runtime's `system.json` should be preserved by the existing tenant data
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index 45aeb2a839..292663312b 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -2924,7 +2924,8 @@
{ "path": "src/components/Settings/GeneralSettingsPanel.tsx" },
{ "path": "src/components/Settings/ResourcePicker.tsx" },
{ "path": "src/components/Settings/ReportingPanel.tsx" },
- { "path": "src/features/patrol/PatrolIntelligenceHeader.tsx" }
+ { "path": "src/features/patrol/PatrolIntelligenceHeader.tsx" },
+ { "path": "src/features/proxmox/ProxmoxBackupsTable.tsx" }
],
"forbiddenPatterns": [
{
@@ -2933,6 +2934,14 @@
"min-h-10 sm:min-h-9 min-w-10 px-3 py-2 rounded-md text-sm font-medium transition-all",
"<For each={RESOURCE_PICKER_TYPE_FILTERS}>"
]
+ },
+ {
+ "path": "src/features/proxmox/ProxmoxBackupsTable.tsx",
+ "patterns": [
+ "const viewButtonClass",
+ "inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1",
+ "inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors"
+ ]
}
],
"proof": [
@@ -4880,6 +4889,28 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "filter-button-group-local-feature-view-toggle-styles",
+ "category": "segmented-selector",
+ "summary": "Feature table view toggles must compose FilterButtonGroup instead of copying the compact bordered group and active view-button styling locally.",
+ "canonical": {
+ "path": "src/components/shared/filterButtonGroupModel.ts",
+ "export": "getFilterButtonGroupButtonClass"
+ },
+ "scopes": ["src/features"],
+ "extensions": [".tsx"],
+ "allPatterns": [
+ "inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1",
+ "inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors"
+ ],
+ "legacyReason": "Retired migration debt. Feature table view toggles must use FilterButtonGroup; local bordered segmented-view selector forks are not allowed.",
+ "allowedPaths": [],
+ "ignoredPaths": ["src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx"],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "selectable-pill-button-local-scope-selector-styles",
"category": "selectable-pill-button",
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index afb008bc89..a874fba54a 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -386,12 +386,16 @@ describe('shared primitive guardrails', () => {
allPatterns?: string[];
scopes?: string[];
allowedPaths?: string[];
+ ignoredPaths?: string[];
}>;
};
const registeredRule = registry.rules?.find((rule) => rule.id === 'filter-button-group-shell');
const registeredGuard = registry.patternGuards?.find(
(guard) => guard.id === 'filter-button-group-local-segmented-control-styles',
);
+ const registeredFeatureGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'filter-button-group-local-feature-view-toggle-styles',
+ );
expect(registeredRule?.canonical?.path).toBe('src/components/shared/FilterButtonGroup.tsx');
expect(registeredRule?.canonical?.export).toBe('FilterButtonGroup');
@@ -400,6 +404,7 @@ describe('shared primitive guardrails', () => {
'src/components/Settings/ResourcePicker.tsx',
'src/components/Settings/ReportingPanel.tsx',
'src/features/patrol/PatrolIntelligenceHeader.tsx',
+ 'src/features/proxmox/ProxmoxBackupsTable.tsx',
]);
expect(registeredRule?.forbiddenPatterns).toEqual(
expect.arrayContaining([
@@ -410,6 +415,14 @@ describe('shared primitive guardrails', () => {
'<For each={RESOURCE_PICKER_TYPE_FILTERS}>',
]),
}),
+ expect.objectContaining({
+ path: 'src/features/proxmox/ProxmoxBackupsTable.tsx',
+ patterns: expect.arrayContaining([
+ 'const viewButtonClass',
+ 'inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1',
+ 'inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors',
+ ]),
+ }),
]),
);
expect(registeredGuard?.canonical?.path).toBe(
@@ -424,6 +437,18 @@ describe('shared primitive guardrails', () => {
expect(registeredGuard?.scopes).toEqual(
expect.arrayContaining(['src/components/Settings', 'src/features', 'src/pages']),
);
+ expect(registeredFeatureGuard?.canonical?.path).toBe(
+ 'src/components/shared/filterButtonGroupModel.ts',
+ );
+ expect(registeredFeatureGuard?.canonical?.export).toBe('getFilterButtonGroupButtonClass');
+ expect(registeredFeatureGuard?.allPatterns).toEqual([
+ 'inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1',
+ 'inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors',
+ ]);
+ expect(registeredFeatureGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(registeredFeatureGuard?.ignoredPaths).toEqual([
+ 'src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx',
+ ]);
expect(filterButtonGroupSource).toContain('useFilterButtonGroupState');
expect(filterButtonGroupSource).toContain('getFilterButtonGroupClass');
@@ -471,6 +496,16 @@ describe('shared primitive guardrails', () => {
expect(patrolIntelligenceHeaderSource).not.toContain(
'flex-1 py-1.5 px-2 text-xs font-semibold rounded-md transition-all duration-200',
);
+ expect(proxmoxBackupsTableSource).toContain('FilterButtonGroup');
+ expect(proxmoxBackupsTableSource).toContain('variant="segmented"');
+ expect(proxmoxBackupsTableSource).toContain('BACKUP_VIEW_OPTIONS');
+ expect(proxmoxBackupsTableSource).not.toContain('const viewButtonClass');
+ expect(proxmoxBackupsTableSource).not.toContain(
+ 'inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1',
+ );
+ expect(proxmoxBackupsTableSource).not.toContain(
+ 'inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors',
+ );
});
it('routes selectable scope pill buttons through SelectablePillButton', () => {
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index 9ba2d61621..f8a9813d87 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -4,6 +4,7 @@ import CalendarIcon from 'lucide-solid/icons/calendar';
import ShieldCheckIcon from 'lucide-solid/icons/shield-check';
import { useSearchParams } from '@solidjs/router';
import { FilterBar, type FilterDef, type FilterSelectOption } from '@/components/shared/FilterBar';
+import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { apiFetch } from '@/utils/apiClient';
import {
@@ -65,6 +66,11 @@ import { ProxmoxRecoverableTable } from './ProxmoxRecoverableTable';
type BackupView = 'date' | 'coverage';
+const BACKUP_VIEW_OPTIONS: FilterOption<BackupView>[] = [
+ { value: 'date', label: 'By date', compactLabel: 'Date', icon: CalendarIcon },
+ { value: 'coverage', label: 'Coverage', icon: ShieldCheckIcon },
+];
+
async function fetchPVEBackups(): Promise<PVEBackupsPayload> {
const response = await apiFetch('/api/backups/pve');
if (!response.ok) {
@@ -431,11 +437,6 @@ export const ProxmoxBackupsTable: Component<{
return filters;
};
- const viewButtonClass = (active: boolean): string =>
- `inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors ${
- active ? 'bg-surface-hover text-base-content' : 'text-muted hover:text-base-content'
- }`;
-
return (
<Show
when={!backups.error}
@@ -526,30 +527,14 @@ export const ProxmoxBackupsTable: Component<{
/>
</Show>
- <div
- role="group"
- aria-label="Backups view"
- class="inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1"
- >
- <button
- type="button"
- class={viewButtonClass(view() === 'date')}
- aria-pressed={view() === 'date'}
- onClick={() => setView('date')}
- >
- <CalendarIcon class="h-4 w-4" aria-hidden="true" />
- <span>By date</span>
- </button>
- <button
- type="button"
- class={viewButtonClass(view() === 'coverage')}
- aria-pressed={view() === 'coverage'}
- onClick={() => setView('coverage')}
- >
- <ShieldCheckIcon class="h-4 w-4" aria-hidden="true" />
- <span>Coverage</span>
- </button>
- </div>
+ <FilterButtonGroup
+ options={BACKUP_VIEW_OPTIONS}
+ value={view()}
+ onChange={setView}
+ ariaLabel="Backups view"
+ variant="segmented"
+ class="inline-flex w-fit"
+ />
<Show when={view() === 'date' && recoveryModel().recoverableArtifacts.length > 0}>
<BackupActivityChart
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index a9d63c7b27..f00e010596 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -220,7 +220,21 @@ describe('ProxmoxBackupsTable', () => {
await screen.findAllByText('pbs-docker');
+ expect(proxmoxBackupsTableSource).toContain(
+ "import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';",
+ );
+ expect(proxmoxBackupsTableSource).toContain('<FilterButtonGroup');
+ expect(proxmoxBackupsTableSource).toContain('variant="segmented"');
+ expect(proxmoxBackupsTableSource).not.toContain('const viewButtonClass');
+ expect(proxmoxBackupsTableSource).not.toContain(
+ 'inline-flex items-center gap-1 rounded-md border border-border bg-surface p-1',
+ );
+ expect(proxmoxBackupsTableSource).not.toContain(
+ 'inline-flex min-h-8 items-center gap-1.5 rounded-sm px-3 text-xs font-medium transition-colors',
+ );
+
// The two top-level views exist...
+ expect(screen.getByRole('group', { name: /backups view/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /by date/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /coverage/i })).toBeInTheDocument();
// ...and the old four-tab + sub-tab tree does not.