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.

Revert "proxmox: promote cross-source backup coverage onto the front-door overview"

rcourtmane57373897725
diff --git a/frontend-modern/src/features/proxmox/ProxmoxOverviewCoverageStrip.tsx b/frontend-modern/src/features/proxmox/ProxmoxOverviewCoverageStrip.tsx
deleted file mode 100644
index 473c94b95d..0000000000
--- a/frontend-modern/src/features/proxmox/ProxmoxOverviewCoverageStrip.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import { Show, createMemo, createResource, type Component } from 'solid-js';
-import { apiFetch } from '@/utils/apiClient';
-import type {
- PBSBackupsPayload,
- PBSBackupsResponse,
- PVEBackupsPayload,
- PVEBackupsResponse,
-} from '@/types/api';
-import type { Resource } from '@/types/resource';
-import { buildProxmoxBackupRecoveryModel } from './proxmoxBackupRecoveryModel';
-import { ProxmoxBackupsCoverageStrip } from './ProxmoxBackupsCoverageStrip';
-
-// Promotes Pulse's cross-source backup coverage signal (Proxmox guests x PBS)
-// onto the front-door Overview, so the first thing an operator sees is the
-// protection posture of the estate — the value no individual tool gives —
-// rather than a re-render of Proxmox's own node/workload telemetry. The strip
-// reuses the same recovery model and presentation as the Backups tab; the
-// backups payloads are fetched async (createResource) so the Overview paint is
-// not blocked and the strip fills in once coverage resolves.
-
-async function fetchPVEBackups(): Promise<PVEBackupsPayload> {
- const response = await apiFetch('/api/backups/pve');
- if (!response.ok) {
- throw new Error(`Failed to load PVE backups (${response.status})`);
- }
- const payload = (await response.json()) as PVEBackupsResponse;
- return (
- payload?.data ?? {
- backupTasks: [],
- storageBackups: [],
- guestSnapshots: [],
- }
- );
-}
-
-async function fetchPBSBackups(): Promise<PBSBackupsPayload> {
- const response = await apiFetch('/api/backups/pbs');
- if (!response.ok) {
- throw new Error(`Failed to load PBS backups (${response.status})`);
- }
- const payload = (await response.json()) as PBSBackupsResponse;
- return payload?.data ?? { backups: [] };
-}
-
-export const ProxmoxOverviewCoverageStrip: Component<{
- workloads: readonly Resource[];
-}> = (props) => {
- const [backups] = createResource(fetchPVEBackups);
- const [pbsBackups] = createResource(fetchPBSBackups);
-
- const nowMs = createMemo(() => Date.now());
- const recoveryModel = createMemo(() =>
- buildProxmoxBackupRecoveryModel({
- workloads: props.workloads,
- pbsBackups: pbsBackups()?.backups ?? [],
- archives: backups()?.storageBackups ?? [],
- snapshots: backups()?.guestSnapshots ?? [],
- tasks: backups()?.backupTasks ?? [],
- nowMs: nowMs(),
- }),
- );
- const coverage = () => recoveryModel().coverageSummary;
-
- return (
- <Show when={backups() !== undefined && pbsBackups() !== undefined}>
- <ProxmoxBackupsCoverageStrip
- title="Backup coverage"
- tail={<span>{props.workloads.length} targets</span>}
- segments={[
- {
- key: 'current',
- value: coverage().current,
- label: 'current',
- toneClass: 'bg-emerald-500',
- },
- {
- key: 'attention',
- value: coverage().attention,
- label: 'attention',
- toneClass: 'bg-amber-500',
- muted: coverage().attention === 0,
- },
- {
- key: 'uncovered',
- value: coverage().uncovered,
- label: 'uncovered',
- toneClass: 'bg-red-500',
- muted: coverage().uncovered === 0,
- },
- ]}
- />
- </Show>
- );
-};
-
-export default ProxmoxOverviewCoverageStrip;
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index e49cfaaf58..18f3488f02 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -39,7 +39,6 @@ import { ProxmoxBackupsTable } from './ProxmoxBackupsTable';
import { ProxmoxCephTable } from './ProxmoxCephTable';
import { ProxmoxMailGatewayTable } from './ProxmoxMailGatewayTable';
import { ProxmoxNodesTable } from './ProxmoxNodesTable';
-import { ProxmoxOverviewCoverageStrip } from './ProxmoxOverviewCoverageStrip';
import { ProxmoxReplicationTable, fetchReplicationJobs } from './ProxmoxReplicationTable';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
import { updateStore } from '@/stores/updates';
@@ -292,9 +291,6 @@ function ProxmoxOverview(props: ProxmoxOverviewProps) {
return (
<div class="space-y-4">
- <Show when={props.model().summary.guestCount > 0}>
- <ProxmoxOverviewCoverageStrip workloads={props.model().guests} />
- </Show>
<Show when={showSharedFilterToolbar()}>
<div data-summary-clear-ignore>
<WorkloadsFilter
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxOverviewCoverageStrip.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxOverviewCoverageStrip.test.tsx
deleted file mode 100644
index 3ace5e640d..0000000000
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxOverviewCoverageStrip.test.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { render, screen, waitFor } from '@solidjs/testing-library';
-import { describe, expect, it, vi } from 'vitest';
-import type { Resource } from '@/types/resource';
-import { ProxmoxOverviewCoverageStrip } from '../ProxmoxOverviewCoverageStrip';
-
-const mockApiFetch = vi.hoisted(() => vi.fn());
-
-vi.mock('@/utils/apiClient', () => ({
- apiFetch: (...args: unknown[]) => mockApiFetch(...(args as [string])),
-}));
-
-const workload = (id: string): Resource =>
- ({
- id,
- type: 'vm',
- name: id,
- displayName: id,
- platformId: 'pve-1',
- platformType: 'proxmox-pve',
- sourceType: 'api',
- sources: ['proxmox'],
- status: 'online',
- lastSeen: Date.now(),
- }) as Resource;
-
-describe('ProxmoxOverviewCoverageStrip', () => {
- it('renders the backup coverage strip once backups resolve', async () => {
- mockApiFetch.mockImplementation(async (url: string) => ({
- ok: true,
- json: async () =>
- url.includes('/pbs')
- ? { data: { backups: [] } }
- : { data: { backupTasks: [], storageBackups: [], guestSnapshots: [] } },
- }));
-
- render(() => <ProxmoxOverviewCoverageStrip workloads={[workload('vm-100')]} />);
-
- await waitFor(() =>
- expect(screen.getByText('Backup coverage')).toBeInTheDocument(),
- );
- });
-
- it('renders nothing while backups are still loading', () => {
- // A fetch that never resolves keeps the strip in its loading state.
- mockApiFetch.mockReturnValue(new Promise(() => {}));
-
- render(() => <ProxmoxOverviewCoverageStrip workloads={[workload('vm-100')]} />);
-
- expect(screen.queryByText('Backup coverage')).toBeNull();
- });
-});
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
index bdf7369ed5..abe29b247b 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -93,10 +93,6 @@ vi.mock('../ProxmoxBackupsTable', () => ({
ProxmoxBackupsTable: () => <div data-testid="backups-table" />,
}));
-vi.mock('../ProxmoxOverviewCoverageStrip', () => ({
- ProxmoxOverviewCoverageStrip: () => <div data-testid="overview-coverage-strip" />,
-}));
-
vi.mock('../ProxmoxCephTable', () => ({
ProxmoxCephTable: () => <div data-testid="ceph-table" />,
}));