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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Canonicalize setup completion next-step model
rcourtman763b3a4823ba
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex a463d73638..fa0ceb8aa4 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -223,6 +223,14 @@ management, and fleet control surfaces.future provider integrations rather than leaving post-setup next actionsimplicit. That API-backed alternative must be a real first-run handoffcontrol, not prose-only guidance.+ Once the completion surface observes connected systems, that same handoff+ model must derive its follow-up actions from the canonical connected-system+ path classification rather than a raw connected-agent count. API-backed+ first-session states must keep `Platform connections` visible without+ hiding `Infrastructure Install` when the next system should run the unified+ agent, and install-managed first-session states must not suppress the+ explicit API-backed alternative when the runtime has already connected+ platform-owned systems.6. Keep `frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx`oriented around the first monitored host. Install-token generation,governed command copy, and install instructions belong to the canonicaldiff --git a/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx b/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsxindex 4a781bd99e..0acc0e9717 100644--- a/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx+++ b/frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx@@ -9,28 +9,17 @@ import {For,} from 'solid-js';import { useNavigate } from '@solidjs/router';-import { unwrap } from 'solid-js/store';import { copyToClipboard } from '@/utils/clipboard';import { logger } from '@/utils/logger';import { apiFetchJSON } from '@/utils/apiClient';import { getPulseBaseUrl } from '@/utils/url';import type { State } from '@/types/api';-import type { Resource } from '@/types/resource';import { showSuccess, showError } from '@/utils/toast';-import {- getActionableAgentIdFromResource,- isAgentFacetInfrastructureResource,- hasAgentFacet as resourceHasAgentFacet,-} from '@/utils/agentResources';import {trackAgentFirstConnected,trackPaywallViewed,trackUpgradeClicked,} from '@/utils/upgradeMetrics';-import {- getPreferredInfrastructureDisplayName,- getPreferredResourceHostname,-} from '@/utils/resourceIdentity';import {isCommercialTrialActive,loadCommercialPosture,@@ -43,6 +32,10 @@ import {} from '@/utils/relayPresentation';import { runStartProTrialAction } from '@/utils/trialStartAction';import type { WizardState } from '../SetupWizard';+import {+ buildSetupCompletionConnectedSystems,+ buildSetupCompletionViewModel,+} from './setupCompletionModel';interface CompleteStepProps {state: WizardState;@@ -52,7 +45,7 @@ interface CompleteStepProps {const UNIFIED_RESOURCE_GUIDANCE = {title: 'What happens next',description:- 'Pulse is now secured. Next, choose the first infrastructure path: use Infrastructure Install for a host that should run the unified agent, or use Platform connections for API-backed platforms like Proxmox and TrueNAS.',+ 'Pulse is now secured. Next, choose the first infrastructure path: use Infrastructure Install for a host that should run the unified agent, or use Platform connections for API-backed platforms like Proxmox, TrueNAS, and VMware.',steps: [{title: 'Open Infrastructure Install',@@ -73,70 +66,33 @@ const UNIFIED_RESOURCE_GUIDANCE = {inventoryFacts: ['Start with one host, then add more systems later from the same install workspace.','Infrastructure Install owns the token, connection URL, TLS/CA settings, and platform-specific commands.',- 'API-backed platforms like Proxmox and TrueNAS use Platform connections instead of a dedicated install profile in Infrastructure Install.',+ 'API-backed platforms like Proxmox, TrueNAS, and VMware use Platform connections instead of a dedicated install profile in Infrastructure Install.',],} as const;-interface ConnectedAgent {- id: string;- name: string;- type: string;- host: string;- addedAt: Date;-}-const RELAY_SETTINGS_PATH = '/settings/system-relay';const INFRASTRUCTURE_INSTALL_PATH = '/settings/infrastructure/install';const INFRASTRUCTURE_PLATFORMS_PATH = '/settings/infrastructure/platforms';const SETUP_WIZARD_TELEMETRY_SURFACE = 'setup_wizard_complete';-const pd = (resource: Resource) =>- resource.platformData ? (unwrap(resource.platformData) as Record<string, unknown>) : undefined;-const asRecord = (value: unknown): Record<string, unknown> | undefined =>- value && typeof value === 'object' ? (value as Record<string, unknown>) : undefined;-const asString = (value: unknown): string | undefined =>- typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;-const hasAgentFacet = (resource: Resource): boolean => resourceHasAgentFacet(resource);--const toNodeSummaryShape = (resource: Resource) => {- const platformData = pd(resource);- const proxmox = asRecord(platformData?.proxmox);- const name = getPreferredInfrastructureDisplayName(resource);- return {- id: resource.id,- name,- displayName: name,- host: asString(proxmox?.instance) || '',- };-};--const toAgentSummaryShape = (resource: Resource) => {- const hostname = getPreferredResourceHostname(resource) || resource.id;- const name = getPreferredInfrastructureDisplayName(resource);- const id = getActionableAgentIdFromResource(resource) || resource.id;- return {- id,- hostname,- displayName: name,- };-};-export const SetupCompletionPanel: Component<CompleteStepProps> = (props) => {const navigate = useNavigate();const [copied, setCopied] = createSignal<'password' | 'admin-token' | null>(null);const [showCredentials, setShowCredentials] = createSignal(true);- const [connectedAgents, setConnectedAgents] = createSignal<ConnectedAgent[]>([]);+ const [connectedSystems, setConnectedSystems] = createSignal<+ ReturnType<typeof buildSetupCompletionConnectedSystems>+ >([]);const [trialStarting, setTrialStarting] = createSignal(false);const [trialStarted, setTrialStarted] = createSignal(false);const [relayPaywallTracked, setRelayPaywallTracked] = createSignal(false);- let firstConnectionTracked = false;+ let firstAgentConnectionTracked = false;onMount(() => {void loadCommercialPosture();});createEffect(() => {- if (connectedAgents().length > 0 && !relayPaywallTracked()) {+ if (connectedSystems().length > 0 && !relayPaywallTracked()) {trackPaywallViewed('relay', 'setup_wizard');setRelayPaywallTracked(true);}@@ -146,97 +102,52 @@ export const SetupCompletionPanel: Component<CompleteStepProps> = (props) => {let pollInterval: number | undefined;let previousCount = 0;- const checkForAgents = async () => {+ const checkForConnectedSystems = async () => {try {const state = await apiFetchJSON<State>('/api/state', {headers: {'X-API-Token': props.state.apiToken,},});- const resources = state.resources || [];- const nodeResources = resources.filter((resource) => resource.type === 'agent');- const agentFacetResources = resources.filter((resource) =>- isAgentFacetInfrastructureResource(resource),- );-- const nodes = nodeResources.map(toNodeSummaryShape);- const agents = agentFacetResources.map(toAgentSummaryShape);- const agentMap = new Map<string, ConnectedAgent>();-- for (const node of nodes) {- const name = node.displayName || node.name || 'Unknown';- const existing = agentMap.get(name);- if (existing) {- if (!existing.type.includes('Proxmox')) {- existing.type = `${existing.type} + Proxmox VE`;- }- if (node.host && !existing.host) {- existing.host = node.host;- }- } else {- agentMap.set(name, {- id: node.id || `node-${name}`,- name,- type: 'Proxmox VE',- host: node.host || '',- addedAt: new Date(),- });- }- }-- for (const agent of agents) {- const name = agent.displayName || agent.hostname || 'Unknown';- const existing = agentMap.get(name);- if (existing) {- if (!existing.type.includes('Agent')) {- existing.type = `${existing.type} + Agent`;- }- } else {- agentMap.set(name, {- id: agent.id || `agent-${name}`,- name,- type: 'Agent',- host: '',- addedAt: new Date(),- });- }- }-- const nextConnectedAgents = Array.from(agentMap.values());- const totalAgents = nextConnectedAgents.length;- const previousAgents = connectedAgents();+ const nextConnectedSystems = buildSetupCompletionConnectedSystems(state.resources || []);+ const totalConnectedSystems = nextConnectedSystems.length;+ const previousSystems = connectedSystems();const hasConnectionChanges =- totalAgents !== previousAgents.length ||- nextConnectedAgents.some((agent, index) => {- const previousAgent = previousAgents[index];+ totalConnectedSystems !== previousSystems.length ||+ nextConnectedSystems.some((system, index) => {+ const previousSystem = previousSystems[index];return (- !previousAgent ||- previousAgent.id !== agent.id ||- previousAgent.name !== agent.name ||- previousAgent.type !== agent.type ||- previousAgent.host !== agent.host+ !previousSystem ||+ previousSystem.id !== system.id ||+ previousSystem.name !== system.name ||+ previousSystem.typeLabel !== system.typeLabel ||+ previousSystem.host !== system.host ||+ previousSystem.connectionPath !== system.connectionPath);});- if (!firstConnectionTracked && totalAgents > 0) {+ if (+ !firstAgentConnectionTracked &&+ nextConnectedSystems.some((system) => system.connectionPath === 'install')+ ) {trackAgentFirstConnected(SETUP_WIZARD_TELEMETRY_SURFACE, 'first_agent');- firstConnectionTracked = true;+ firstAgentConnectionTracked = true;}if (hasConnectionChanges) {- setConnectedAgents(nextConnectedAgents);+ setConnectedSystems(nextConnectedSystems);}- if (hasConnectionChanges || totalAgents !== previousCount) {- previousCount = totalAgents;+ if (hasConnectionChanges || totalConnectedSystems !== previousCount) {+ previousCount = totalConnectedSystems;}} catch (error) {- logger.error('Failed to check for agents:', error);+ logger.error('Failed to check for connected systems:', error);}};- pollInterval = window.setInterval(checkForAgents, 3000);- void checkForAgents();+ pollInterval = window.setInterval(checkForConnectedSystems, 3000);+ void checkForConnectedSystems();onCleanup(() => {if (pollInterval) {@@ -286,7 +197,7 @@ Use the Infrastructure Install workspace to:- copy Linux, macOS, Windows, and related install commandsUse the Platform connections workspace when:-- the first system is API-backed, such as Proxmox or TrueNAS+- the first system is API-backed, such as Proxmox, TrueNAS, or VMware- Pulse should poll that platform directly instead of starting with a host installKeep these credentials secure!@@ -341,7 +252,9 @@ Keep these credentials secure!navigate(RELAY_SETTINGS_PATH);};- const hasConnectedAgents = createMemo(() => connectedAgents().length > 0);+ const completionViewModel = createMemo(() =>+ buildSetupCompletionViewModel(connectedSystems()),+ );return (<div class="max-w-2xl mx-auto bg-surface border border-border overflow-hidden animate-fade-in relative rounded-md p-6 sm:p-8 text-center text-base-content">@@ -359,16 +272,14 @@ Keep these credentials secure!</svg></div><h1 class="text-2xl sm:text-3xl font-bold tracking-tight text-base-content mb-2">- {hasConnectedAgents() ? 'First monitored host connected' : 'Install your first monitored host'}+ {completionViewModel().heroTitle}</h1><p class="text-slate-500 dark:text-emerald-300 font-light text-sm sm:text-base">- {hasConnectedAgents()- ? 'Your admin account is ready and Pulse is already receiving telemetry. Open the dashboard to verify your first overview, or return to Infrastructure Install when you want to add more systems.'- : 'Your admin account is ready. Next, open Infrastructure Install and run the generated command on the first system you want Pulse to monitor.'}+ {completionViewModel().heroDescription}</p></div>- <Show when={connectedAgents().length > 0}>+ <Show when={completionViewModel().hasConnectedSystems}><div class="bg-emerald-50 dark:bg-emerald-900 rounded-md border border-emerald-200 dark:border-emerald-800 p-5 text-left mb-6"><h3 class="text-sm font-semibold text-emerald-800 dark:text-emerald-400 mb-3 flex items-center gap-2"><svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">@@ -379,23 +290,22 @@ Keep these credentials secure!d="M5 13l4 4L19 7"/></svg>- Connected ({connectedAgents().length} agent{connectedAgents().length !== 1 ? 's' : ''}- )+ {completionViewModel().connectedSummaryLabel}</h3><div class="space-y-2">- <For each={connectedAgents()}>- {(agent) => (+ <For each={connectedSystems()}>+ {(system) => (<div class="flex items-center justify-between bg-surface rounded-md px-3 py-2.5 border border-border-subtle"><div class="flex items-center gap-2.5"><span class="w-2.5 h-2.5 bg-emerald-500 rounded-full"></span>- <span class="text-base-content text-sm font-medium">{agent.name}</span>+ <span class="text-base-content text-sm font-medium">{system.name}</span></div><div class="flex items-center gap-2"><span class="text-[10px] text-emerald-700 dark:text-emerald-300 bg-emerald-100 dark:bg-emerald-900 border border-emerald-200 dark:border-emerald-800 px-2 py-0.5 rounded-full font-medium">- {agent.type}+ {system.typeLabel}</span>- <Show when={agent.host}>- <span class="text-[10px] text-muted font-mono">{agent.host}</span>+ <Show when={system.host}>+ <span class="text-[10px] text-muted font-mono">{system.host}</span></Show></div></div>@@ -435,7 +345,7 @@ Keep these credentials secure!</span><p class="mt-1 text-xs text-muted max-w-xl">Save the admin login and API token before leaving this screen, then continue into{' '}- {hasConnectedAgents() ? 'the dashboard or Infrastructure Install.' : 'Infrastructure Install for the first host.'}+ {completionViewModel().credentialsContinuationText}</p></div></div>@@ -622,7 +532,7 @@ Keep these credentials secure!What to expect</div><div class="rounded-sm bg-emerald-100 px-2 py-1 text-[10px] font-medium text-emerald-800 dark:bg-emerald-900 dark:text-emerald-300">- First host first+ First system first</div></div><div class="space-y-2">@@ -655,11 +565,11 @@ Keep these credentials secure!d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>- {hasConnectedAgents() ? 'Open your first dashboard view' : 'Install your first host'}+ {completionViewModel().nextStepTitle}</h3><p class="mt-2 text-xs text-muted max-w-xl">- {hasConnectedAgents()- ? 'Pulse already has a live monitored system. Open the dashboard to confirm the first overview, then return to Infrastructure Install any time you want to add more hosts or regenerate commands.'+ {completionViewModel().hasConnectedSystems+ ? 'Pulse already has a live monitored system. Open the dashboard to confirm the first overview, then return to Infrastructure Operations when you want to continue with the next system path.': 'The canonical install flow now lives in Infrastructure Operations. Open that workspace to continue with the first-host install token Pulse prepares from setup, adjust the agent connection URL only if needed, configure TLS or custom CA options, and copy the correct command for the first system you want Pulse to monitor.'}</p></div>@@ -672,26 +582,26 @@ Keep these credentials secure!Next step</div><div class="mt-2 text-sm text-base-content">- {hasConnectedAgents()- ? 'Open the dashboard to review your first connected system.'- : 'Open Infrastructure Install to bring your first monitored system into Pulse.'}+ {completionViewModel().nextStepSummary}</div><div class="mt-2 text-xs text-muted">- {hasConnectedAgents()- ? 'Infrastructure Install stays available any time you want to add more systems later.'- : 'If the first system is API-backed, use Platform connections instead of starting with host install.'}+ {completionViewModel().nextStepDetail}</div></div><div class="mt-4 flex flex-col gap-3 sm:flex-row"><buttononClick={() =>- hasConnectedAgents() ? handleGoToDashboard() : handleOpenInstallWorkspace()+ completionViewModel().primaryAction === 'dashboard'+ ? handleGoToDashboard()+ : handleOpenInstallWorkspace()}class="inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-3 text-sm font-semibold text-white transition-colors hover:bg-blue-700">- {hasConnectedAgents() ? 'Go to Dashboard' : 'Open Infrastructure Install'}+ {completionViewModel().primaryAction === 'dashboard'+ ? 'Go to Dashboard'+ : 'Open Infrastructure Install'}</button>- <Show when={!hasConnectedAgents()}>+ <Show when={completionViewModel().showPlatformConnectionsAction}><buttononClick={handleOpenPlatformConnections}class="inline-flex items-center justify-center gap-2 rounded-md border border-border px-4 py-3 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover"@@ -699,7 +609,7 @@ Keep these credentials secure!Open Platform connections</button></Show>- <Show when={hasConnectedAgents()}>+ <Show when={completionViewModel().showInstallAction}><buttononClick={handleOpenInstallWorkspace}class="inline-flex items-center justify-center gap-2 rounded-md border border-border px-4 py-3 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover"@@ -710,7 +620,7 @@ Keep these credentials secure!</div></div>- <Show when={hasConnectedAgents()}>+ <Show when={completionViewModel().hasConnectedSystems}><div class="bg-indigo-50 dark:bg-indigo-900 rounded-md border border-indigo-100 dark:border-indigo-800 p-5 text-left mt-8 overflow-hidden relative"><div class="flex items-start gap-4 relative z-10"><div class="flex h-12 w-12 items-center justify-center rounded-md bg-indigo-600 text-white shrink-0 border border-indigo-500">diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.tsindex d7389f0907..79d086c75b 100644--- a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts+++ b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.guardrails.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from 'vitest';import setupCompletionPanelSource from '../SetupCompletionPanel.tsx?raw';+import setupCompletionModelSource from '../setupCompletionModel.ts?raw';describe('SetupCompletionPanel guardrails', () => {it('keeps setup completion aligned with the canonical infrastructure install workspace', () => {@@ -40,12 +41,12 @@ describe('SetupCompletionPanel guardrails', () => {);expect(setupCompletionPanelSource).toContain("title: 'Run it on the first host you want to monitor'");expect(setupCompletionPanelSource).toContain('What to expect');- expect(setupCompletionPanelSource).toContain('First host first');+ expect(setupCompletionPanelSource).toContain('First system first');expect(setupCompletionPanelSource).toContain('Start with one host, then add more systems later from the same install workspace.');expect(setupCompletionPanelSource).toContain(- 'API-backed platforms like Proxmox and TrueNAS use Platform connections instead of a dedicated install profile in Infrastructure Install.',+ 'API-backed platforms like Proxmox, TrueNAS, and VMware use Platform connections instead of a dedicated install profile in Infrastructure Install.',);- expect(setupCompletionPanelSource).toContain(+ expect(setupCompletionModelSource).toContain('If the first system is API-backed, use Platform connections instead of starting with host install.',);expect(setupCompletionPanelSource).not.toContain('Smart Auto-Detection');@@ -53,11 +54,15 @@ describe('SetupCompletionPanel guardrails', () => {expect(setupCompletionPanelSource).not.toContain('ProxmoxIcon');});- it('keeps connected infrastructure labels on the canonical local identity helper', () => {- expect(setupCompletionPanelSource).toContain('isAgentFacetInfrastructureResource');- expect(setupCompletionPanelSource).toContain('getPreferredInfrastructureDisplayName');- expect(setupCompletionPanelSource).not.toContain("resource.type === 'truenas'");- expect(setupCompletionPanelSource).not.toContain('getPreferredResourceDisplayName(resource)');+ it('keeps connected infrastructure classification on the canonical setup model', () => {+ expect(setupCompletionPanelSource).toContain('buildSetupCompletionConnectedSystems');+ expect(setupCompletionPanelSource).toContain('buildSetupCompletionViewModel');+ expect(setupCompletionModelSource).toContain('isAgentFacetInfrastructureResource');+ expect(setupCompletionModelSource).toContain('getPreferredInfrastructureDisplayName');+ expect(setupCompletionModelSource).toContain('getPreferredResourceHostname');+ expect(setupCompletionModelSource).toContain('PLATFORM_CONNECTION_PLATFORM_TYPES');+ expect(setupCompletionModelSource).not.toContain("resource.type === 'truenas'");+ expect(setupCompletionModelSource).not.toContain('getPreferredResourceDisplayName(resource)');});it('does not reintroduce a separate setup-wizard install command surface', () => {@@ -79,17 +84,18 @@ describe('SetupCompletionPanel guardrails', () => {expect(setupCompletionPanelSource).toContain('Save the admin login and API token before leaving this screen');expect(setupCompletionPanelSource).toContain('Recommended next step');expect(setupCompletionPanelSource).toContain('Go to Dashboard');- expect(setupCompletionPanelSource).toContain('First monitored host connected');+ expect(setupCompletionModelSource).toContain("heroTitle: 'First monitored system connected'");+ expect(setupCompletionModelSource).toContain("heroTitle: 'Connect your first monitored system'");expect(setupCompletionPanelSource).toContain(- 'hasConnectedAgents() ? handleGoToDashboard() : handleOpenInstallWorkspace()',+ "completionViewModel().primaryAction === 'dashboard'",);expect(setupCompletionPanelSource).toContain(- "{hasConnectedAgents() ? 'Go to Dashboard' : 'Open Infrastructure Install'}",+ 'completionViewModel().showPlatformConnectionsAction',);+ expect(setupCompletionPanelSource).toContain('completionViewModel().showInstallAction');expect(setupCompletionPanelSource).toContain('handleOpenPlatformConnections');- expect(setupCompletionPanelSource).not.toContain(- "connectedAgents().length > 0 ? 'Go to Dashboard' : 'Open Infrastructure Install'",- );+ expect(setupCompletionPanelSource).not.toContain('hasConnectedAgents');+ expect(setupCompletionPanelSource).not.toContain('connectedAgents().length');expect(setupCompletionPanelSource).not.toContain('You can return here later from Infrastructure Operations if you skip install for now.',);diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsxindex 8d89ecd1dd..1db6b0fb46 100644--- a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx+++ b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx@@ -12,6 +12,9 @@ const showErrorMock = vi.fn();const navigateMock = vi.fn();const createObjectURLMock = vi.fn(() => 'blob:mock-url');const revokeObjectURLMock = vi.fn();+const trackAgentFirstConnectedMock = vi.fn();+const trackPaywallViewedMock = vi.fn();+const trackUpgradeClickedMock = vi.fn();class MockBlob {readonly parts: string[];@@ -76,9 +79,9 @@ vi.mock('@/utils/logger', () => ({}));vi.mock('@/utils/upgradeMetrics', () => ({- trackAgentFirstConnected: vi.fn(),- trackPaywallViewed: vi.fn(),- trackUpgradeClicked: vi.fn(),+ trackAgentFirstConnected: (...args: unknown[]) => trackAgentFirstConnectedMock(...args),+ trackPaywallViewed: (...args: unknown[]) => trackPaywallViewedMock(...args),+ trackUpgradeClicked: (...args: unknown[]) => trackUpgradeClickedMock(...args),}));const baseState: WizardState = {@@ -109,6 +112,7 @@ describe('SetupCompletionPanel', () => {it('frames setup completion around the canonical infrastructure install workspace', async () => {render(() => <SetupCompletionPanel state={baseState} onComplete={vi.fn()} />);+ expect(screen.getByText('Connect your first monitored system')).toBeInTheDocument();expect(screen.getByText('What happens next')).toBeInTheDocument();expect(screen.getAllByText('Open Infrastructure Install').length).toBeGreaterThan(0);expect(screen.getByRole('button', { name: 'Open Platform connections' })).toBeInTheDocument();@@ -117,7 +121,7 @@ describe('SetupCompletionPanel', () => {expect(screen.getByText('admin')).toBeInTheDocument();expect(screen.getByText('password')).toBeInTheDocument();expect(screen.getByText('What to expect')).toBeInTheDocument();- expect(screen.getByText('First host first')).toBeInTheDocument();+ expect(screen.getByText('First system first')).toBeInTheDocument();expect(screen.getByText('Infrastructure Install owns the token, connection URL, TLS/CA settings, and platform-specific commands.',@@ -130,7 +134,7 @@ describe('SetupCompletionPanel', () => {).toBeInTheDocument();expect(screen.getByText(- 'API-backed platforms like Proxmox and TrueNAS use Platform connections instead of a dedicated install profile in Infrastructure Install.',+ 'API-backed platforms like Proxmox, TrueNAS, and VMware use Platform connections instead of a dedicated install profile in Infrastructure Install.',),).toBeInTheDocument();@@ -191,7 +195,7 @@ describe('SetupCompletionPanel', () => {'continue with the first-host install token Pulse prepares from setup',);expect(content).toContain(- 'the first system is API-backed, such as Proxmox or TrueNAS',+ 'the first system is API-backed, such as Proxmox, TrueNAS, or VMware',);expect(content).not.toContain('Example Install Command');expect(content).not.toContain('Example Windows Install Command');@@ -229,24 +233,33 @@ describe('SetupCompletionPanel', () => {render(() => <SetupCompletionPanel state={baseState} onComplete={onComplete} />);await waitFor(() => {- expect(screen.getByText('Connected (1 agent)')).toBeInTheDocument();+ expect(screen.getByText('Connected (1 system)')).toBeInTheDocument();});- expect(screen.getByText('Tower')).toBeInTheDocument();- expect(screen.getByText('First monitored host connected')).toBeInTheDocument();+ expect(screen.getAllByText('Tower').length).toBeGreaterThan(0);+ expect(screen.getByText('First monitored system connected')).toBeInTheDocument();expect(screen.getByText(- 'Your admin account is ready and Pulse is already receiving telemetry. Open the dashboard to verify your first overview, or return to Infrastructure Install when you want to add more systems.',+ 'Your admin account is ready and Pulse is already receiving telemetry. Open the dashboard to verify the first overview, then return to Infrastructure Install when you want to add more host-installed systems.',),).toBeInTheDocument();expect(screen.getByText('Open the dashboard to review your first connected system.'),).toBeInTheDocument();+ expect(+ screen.getByText(+ 'Infrastructure Install stays available any time you want to add more host-installed systems.',+ ),+ ).toBeInTheDocument();expect(screen.getAllByRole('button', { name: 'Go to Dashboard' }).length).toBeGreaterThan(0);expect(screen.getAllByRole('button', { name: 'Open Infrastructure Install' }).length,).toBeGreaterThan(0);expect(screen.queryByRole('button', { name: 'Open Platform connections' })).not.toBeInTheDocument();+ expect(trackAgentFirstConnectedMock).toHaveBeenCalledWith(+ 'setup_wizard_complete',+ 'first_agent',+ );const nextStepHeading = screen.getByRole('heading', { name: 'Open your first dashboard view' });const nextStepCard = nextStepHeading.closest('div.bg-surface.rounded-md.border.border-border.p-6.text-left.mb-6');@@ -256,6 +269,119 @@ describe('SetupCompletionPanel', () => {expect(onComplete).toHaveBeenCalledWith('/');});+ it('keeps platform connections available for API-backed starts after the first system connects', async () => {+ const onComplete = vi.fn();+ apiFetchJSONMock.mockResolvedValue({+ resources: [+ {+ id: 'truenas-1',+ type: 'agent',+ name: 'truenas-main',+ displayName: 'TrueNAS Main',+ platformId: 'truenas-main',+ platformType: 'truenas',+ sourceType: 'api',+ status: 'online',+ lastSeen: 123,+ platformData: {+ truenas: { hostname: 'tn-main.local' },+ },+ },+ ],+ });++ render(() => <SetupCompletionPanel state={baseState} onComplete={onComplete} />);++ await waitFor(() => {+ expect(screen.getByText('Connected (1 system)')).toBeInTheDocument();+ });++ expect(screen.getByText('TrueNAS Main')).toBeInTheDocument();+ expect(screen.getByText('TrueNAS')).toBeInTheDocument();+ expect(screen.getByText('First monitored system connected')).toBeInTheDocument();+ expect(+ screen.getByText(+ 'Your admin account is ready and Pulse is already receiving telemetry. Open the dashboard to verify the first overview, then return to Platform connections when you want to add more API-backed systems.',+ ),+ ).toBeInTheDocument();+ expect(+ screen.getByText(+ 'Platform connections stays available any time you want to add more API-backed systems, and Infrastructure Install is ready when the next system should run the unified agent.',+ ),+ ).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Go to Dashboard' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Open Platform connections' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Open Infrastructure Install' })).toBeInTheDocument();+ expect(trackAgentFirstConnectedMock).not.toHaveBeenCalled();++ const nextStepHeading = screen.getByRole('heading', { name: 'Open your first dashboard view' });+ const nextStepCard = nextStepHeading.closest('div.bg-surface.rounded-md.border.border-border.p-6.text-left.mb-6');+ expect(nextStepCard).not.toBeNull();++ fireEvent.click(+ within(nextStepCard as HTMLElement).getByRole('button', {+ name: 'Open Platform connections',+ }),+ );+ expect(onComplete).toHaveBeenCalledWith('/settings/infrastructure/platforms');+ });++ it('keeps both continuation paths visible when install-managed and API-backed systems are already present', async () => {+ apiFetchJSONMock.mockResolvedValue({+ resources: [+ {+ id: 'agent-1',+ type: 'agent',+ name: 'Tower',+ displayName: 'Tower',+ platformId: 'tower',+ platformType: 'agent',+ sourceType: 'agent',+ status: 'online',+ lastSeen: 123,+ agent: { agentId: 'agent-1' },+ },+ {+ id: 'truenas-1',+ type: 'agent',+ name: 'truenas-main',+ displayName: 'TrueNAS Main',+ platformId: 'truenas-main',+ platformType: 'truenas',+ sourceType: 'api',+ status: 'online',+ lastSeen: 456,+ platformData: {+ truenas: { hostname: 'tn-main.local' },+ },+ },+ ],+ });++ render(() => <SetupCompletionPanel state={baseState} onComplete={vi.fn()} />);++ await waitFor(() => {+ expect(screen.getByText('Connected (2 systems)')).toBeInTheDocument();+ });++ expect(+ screen.getByText(+ 'Your admin account is ready and Pulse is already receiving telemetry. Open the dashboard to verify the first overview, then return to Platform connections or Infrastructure Install when you want to add more systems.',+ ),+ ).toBeInTheDocument();+ expect(+ screen.getByText(+ 'Platform connections and Infrastructure Install both stay available any time you want to expand from this first system.',+ ),+ ).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Open Platform connections' })).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Open Infrastructure Install' })).toBeInTheDocument();+ expect(trackAgentFirstConnectedMock).toHaveBeenCalledWith(+ 'setup_wizard_complete',+ 'first_agent',+ );+ });+it('keeps connected governed infrastructure on local operator identity', async () => {apiFetchJSONMock.mockResolvedValue({resources: [@@ -282,10 +408,11 @@ describe('SetupCompletionPanel', () => {render(() => <SetupCompletionPanel state={baseState} onComplete={vi.fn()} />);await waitFor(() => {- expect(screen.getByText('Connected (1 agent)')).toBeInTheDocument();+ expect(screen.getByText('Connected (1 system)')).toBeInTheDocument();});expect(screen.getByText('PBS Main')).toBeInTheDocument();+ expect(screen.getByText('Proxmox Backup Server')).toBeInTheDocument();expect(screen.queryByText('backup server resource; status online; sources pbs'),).not.toBeInTheDocument();diff --git a/frontend-modern/src/components/SetupWizard/setupCompletionModel.ts b/frontend-modern/src/components/SetupWizard/setupCompletionModel.tsnew file mode 100644index 0000000000..cd32a827ed--- /dev/null+++ b/frontend-modern/src/components/SetupWizard/setupCompletionModel.ts@@ -0,0 +1,257 @@+import type { PlatformType, Resource } from '@/types/resource';+import {+ getActionableAgentIdFromResource,+ getPlatformDataRecord,+ isAgentFacetInfrastructureResource,+ isTrueNASSystemResource,+} from '@/utils/agentResources';+import {+ getPreferredInfrastructureDisplayName,+ getPreferredResourceHostname,+} from '@/utils/resourceIdentity';++export type SetupCompletionConnectionPath = 'install' | 'platforms';+export type SetupCompletionPrimaryAction = 'dashboard' | 'install';++export interface ConnectedSetupSystem {+ id: string;+ name: string;+ typeLabel: string;+ host: string;+ connectionPath: SetupCompletionConnectionPath;+}++export interface SetupCompletionViewModel {+ connectedSummaryLabel: string;+ credentialsContinuationText: string;+ hasConnectedSystems: boolean;+ hasInstallConnectedSystems: boolean;+ hasPlatformConnectedSystems: boolean;+ heroDescription: string;+ heroTitle: string;+ nextStepDetail: string;+ nextStepSummary: string;+ nextStepTitle: string;+ primaryAction: SetupCompletionPrimaryAction;+ showInstallAction: boolean;+ showPlatformConnectionsAction: boolean;+}++const PLATFORM_CONNECTION_PLATFORM_TYPES = new Set<PlatformType>([+ 'proxmox-pve',+ 'proxmox-pbs',+ 'proxmox-pmg',+ 'truenas',+ 'vmware-vsphere',+]);++const asRecord = (value: unknown): Record<string, unknown> | undefined =>+ value && typeof value === 'object' ? (value as Record<string, unknown>) : undefined;++const asString = (value: unknown): string | undefined =>+ typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;++const isSetupCompletionInfrastructureResource = (resource: Resource): boolean =>+ resource.type === 'agent' || resource.type === 'pbs' || resource.type === 'pmg';++const isPlatformConnectedSetupResource = (resource: Resource): boolean =>+ resource.type === 'pbs' ||+ resource.type === 'pmg' ||+ PLATFORM_CONNECTION_PLATFORM_TYPES.has(resource.platformType) ||+ isTrueNASSystemResource(resource);++const isInstallConnectedSetupResource = (resource: Resource): boolean =>+ isAgentFacetInfrastructureResource(resource) && !isPlatformConnectedSetupResource(resource);++const getConnectedSetupSystemTypeLabel = (resource: Resource): string => {+ if (resource.type === 'pbs' || resource.platformType === 'proxmox-pbs') {+ return 'Proxmox Backup Server';+ }+ if (resource.type === 'pmg' || resource.platformType === 'proxmox-pmg') {+ return 'Proxmox Mail Gateway';+ }+ if (resource.platformType === 'proxmox-pve') {+ return 'Proxmox VE';+ }+ if (resource.platformType === 'truenas' || isTrueNASSystemResource(resource)) {+ return 'TrueNAS';+ }+ if (resource.platformType === 'vmware-vsphere') {+ return 'VMware vSphere';+ }+ return 'Agent';+};++const getConnectedSetupSystemHost = (resource: Resource): string => {+ const hostname = getPreferredResourceHostname(resource);+ if (hostname) return hostname;++ const platformData = getPlatformDataRecord(resource);+ const proxmox = asRecord(platformData?.proxmox);+ const truenas = asRecord(platformData?.truenas);+ const vmware = asRecord(platformData?.vmware);++ return (+ asString(proxmox?.instance) ||+ asString(truenas?.hostname) ||+ asString(vmware?.hostname) ||+ ''+ );+};++const toConnectedSetupSystem = (resource: Resource): ConnectedSetupSystem | null => {+ if (!isSetupCompletionInfrastructureResource(resource)) return null;++ const connectionPath = isPlatformConnectedSetupResource(resource)+ ? 'platforms'+ : isInstallConnectedSetupResource(resource)+ ? 'install'+ : null;+ if (!connectionPath) return null;++ return {+ id: resource.platformId || getActionableAgentIdFromResource(resource) || resource.id,+ name: getPreferredInfrastructureDisplayName(resource) || resource.name || 'Unknown',+ typeLabel: getConnectedSetupSystemTypeLabel(resource),+ host: getConnectedSetupSystemHost(resource),+ connectionPath,+ };+};++export function buildSetupCompletionConnectedSystems(+ resources: readonly Resource[],+): ConnectedSetupSystem[] {+ const systems = new Map<string, ConnectedSetupSystem>();++ for (const resource of resources) {+ const nextSystem = toConnectedSetupSystem(resource);+ if (!nextSystem) continue;++ const key = resource.platformId || nextSystem.id || nextSystem.name;+ const existing = systems.get(key);+ if (!existing) {+ systems.set(key, nextSystem);+ continue;+ }++ if (existing.connectionPath === 'install' && nextSystem.connectionPath === 'platforms') {+ existing.connectionPath = 'platforms';+ existing.typeLabel = nextSystem.typeLabel;+ }+ if (!existing.host && nextSystem.host) {+ existing.host = nextSystem.host;+ }+ if (existing.name === 'Unknown' && nextSystem.name !== 'Unknown') {+ existing.name = nextSystem.name;+ }+ }++ return Array.from(systems.values()).sort(+ (left, right) => left.name.localeCompare(right.name) || left.id.localeCompare(right.id),+ );+}++const buildConnectedHeroDescription = (+ hasInstallConnectedSystems: boolean,+ hasPlatformConnectedSystems: boolean,+): string => {+ const prefix =+ 'Your admin account is ready and Pulse is already receiving telemetry. Open the dashboard to verify the first overview';++ if (hasInstallConnectedSystems && hasPlatformConnectedSystems) {+ return `${prefix}, then return to Platform connections or Infrastructure Install when you want to add more systems.`;+ }+ if (hasPlatformConnectedSystems) {+ return `${prefix}, then return to Platform connections when you want to add more API-backed systems.`;+ }+ return `${prefix}, then return to Infrastructure Install when you want to add more host-installed systems.`;+};++const buildCredentialsContinuationText = (+ hasInstallConnectedSystems: boolean,+ hasPlatformConnectedSystems: boolean,+): string => {+ if (hasInstallConnectedSystems && hasPlatformConnectedSystems) {+ return 'the dashboard, Platform connections, or Infrastructure Install.';+ }+ if (hasPlatformConnectedSystems) {+ return 'the dashboard, Platform connections, or Infrastructure Install.';+ }+ return 'the dashboard or Infrastructure Install.';+};++const buildConnectedNextStepDetail = (+ hasInstallConnectedSystems: boolean,+ hasPlatformConnectedSystems: boolean,+): string => {+ if (hasInstallConnectedSystems && hasPlatformConnectedSystems) {+ return 'Platform connections and Infrastructure Install both stay available any time you want to expand from this first system.';+ }+ if (hasPlatformConnectedSystems) {+ return 'Platform connections stays available any time you want to add more API-backed systems, and Infrastructure Install is ready when the next system should run the unified agent.';+ }+ return 'Infrastructure Install stays available any time you want to add more host-installed systems.';+};++export function buildSetupCompletionViewModel(+ connectedSystems: readonly ConnectedSetupSystem[],+): SetupCompletionViewModel {+ const hasConnectedSystems = connectedSystems.length > 0;+ const hasInstallConnectedSystems = connectedSystems.some(+ (system) => system.connectionPath === 'install',+ );+ const hasPlatformConnectedSystems = connectedSystems.some(+ (system) => system.connectionPath === 'platforms',+ );++ const connectedSystemNoun = connectedSystems.length === 1 ? 'system' : 'systems';+ const nextStepSummary =+ connectedSystems.length === 1+ ? 'Open the dashboard to review your first connected system.'+ : 'Open the dashboard to review your connected systems.';++ if (!hasConnectedSystems) {+ return {+ connectedSummaryLabel: 'Connected (0 systems)',+ credentialsContinuationText: 'Infrastructure Install or Platform connections.',+ hasConnectedSystems,+ hasInstallConnectedSystems,+ hasPlatformConnectedSystems,+ heroDescription:+ 'Your admin account is ready. Next, choose the first infrastructure path: open Infrastructure Install for a host that should run the unified agent, or open Platform connections for API-backed platforms such as Proxmox, TrueNAS, and VMware.',+ heroTitle: 'Connect your first monitored system',+ nextStepDetail:+ 'If the first system is API-backed, use Platform connections instead of starting with host install.',+ nextStepSummary: 'Open Infrastructure Install to bring your first monitored system into Pulse.',+ nextStepTitle: 'Choose your first infrastructure path',+ primaryAction: 'install',+ showInstallAction: false,+ showPlatformConnectionsAction: true,+ };+ }++ return {+ connectedSummaryLabel: `Connected (${connectedSystems.length} ${connectedSystemNoun})`,+ credentialsContinuationText: buildCredentialsContinuationText(+ hasInstallConnectedSystems,+ hasPlatformConnectedSystems,+ ),+ hasConnectedSystems,+ hasInstallConnectedSystems,+ hasPlatformConnectedSystems,+ heroDescription: buildConnectedHeroDescription(+ hasInstallConnectedSystems,+ hasPlatformConnectedSystems,+ ),+ heroTitle: 'First monitored system connected',+ nextStepDetail: buildConnectedNextStepDetail(+ hasInstallConnectedSystems,+ hasPlatformConnectedSystems,+ ),+ nextStepSummary,+ nextStepTitle: 'Open your first dashboard view',+ primaryAction: 'dashboard',+ showInstallAction: hasConnectedSystems,+ showPlatformConnectionsAction: hasPlatformConnectedSystems,+ };+}