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.

Make the first-run Infrastructure screen readable and truthful

rcourtman7d520f9e0d30
diff --git a/frontend-modern/browser-verification/36a24b46e1ac1816.json b/frontend-modern/browser-verification/36a24b46e1ac1816.json
new file mode 100644
index 0000000000..a210de996f
--- /dev/null
+++ b/frontend-modern/browser-verification/36a24b46e1ac1816.json
@@ -0,0 +1,42 @@
+{
+ "version": 1,
+ "base_sha": "f89136e3838d03f457a2cd82ceeaf732c452fd24",
+ "verified_at": "2026-10-10T19:41:35Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx",
+ "frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts",
+ "frontend-modern/src/utils/infrastructureOnboardingPresentation.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx": "77d7305a3768d8377de8d0ba6f4f7236dd52fa546921323053fa115a6a91109e",
+ "frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts": "adec08da6b2b9259d0161ee55c84083cd9c0d94e56e09199342caa025ccb3372",
+ "frontend-modern/src/utils/infrastructureOnboardingPresentation.ts": "2f7821fa6e0c0aad53fd5937865496cc014cc562e71d43cfeddcd6ab0d9054ca"
+ },
+ "routes": [
+ "/settings/infrastructure"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "fresh install, nothing connected, discovery off (1440 and 375): supported-sources paragraph wraps in full, one Add infrastructure button, no Last scanned or Not configured text beside the Off badge",
+ "fresh install with discovery turned on and a scan in progress: Scanning and Started 0s ago",
+ "discovery on, scan finished and page not yet told the result: Ready with No scan result yet and a Run discovery button",
+ "page reloaded after the scan: Last scanned 15s ago matching the server updated timestamp, four discovered candidates listed (1440 and 375)",
+ "mock estate with 15 connected systems: connection posture band shows the systems count, active count, agent update count and Open Agent Doctor; no stray add or scan button. The Install agent summary button needs a Proxmox host without an agent, which this estate does not contain, so that button is covered by the component test only and was not seen in the browser"
+ ],
+ "interactions": [
+ "opened Configure discovery and switched on automatic scanning, which started a real scan",
+ "reloaded Settings Infrastructure to read the stored discovery result",
+ "resized between 1440x900 and 375x812 and re-read the empty and candidate states",
+ "read computed white-space on the empty-state paragraph chain to confirm the nowrap source and that the wrapper now wraps"
+ ]
+}
diff --git a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
index cf9f66f608..0463115211 100644
--- a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
@@ -42,7 +42,6 @@ import {
} from './connectionsTableModel';
import type { DiscoveredServer, DiscoveryScanStatus } from './infrastructureSettingsModel';
import {
- getInfrastructureCoverageCompleteActionPresentation,
getInfrastructureEmptyStateDetail,
getInfrastructureEmptyStateSummary,
getInfrastructureOnboardingProductPresentation,
@@ -205,14 +204,9 @@ const memberMethodPresentation = (
return infrastructureSourcePresentation(member.source);
};
-type SetupConfidenceActionKind = 'add' | 'agent' | 'scan';
-
interface SetupConfidenceAction {
- kind: SetupConfidenceActionKind;
label: string;
- detail: string;
- onClick?: () => void;
- disabled?: boolean;
+ onClick: () => void;
}
interface ConfiguredSourceGroup {
@@ -529,16 +523,6 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
infrastructureRows().flatMap((row) => missingAgentTargetNames(row)),
);
const uncoveredAgentTargetCount = createMemo(() => uncoveredAgentTargets().length);
- // Names list keeps the descriptive 'Install agents' hint actionable: when
- // there are 1 or 2 hosts missing an agent, surface their names directly so
- // the user knows exactly which boxes the install applies to.
- const uncoveredAgentTargetNamesText = createMemo(() => {
- const names = uncoveredAgentTargets().filter(Boolean);
- if (names.length === 0) return null;
- if (names.length === 1) return names[0];
- if (names.length === 2) return `${names[0]} and ${names[1]}`;
- return null;
- });
// Counters read directly off the row state the user sees: a row is live
// when its status is "Active" and needs attention when its derived
// problem (or any member's) is non-empty. Going via signal predicates
@@ -594,25 +578,16 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
return `Started ${formatRelativeTimestamp(status.lastScanStartedAt) ?? 'just now'}`;
}
if (lastDiscoveryResultText()) return `Last scanned ${lastDiscoveryResultText()}`;
- return props.discoveryEnabled ? 'Never scanned' : 'Not configured';
+ // Off with no result says nothing more than the Off badge beside it. A
+ // manual scan's result is not stored server-side, so after a reload "never
+ // scanned" could be false; "no result yet" is true either way.
+ return props.discoveryEnabled ? 'No scan result yet' : '';
});
- const setupConfidenceAction = createMemo<SetupConfidenceAction>(() => {
- if (connectedSystemCount() === 0) {
- // Distinct from the page-header 'Add infrastructure' CTA, which is
- // also visible in the zero-connected state; two identically named
- // buttons on one page are ambiguous for assistive tech (and for
- // accessible-name locators).
- return {
- kind: 'add',
- label: 'Add your first system',
- detail: 'Add a platform, host, NAS, or cluster to start monitoring.',
- onClick: props.onAddInfrastructure,
- };
- }
-
+ // Follow-up action for systems that are already connected. With none
+ // connected the page-header 'Add infrastructure' button is the one way in,
+ // so this band offers nothing rather than a second button for the same job.
+ const setupConfidenceAction = createMemo<SetupConfidenceAction | undefined>(() => {
if (uncoveredAgentTargetCount() > 0 && (props.onAddSourceStep || props.onAddSource)) {
- const namesText = uncoveredAgentTargetNamesText();
- const target = namesText ?? formatCount(uncoveredAgentTargetCount(), 'Proxmox host');
// When every uncovered host sits in one cluster that can install from a
// sibling, the summary action opens that one-step install directly.
const uncoveredRows = infrastructureRows().filter((row) => rowNeedsAgentCoverage(row));
@@ -621,29 +596,12 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
? uncoveredRows[0]
: undefined;
return {
- kind: 'agent',
label: uncoveredAgentTargetCount() === 1 ? 'Install agent' : 'Install agents',
- detail: `Install one Pulse Agent on each uncovered Proxmox host (${target}) to add node-local telemetry such as temperatures, SMART data, and host identity.`,
onClick: soleCluster ? () => handleInstallAgent(soleCluster) : handleInstallAgentShortcut,
};
}
- if (props.onRunDiscovery && props.discoveryEnabled && !lastDiscoveryResultText()) {
- return {
- kind: 'scan',
- label: props.discoveryScanStatus().scanning ? 'Scanning networks' : 'Scan networks',
- detail: `Run discovery to check whether more ${discoveryScanTargetLabel} are waiting on the configured networks.`,
- onClick: props.onRunDiscovery,
- disabled: props.discoveryScanStatus().scanning,
- };
- }
-
- const completeAction = getInfrastructureCoverageCompleteActionPresentation();
- return {
- kind: 'add',
- label: completeAction.label,
- detail: completeAction.detail,
- };
+ return undefined;
});
const [layoutWidth, setLayoutWidth] = createSignal(
typeof window !== 'undefined' ? window.innerWidth : 1024,
@@ -700,20 +658,6 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
});
const useCardLayout = createMemo(() => layoutWidth() <= CARD_LAYOUT_MAX_WIDTH_PX);
- const setupConfidenceActionIcon = (kind: SetupConfidenceActionKind) => (
- <>
- <Show when={kind === 'agent'}>
- <Cpu class="h-4 w-4" />
- </Show>
- <Show when={kind === 'scan'}>
- <RotateCw class={`h-4 w-4 ${props.discoveryScanStatus().scanning ? 'animate-spin' : ''}`} />
- </Show>
- <Show when={kind === 'add'}>
- <Plus class="h-4 w-4" />
- </Show>
- </>
- );
-
const discoveryMonitorBand = () => (
<section
aria-label="Discover Proxmox systems"
@@ -743,7 +687,9 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
>
{discoveryMonitorTitle()}
</span>
- <span class="text-xs text-muted">{discoveryMonitorMeta()}</span>
+ <Show when={discoveryMonitorMeta()}>
+ <span class="text-xs text-muted">{discoveryMonitorMeta()}</span>
+ </Show>
</div>
<p class="mt-1 max-w-4xl text-xs leading-5 text-muted">{discoveryMonitorDetail()}</p>
<Show when={discoveryErrorSummary(props.discoveryScanStatus().errors)}>
@@ -864,31 +810,31 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
Open Agent Doctor
</Button>
</Show>
- <Show when={Boolean(setupConfidenceAction().onClick)}>
- <Button
- type="button"
- variant="secondary"
- size="mdCompact"
- onClick={() => setupConfidenceAction().onClick?.()}
- disabled={setupConfidenceAction().disabled}
- class="min-h-11 gap-2 lg:min-h-9"
- >
- {setupConfidenceActionIcon(setupConfidenceAction().kind)}
- {setupConfidenceAction().label}
- </Button>
+ <Show when={setupConfidenceAction()}>
+ {(action) => (
+ <Button
+ type="button"
+ variant="secondary"
+ size="mdCompact"
+ onClick={() => action().onClick()}
+ class="min-h-11 gap-2 lg:min-h-9"
+ >
+ <Cpu class="h-4 w-4" />
+ {action().label}
+ </Button>
+ )}
</Show>
</div>
</Show>
</div>
-
- <Show when={connectedSystemCount() === 0}>
- <p class="mt-2 text-xs leading-5 text-muted">{setupConfidenceAction().detail}</p>
- </Show>
</section>
);
+ // Rendered inside a `.table-fixed` cell, whose global rule forces nowrap on
+ // the cell itself (and a utility class on the cell loses to it), so the
+ // wrapper resets wrapping: the prose below must wrap, not clip.
const emptyStateContent = () => (
- <div class="mx-auto max-w-3xl space-y-2">
+ <div class="mx-auto max-w-3xl space-y-2 whitespace-normal">
<div class="text-sm font-semibold text-base-content">Start monitoring infrastructure</div>
<p>{getInfrastructureEmptyStateSummary()}</p>
<p class="text-xs leading-5 text-muted">{getInfrastructureEmptyStateDetail()}</p>
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index 709a76fd28..9e539b5431 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -760,6 +760,63 @@ describe('InfrastructureWorkspace', () => {
expect(screen.getByText(/Pulse Agent hosts/i)).toBeInTheDocument();
});
+ it('offers one way to add the first system and lets the source list wrap', async () => {
+ connectionState.connections = [];
+ connectionState.rows = [];
+
+ renderWorkspace();
+
+ await waitFor(() =>
+ expect(screen.getByText('Start monitoring infrastructure')).toBeInTheDocument(),
+ );
+ // The page-header button is the only add action; a second one for the same
+ // job, and its repeated sentence, read as two different choices.
+ expect(
+ screen.getAllByRole('button', { name: /^Add (infrastructure|your first system)$/i }),
+ ).toHaveLength(1);
+ expect(screen.queryByText('Add your first system')).not.toBeInTheDocument();
+ expect(
+ screen.queryByText('Add a platform, host, NAS, or cluster to start monitoring.'),
+ ).not.toBeInTheDocument();
+ // The cell hosting this prose sits in a `.table-fixed` table whose global
+ // rule forces nowrap, so the wrapper itself has to opt back into wrapping.
+ expect(screen.getByText('Start monitoring infrastructure').parentElement).toHaveClass(
+ 'whitespace-normal',
+ );
+ });
+
+ it('does not claim a scan time or a configured state before discovery has ever run', async () => {
+ connectionState.connections = [];
+ connectionState.rows = [];
+
+ renderWorkspace({
+ discoveryEnabled: () => false,
+ discoveryScanStatus: () => ({ scanning: false }),
+ });
+
+ await waitFor(() =>
+ expect(screen.getByRole('region', { name: 'Discover Proxmox systems' })).toBeInTheDocument(),
+ );
+ const band = screen.getByRole('region', { name: 'Discover Proxmox systems' });
+ expect(band).toHaveTextContent('Off');
+ expect(band).not.toHaveTextContent(/Last scanned/i);
+ expect(band).not.toHaveTextContent(/Not configured/i);
+ });
+
+ it('says there is no scan result yet when discovery is on but has none', async () => {
+ connectionState.connections = [];
+ connectionState.rows = [];
+
+ renderWorkspace({
+ discoveryEnabled: () => true,
+ discoveryScanStatus: () => ({ scanning: false }),
+ });
+
+ const band = await screen.findByRole('region', { name: 'Discover Proxmox systems' });
+ expect(band).toHaveTextContent('No scan result yet');
+ expect(band).not.toHaveTextContent(/Last scanned/i);
+ });
+
it('routes discovery actions from the manager and shows discovered candidates in the matching platform group', async () => {
const triggerDiscoveryScan = vi.fn();
renderWorkspace({
diff --git a/frontend-modern/src/components/Settings/__tests__/useInfrastructureDiscoveryRuntimeState.test.tsx b/frontend-modern/src/components/Settings/__tests__/useInfrastructureDiscoveryRuntimeState.test.tsx
index bbad83c887..b442a0a51f 100644
--- a/frontend-modern/src/components/Settings/__tests__/useInfrastructureDiscoveryRuntimeState.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/useInfrastructureDiscoveryRuntimeState.test.tsx
@@ -160,4 +160,43 @@ describe('useInfrastructureDiscoveryRuntimeState', () => {
dispose();
});
+
+ it('does not date a never-scanned stored result as a scan that just ran', async () => {
+ // A fresh install answers GET /api/discover with `updated: 0`.
+ apiFetchMock.mockResolvedValue({
+ ok: true,
+ json: async () => ({ servers: [], errors: [], updated: 0, cached: false }),
+ });
+
+ const { dispose, state } = mountHook();
+
+ await state.loadDiscoveredNodes();
+
+ expect(state.discoveredNodes()).toEqual([]);
+ expect(state.discoveryScanStatus().scanning).toBe(false);
+ expect(state.discoveryScanStatus().lastResultAt).toBeUndefined();
+
+ dispose();
+ });
+
+ it('keeps the last real scan time when a later load carries none', async () => {
+ apiFetchMock.mockResolvedValueOnce({
+ ok: true,
+ json: async () => ({ servers: [], errors: [], timestamp: 1_700_000_000_000 }),
+ });
+ apiFetchMock.mockResolvedValueOnce({
+ ok: true,
+ json: async () => ({ servers: [], errors: [], updated: 0 }),
+ });
+
+ const { dispose, state } = mountHook();
+
+ await state.triggerDiscoveryScan({ quiet: true });
+ expect(state.discoveryScanStatus().lastResultAt).toBe(1_700_000_000_000);
+
+ await state.loadDiscoveredNodes();
+ expect(state.discoveryScanStatus().lastResultAt).toBe(1_700_000_000_000);
+
+ dispose();
+ });
});
diff --git a/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts b/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts
index b78ab07e7a..bc256d2a4a 100644
--- a/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts
+++ b/frontend-modern/src/components/Settings/useInfrastructureDiscoveryRuntimeState.ts
@@ -164,11 +164,6 @@ export const useInfrastructureDiscoveryRuntimeState = ({
} else {
setDiscoveredNodes(filtered);
}
-
- setDiscoveryScanStatus((previous) => ({
- ...previous,
- lastResultAt: Date.now(),
- }));
};
const loadDiscoveredNodes = async () => {
@@ -192,10 +187,12 @@ export const useInfrastructureDiscoveryRuntimeState = ({
const responseTimestamp = normalizeDiscoveryTimestamp(data?.timestamp ?? data?.updated);
if (Array.isArray(data.servers)) {
updateDiscoveredNodesFromServers(data.servers as RawDiscoveredServer[]);
+ // Loading the stored result is not a scan. A fresh install answers
+ // `updated: 0`, and dating that "now" reads as "Last scanned 0s ago".
setDiscoveryScanStatus((previous) => ({
...previous,
scanning: false,
- lastResultAt: responseTimestamp ?? Date.now(),
+ lastResultAt: responseTimestamp ?? previous.lastResultAt,
errors: Array.isArray(data.errors) && data.errors.length > 0 ? data.errors : undefined,
}));
return;
diff --git a/frontend-modern/src/utils/__tests__/infrastructureOnboardingPresentation.test.ts b/frontend-modern/src/utils/__tests__/infrastructureOnboardingPresentation.test.ts
index a3dbd45337..20477a6ccb 100644
--- a/frontend-modern/src/utils/__tests__/infrastructureOnboardingPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/infrastructureOnboardingPresentation.test.ts
@@ -1,7 +1,6 @@
import { describe, expect, it } from 'vitest';
import {
getInfrastructureAgentHostProfileSupportText,
- getInfrastructureCoverageCompleteActionPresentation,
getInfrastructureApiProductsByGovernanceState,
getInfrastructureAutoDetectLabels,
getInfrastructureEmptyStateDetail,
@@ -240,11 +239,4 @@ describe('infrastructureOnboardingPresentation', () => {
label: 'Kubernetes',
});
});
-
- it('owns the source-manager coverage-complete copy outside the component', () => {
- expect(getInfrastructureCoverageCompleteActionPresentation()).toEqual({
- label: 'Coverage coherent',
- detail: 'Coverage looks coherent for the connected systems.',
- });
- });
});
diff --git a/frontend-modern/src/utils/infrastructureOnboardingPresentation.ts b/frontend-modern/src/utils/infrastructureOnboardingPresentation.ts
index 509a7cb05b..cab5277f24 100644
--- a/frontend-modern/src/utils/infrastructureOnboardingPresentation.ts
+++ b/frontend-modern/src/utils/infrastructureOnboardingPresentation.ts
@@ -86,11 +86,6 @@ export interface InfrastructureOnboardingPathPresentation {
coverage: string;
}
-export interface InfrastructureCoverageCompleteActionPresentation {
- label: string;
- detail: string;
-}
-
const INFRASTRUCTURE_AGENT_RUNTIME_PLATFORM_LABELS = [
'Linux',
'macOS',
@@ -545,9 +540,3 @@ export const getInfrastructureEmptyStateSummary = (): string =>
export const getInfrastructureEmptyStateDetail = (): string =>
'Supported source types include TrueNAS SCALE, Proxmox VE, Proxmox Backup Server, Proxmox Mail Gateway, and Pulse Agent hosts. VMware vCenter is available as a preview platform while live support is validated. Docker and Kubernetes are discovered from supported agent hosts.';
-
-export const getInfrastructureCoverageCompleteActionPresentation =
- (): InfrastructureCoverageCompleteActionPresentation => ({
- label: 'Coverage coherent',
- detail: 'Coverage looks coherent for the connected systems.',
- });