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.

feat(proxmox): URL-back backups scope filters and enable saved views

rcourtmanb3bdc701eff1
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index 5d19e17b7e..d327ec80d7 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -16,6 +16,7 @@ import ServerIcon from 'lucide-solid/icons/server';
import ShieldCheckIcon from 'lucide-solid/icons/shield-check';
import { Card } from '@/components/shared/Card';
import { EmptyState } from '@/components/shared/EmptyState';
+import { useSearchParams } from '@solidjs/router';
import { FilterBar, type FilterDef, type FilterSelectOption } from '@/components/shared/FilterBar';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { apiFetch } from '@/utils/apiClient';
@@ -225,6 +226,11 @@ export const ProxmoxBackupsTable: Component<{
const [backups, { refetch }] = createResource<PVEBackupsPayload>(fetchPVEBackups);
const [pbsBackups, { refetch: refetchPBS }] = createResource<PBSBackupsPayload>(fetchPBSBackups);
const { isMobile } = useBreakpoint();
+ // The structured scope filters (node, type) live in the URL so views are
+ // shareable, survive reload, and can be captured by FilterBar saved views
+ // (which persist the URL query string). Search, status facets, and the chart
+ // day stay ephemeral signals.
+ const [searchParams, setSearchParams] = useSearchParams();
const [tab, setTab] = createSignal<BackupTabId>('coverage');
const [sourceDetailTab, setSourceDetailTab] = createSignal<SourceDetailTabId>('pbs');
const [search, setSearch] = createSignal('');
@@ -240,7 +246,8 @@ export const ProxmoxBackupsTable: Component<{
const [snapshotFilter, setSnapshotFilter] = createSignal<SnapshotFilterValue>('all');
// Cross-tab scope filter: an empty value means "all nodes". Applied as a
// predicate in each tab's filter memo (PBS artifacts carry no node).
- const [nodeFilter, setNodeFilter] = createSignal('');
+ const nodeFilter = (): string => (typeof searchParams.node === 'string' ? searchParams.node : '');
+ const setNodeFilter = (value: string): void => setSearchParams({ node: value || null });
const nodeMatches = (node: string | undefined): boolean => {
const selected = nodeFilter();
return !selected || node === selected;
@@ -249,7 +256,8 @@ export const ProxmoxBackupsTable: Component<{
// PBS backupType use vm/ct/host; raw PVE tasks/archives/snapshots use
// qemu/lxc), so normalize each shape's type to a canonical vm/ct/host before
// comparing. Applies to every tab, PBS included (via backupType).
- const [typeFilter, setTypeFilter] = createSignal('');
+ const typeFilter = (): string => (typeof searchParams.type === 'string' ? searchParams.type : '');
+ const setTypeFilter = (value: string): void => setSearchParams({ type: value || null });
const canonicalGuestType = (raw: string | undefined): string => {
const t = (raw ?? '').toLowerCase();
if (t === 'vm' || t === 'qemu') return 'vm';
@@ -1495,6 +1503,7 @@ export const ProxmoxBackupsTable: Component<{
placeholder: 'Search backups by workload, node, source, or status',
}}
filters={buildBackupsFilters()}
+ savedViewsKey="proxmox-backups"
searchTrailing={
<Show when={selectedDateKey() !== null}>
<button
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index bd15ceb5ba..8c889d7472 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -1,9 +1,20 @@
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { Route, Router } from '@solidjs/router';
+import type { JSX } from 'solid-js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { ProxmoxBackupsTable } from '../ProxmoxBackupsTable';
import type { Resource } from '@/types/resource';
+// ProxmoxBackupsTable reads URL search params (node/type scope filters), so it
+// must render inside a Router context.
+const renderInRouter = (component: () => JSX.Element) =>
+ render(() => (
+ <Router>
+ <Route path="/" component={component} />
+ </Router>
+ ));
+
const apiFetchMock = vi.hoisted(() => vi.fn());
vi.mock('@/utils/apiClient', () => ({
@@ -120,7 +131,7 @@ describe('ProxmoxBackupsTable', () => {
it('shows PBS artifacts from the PBS backup endpoint when PBS is present', async () => {
mockBackupAPIs();
- render(() => (
+ renderInRouter(() => (
<ProxmoxBackupsTable emptyIcon={<span />} hasPBS workloads={[workloadResource]} />
));
@@ -142,7 +153,7 @@ describe('ProxmoxBackupsTable', () => {
it('omits PVE columns when the source cannot populate them', async () => {
mockBackupAPIs();
- render(() => <ProxmoxBackupsTable emptyIcon={<span />} hasPBS={false} />);
+ renderInRouter(() => <ProxmoxBackupsTable emptyIcon={<span />} hasPBS={false} />);
await fireEvent.click(await screen.findByRole('button', { name: /source details/i }));
await fireEvent.click(screen.getByRole('button', { name: 'Snapshots 1' }));
@@ -166,7 +177,7 @@ describe('ProxmoxBackupsTable', () => {
it('keeps restore points searchable while moving raw sources behind source details', async () => {
mockBackupAPIs();
- render(() => (
+ renderInRouter(() => (
<ProxmoxBackupsTable emptyIcon={<span />} hasPBS workloads={[workloadResource]} />
));
@@ -189,7 +200,7 @@ describe('ProxmoxBackupsTable', () => {
it('expands coverage rows to show inline restore evidence', async () => {
mockBackupAPIs();
- render(() => (
+ renderInRouter(() => (
<ProxmoxBackupsTable emptyIcon={<span />} hasPBS workloads={[workloadResource]} />
));