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.

Add system-picker dialog for target-first onboarding

rcourtman49c8c8438770
diff --git a/frontend-modern/src/components/Settings/AddSystemPicker.tsx b/frontend-modern/src/components/Settings/AddSystemPicker.tsx
new file mode 100644
index 0000000000..1234732e4e
--- /dev/null
+++ b/frontend-modern/src/components/Settings/AddSystemPicker.tsx
@@ -0,0 +1,123 @@
+import { Component, For } from 'solid-js';
+import { Dialog } from '@/components/shared/Dialog';
+import type { ConnectionKind, ConnectionMethod } from './connectionsTableModel';
+
+export interface AddSystemChoice {
+ kind: ConnectionKind;
+ title: string;
+ description: string;
+ method: ConnectionMethod;
+ methodLabel: string;
+}
+
+export const ADD_SYSTEM_CHOICES: readonly AddSystemChoice[] = [
+ {
+ kind: 'pve',
+ title: 'Proxmox VE',
+ description: 'Connect a Proxmox cluster or standalone node. Pulse polls the Proxmox API.',
+ method: 'api',
+ methodLabel: 'API connection',
+ },
+ {
+ kind: 'pbs',
+ title: 'Proxmox Backup Server',
+ description: 'Connect a PBS instance so Pulse can track datastores, sync, and verify jobs.',
+ method: 'api',
+ methodLabel: 'API connection',
+ },
+ {
+ kind: 'pmg',
+ title: 'Proxmox Mail Gateway',
+ description: 'Connect a PMG instance for queue, quarantine, and mail-stats reporting.',
+ method: 'api',
+ methodLabel: 'API connection',
+ },
+ {
+ kind: 'truenas',
+ title: 'TrueNAS SCALE',
+ description: 'Connect a TrueNAS system so Pulse can report pools, datasets, and apps.',
+ method: 'api',
+ methodLabel: 'API connection',
+ },
+ {
+ kind: 'vmware',
+ title: 'VMware vSphere or ESXi',
+ description: 'Connect a vCenter or ESXi host. Pulse polls the vSphere API.',
+ method: 'api',
+ methodLabel: 'API connection',
+ },
+ {
+ kind: 'agent',
+ title: 'Linux or Docker host (agent)',
+ description:
+ 'Generate an install token and run the Pulse agent on the host itself. Best for anything without a supported API.',
+ method: 'agent',
+ methodLabel: 'Agent install',
+ },
+];
+
+interface AddSystemPickerProps {
+ isOpen: boolean;
+ onClose: () => void;
+ onSelect: (choice: AddSystemChoice) => void;
+}
+
+export const AddSystemPicker: Component<AddSystemPickerProps> = (props) => {
+ return (
+ <Dialog
+ isOpen={props.isOpen}
+ onClose={props.onClose}
+ ariaLabelledBy="add-system-picker-title"
+ closeOnBackdrop
+ panelClass="w-full max-w-2xl rounded-lg bg-surface shadow-xl"
+ >
+ <div class="space-y-4 p-6">
+ <div class="flex items-start justify-between gap-4">
+ <div>
+ <h2 id="add-system-picker-title" class="text-lg font-semibold text-base-content">
+ Add a system
+ </h2>
+ <p class="mt-1 text-sm text-muted">
+ Pick what you are connecting. Pulse will route you straight into the right flow.
+ </p>
+ </div>
+ <button
+ type="button"
+ onClick={props.onClose}
+ class="rounded-md border border-border bg-surface px-2 py-1 text-xs text-muted hover:bg-surface-hover"
+ aria-label="Close"
+ >
+ Close
+ </button>
+ </div>
+ <ul class="divide-y divide-border rounded-md border border-border">
+ <For each={ADD_SYSTEM_CHOICES}>
+ {(choice) => (
+ <li>
+ <button
+ type="button"
+ onClick={() => props.onSelect(choice)}
+ class="flex w-full items-start justify-between gap-4 px-4 py-3 text-left hover:bg-surface-hover"
+ >
+ <div>
+ <div class="text-sm font-semibold text-base-content">{choice.title}</div>
+ <div class="mt-0.5 text-xs text-muted">{choice.description}</div>
+ </div>
+ <span
+ class={`inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium ${
+ choice.method === 'api'
+ ? 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-100'
+ : 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-100'
+ }`}
+ >
+ {choice.methodLabel}
+ </span>
+ </button>
+ </li>
+ )}
+ </For>
+ </ul>
+ </div>
+ </Dialog>
+ );
+};
diff --git a/frontend-modern/src/components/Settings/__tests__/AddSystemPicker.test.tsx b/frontend-modern/src/components/Settings/__tests__/AddSystemPicker.test.tsx
new file mode 100644
index 0000000000..981aefd45d
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/AddSystemPicker.test.tsx
@@ -0,0 +1,61 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { ADD_SYSTEM_CHOICES, AddSystemPicker } from '../AddSystemPicker';
+
+describe('AddSystemPicker', () => {
+ afterEach(() => cleanup());
+
+ it('does not render any dialog content when closed', () => {
+ render(() => (
+ <AddSystemPicker isOpen={false} onClose={() => {}} onSelect={() => {}} />
+ ) as any);
+ expect(screen.queryByRole('dialog')).toBeNull();
+ });
+
+ it('lists one button per add-system choice including Proxmox VE, PBS, PMG, TrueNAS, VMware, and agent host', () => {
+ render(() => (
+ <AddSystemPicker isOpen={true} onClose={() => {}} onSelect={() => {}} />
+ ) as any);
+
+ for (const choice of ADD_SYSTEM_CHOICES) {
+ expect(screen.getByText(choice.title)).toBeInTheDocument();
+ }
+ expect(ADD_SYSTEM_CHOICES.map((c) => c.kind)).toEqual([
+ 'pve',
+ 'pbs',
+ 'pmg',
+ 'truenas',
+ 'vmware',
+ 'agent',
+ ]);
+ });
+
+ it('invokes onSelect with the matching choice when a tile is clicked', () => {
+ const onSelect = vi.fn();
+ render(() => (
+ <AddSystemPicker isOpen={true} onClose={() => {}} onSelect={onSelect} />
+ ) as any);
+
+ fireEvent.click(screen.getByText('TrueNAS SCALE'));
+ expect(onSelect).toHaveBeenCalledTimes(1);
+ expect(onSelect.mock.calls[0][0].kind).toBe('truenas');
+ expect(onSelect.mock.calls[0][0].method).toBe('api');
+ });
+
+ it('invokes onClose when the close button is clicked', () => {
+ const onClose = vi.fn();
+ render(() => (
+ <AddSystemPicker isOpen={true} onClose={onClose} onSelect={() => {}} />
+ ) as any);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Close' }));
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
+
+ it('marks the agent-host choice as an agent install and everything else as an API connection', () => {
+ const agent = ADD_SYSTEM_CHOICES.find((c) => c.kind === 'agent');
+ const apis = ADD_SYSTEM_CHOICES.filter((c) => c.kind !== 'agent');
+ expect(agent?.method).toBe('agent');
+ expect(apis.every((c) => c.method === 'api')).toBe(true);
+ });
+});