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.

infra: fold Add/Install CTAs into the unified entry cards

rcourtman948499839d02
diff --git a/frontend-modern/src/components/Settings/ConnectionsExplainer.tsx b/frontend-modern/src/components/Settings/ConnectionsExplainer.tsx
index 12a325e586..5d2704fd41 100644
--- a/frontend-modern/src/components/Settings/ConnectionsExplainer.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionsExplainer.tsx
@@ -1,25 +1,5 @@
-import { Component, For, Show, createSignal } from 'solid-js';
-import { Cloud, Cpu, X } from 'lucide-solid';
-
-const DISMISS_KEY = 'pulse.infrastructure.explainer.dismissed.v1';
-
-const readDismissed = (): boolean => {
- if (typeof window === 'undefined') return false;
- try {
- return window.localStorage.getItem(DISMISS_KEY) === '1';
- } catch {
- return false;
- }
-};
-
-const persistDismissed = () => {
- if (typeof window === 'undefined') return;
- try {
- window.localStorage.setItem(DISMISS_KEY, '1');
- } catch {
- // Ignore storage failures (private mode, quota); the in-memory signal is enough for this session.
- }
-};
+import { Component, For, Show } from 'solid-js';
+import { ArrowRight, Cloud, Cpu } from 'lucide-solid';
const OPT_IN_CAPABILITIES = ['Assistant commands', 'Patrol remediation'];
@@ -30,119 +10,134 @@ const AGENT_FACTS = [
'Open source',
];
-export const ConnectionsExplainer: Component = () => {
- const [dismissed, setDismissed] = createSignal(readDismissed());
+interface ConnectionsExplainerProps {
+ onAddConnection?: () => void;
+ onInstallAgent?: () => void;
+ readOnly?: boolean;
+}
+
+export const ConnectionsExplainer: Component<ConnectionsExplainerProps> = (props) => {
+ const interactive = () => !props.readOnly;
- const handleDismiss = () => {
- persistDismissed();
- setDismissed(true);
- };
+ const ctaClass =
+ 'mt-4 inline-flex w-full items-center justify-center gap-1.5 rounded-md border border-border bg-surface px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
return (
- <Show when={!dismissed()}>
- <section
- aria-label="How to connect infrastructure"
- class="relative overflow-hidden rounded-lg border border-border bg-surface"
- >
- <button
- type="button"
- onClick={handleDismiss}
- aria-label="Dismiss"
- class="absolute right-2 top-2 z-10 inline-flex items-center justify-center rounded-md p-1 text-muted transition-colors hover:bg-surface-hover hover:text-base-content"
- >
- <X class="h-4 w-4" aria-hidden="true" />
- </button>
+ <section
+ aria-label="Add infrastructure"
+ class="relative overflow-hidden rounded-lg border border-border bg-surface"
+ >
+ <div class="border-b border-border px-5 py-3">
+ <h3 class="text-sm font-semibold text-base-content">How Pulse collects data</h3>
+ <p class="mt-0.5 text-xs text-muted">
+ The platform API covers workloads. The Unified Agent adds host-level metrics, and stands
+ alone where there's no API.
+ </p>
+ </div>
- <div class="border-b border-border px-5 py-3">
- <h3 class="text-sm font-semibold text-base-content">
- How Pulse collects data
- </h3>
- <p class="mt-0.5 text-xs text-muted">
- The platform API covers workloads. The Unified Agent adds host-level
- metrics, and stands alone where there's no API.
+ <div class="grid grid-cols-1 divide-border md:grid-cols-2 md:divide-x">
+ <div class="flex flex-col p-5">
+ <div class="flex items-start gap-3">
+ <div
+ aria-hidden="true"
+ class="flex h-9 w-9 flex-none items-center justify-center rounded-lg border border-border bg-surface-alt text-base-content"
+ >
+ <Cloud class="h-4 w-4" />
+ </div>
+ <div class="min-w-0">
+ <div class="text-sm font-semibold text-base-content">Platform API</div>
+ <div class="text-xs text-muted">Primary source for workloads</div>
+ </div>
+ </div>
+ <p class="mt-3 text-xs leading-relaxed text-muted">
+ Pulse polls the platform's own API (Proxmox VE / PBS / PMG, VMware, TrueNAS) for VMs,
+ containers, storage, backups, and other workload data. Required for every API-backed
+ target; fastest to set up.
</p>
- </div>
-
- <div class="grid grid-cols-1 divide-border md:grid-cols-2 md:divide-x">
- <div class="p-5">
- <div class="flex items-start gap-3">
- <div
- aria-hidden="true"
- class="flex h-9 w-9 flex-none items-center justify-center rounded-lg border border-border bg-surface-alt text-base-content"
+ <div class="mt-auto">
+ <Show when={interactive()} fallback={<div class="mt-4 h-0" />}>
+ <button
+ type="button"
+ onClick={() => props.onAddConnection?.()}
+ disabled={!props.onAddConnection}
+ class={ctaClass}
>
- <Cloud class="h-4 w-4" />
- </div>
- <div class="min-w-0">
- <div class="text-sm font-semibold text-base-content">Platform API</div>
- <div class="text-xs text-muted">Primary source for workloads</div>
- </div>
- </div>
- <p class="mt-3 text-xs leading-relaxed text-muted">
- Pulse polls the platform's own API (Proxmox VE / PBS / PMG, VMware,
- TrueNAS) for VMs, containers, storage, backups, and other workload data.
- Required for every API-backed target; fastest to set up.
- </p>
+ Add connection
+ <ArrowRight class="h-4 w-4" aria-hidden="true" />
+ </button>
+ </Show>
</div>
+ </div>
- <div class="relative bg-blue-50/40 p-5 dark:bg-blue-950/20">
+ <div class="relative flex flex-col bg-blue-50/40 p-5 dark:bg-blue-950/20">
+ <div
+ aria-hidden="true"
+ class="absolute inset-y-0 left-0 w-0.5 bg-blue-500 md:hidden"
+ />
+ <div class="flex items-start gap-3">
<div
aria-hidden="true"
- class="absolute inset-y-0 left-0 w-0.5 bg-blue-500 md:hidden"
- />
- <div class="flex items-start gap-3">
- <div
- aria-hidden="true"
- class="flex h-9 w-9 flex-none items-center justify-center rounded-lg border border-blue-200 bg-blue-100 text-blue-700 dark:border-blue-900 dark:bg-blue-900/40 dark:text-blue-300"
- >
- <Cpu class="h-4 w-4" />
- </div>
- <div class="min-w-0">
- <div class="text-sm font-semibold text-base-content">
- Pulse Unified Agent
- </div>
- <div class="text-xs text-muted">Runs on the host, alongside the API</div>
- </div>
+ class="flex h-9 w-9 flex-none items-center justify-center rounded-lg border border-blue-200 bg-blue-100 text-blue-700 dark:border-blue-900 dark:bg-blue-900/40 dark:text-blue-300"
+ >
+ <Cpu class="h-4 w-4" />
</div>
+ <div class="min-w-0">
+ <div class="text-sm font-semibold text-base-content">Pulse Unified Agent</div>
+ <div class="text-xs text-muted">Runs on the host, alongside the API</div>
+ </div>
+ </div>
- <p class="mt-3 text-xs leading-relaxed text-muted">
- On Proxmox / VMware / TrueNAS, the agent supplements the API with data
- it can't expose (CPU and disk temperatures, SMART, power, Ceph/RAID).
- On bare-metal Linux, Unraid, or FreeBSD with no platform API, it's the
- only path.
- </p>
+ <p class="mt-3 text-xs leading-relaxed text-muted">
+ On Proxmox / VMware / TrueNAS, the agent supplements the API with data it can't expose
+ (CPU and disk temperatures, SMART, power, Ceph/RAID). On bare-metal Linux, Unraid, or
+ FreeBSD with no platform API, it's the only path.
+ </p>
- <div class="mt-4">
- <div class="mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted">
- Off by default, opt in per host
- </div>
- <div class="flex flex-wrap gap-1.5">
- <For each={OPT_IN_CAPABILITIES}>
- {(label) => (
- <span class="inline-flex items-center rounded-full border border-dashed border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">
- {label}
- </span>
- )}
- </For>
- </div>
+ <div class="mt-4">
+ <div class="mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted">
+ Off by default, opt in per host
</div>
-
- <ul class="mt-4 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted">
- <For each={AGENT_FACTS}>
- {(fact, index) => (
- <li class="flex items-center gap-1.5">
- <Show when={index() > 0}>
- <span aria-hidden="true" class="text-border">
- ·
- </span>
- </Show>
- {fact}
- </li>
+ <div class="flex flex-wrap gap-1.5">
+ <For each={OPT_IN_CAPABILITIES}>
+ {(label) => (
+ <span class="inline-flex items-center rounded-full border border-dashed border-border bg-surface px-2 py-0.5 text-[11px] font-medium text-muted">
+ {label}
+ </span>
)}
</For>
- </ul>
+ </div>
+ </div>
+
+ <ul class="mt-4 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted">
+ <For each={AGENT_FACTS}>
+ {(fact, index) => (
+ <li class="flex items-center gap-1.5">
+ <Show when={index() > 0}>
+ <span aria-hidden="true" class="text-border">
+ ·
+ </span>
+ </Show>
+ {fact}
+ </li>
+ )}
+ </For>
+ </ul>
+
+ <div class="mt-auto">
+ <Show when={interactive()} fallback={<div class="mt-4 h-0" />}>
+ <button
+ type="button"
+ onClick={() => props.onInstallAgent?.()}
+ disabled={!props.onInstallAgent}
+ class={ctaClass}
+ >
+ Install agent
+ <ArrowRight class="h-4 w-4" aria-hidden="true" />
+ </button>
+ </Show>
</div>
</div>
- </section>
- </Show>
+ </div>
+ </section>
);
};
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index 562a1d6c3e..aba05779d2 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -5,7 +5,7 @@ import { copyToClipboard } from '@/utils/clipboard';
import { notificationStore } from '@/stores/notifications';
import { AgentProfilesPanel } from './AgentProfilesPanel';
import { ConnectionsExplainer } from './ConnectionsExplainer';
-import { ConnectionsTable, type ConnectionsTableHeaderAction } from './ConnectionsTable';
+import { ConnectionsTable } from './ConnectionsTable';
import { ConnectionEditor } from './ConnectionEditor/ConnectionEditor';
import { NodeCredentialSlot } from './ConnectionEditor/CredentialSlots/NodeCredentialSlot';
import { TrueNASCredentialSlot } from './ConnectionEditor/CredentialSlots/TrueNASCredentialSlot';
@@ -122,30 +122,17 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
const rows = createMemo(() => ledger.rows());
- const headerActions = createMemo<ConnectionsTableHeaderAction[]>(() =>
- readOnly()
- ? []
- : [
- {
- label: 'Add connection',
- onSelect: () => {
- setInitialAddType(null);
- setAddMode(true);
- setShowAgentProfiles(false);
- },
- tone: 'secondary' as const,
- },
- {
- label: 'Install agent',
- onSelect: () => {
- setInitialAddType('agent');
- setAddMode(true);
- setShowAgentProfiles(false);
- },
- tone: 'secondary' as const,
- },
- ],
- );
+ const startAddConnection = () => {
+ setInitialAddType(null);
+ setAddMode(true);
+ setShowAgentProfiles(false);
+ };
+
+ const startInstallAgent = () => {
+ setInitialAddType('agent');
+ setAddMode(true);
+ setShowAgentProfiles(false);
+ };
const agentUninstallCommands = createMemo(() => ({
linux: operations.getUninstallCommand(),
@@ -208,10 +195,13 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<Switch
fallback={
<>
- <ConnectionsExplainer />
+ <ConnectionsExplainer
+ readOnly={readOnly()}
+ onAddConnection={readOnly() ? undefined : startAddConnection}
+ onInstallAgent={readOnly() ? undefined : startInstallAgent}
+ />
<ConnectionsTable
rows={rows}
- headerActions={headerActions()}
actions={readOnly() ? undefined : rowActions}
onEdit={readOnly() ? undefined : handleEditConnection}
agentUninstallCommands={agentUninstallCommands()}
diff --git a/frontend-modern/src/components/Settings/__tests__/ConnectionsExplainer.test.tsx b/frontend-modern/src/components/Settings/__tests__/ConnectionsExplainer.test.tsx
index f3bb1c26b5..9ff8723a2f 100644
--- a/frontend-modern/src/components/Settings/__tests__/ConnectionsExplainer.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ConnectionsExplainer.test.tsx
@@ -1,17 +1,10 @@
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import { afterEach, describe, expect, it, vi } from 'vitest';
import { ConnectionsExplainer } from '../ConnectionsExplainer';
-const DISMISS_KEY = 'pulse.infrastructure.explainer.dismissed.v1';
-
describe('ConnectionsExplainer', () => {
- beforeEach(() => {
- window.localStorage.clear();
- });
-
afterEach(() => {
cleanup();
- window.localStorage.clear();
});
it('names both ingestion modes with their branded labels', () => {
@@ -51,19 +44,44 @@ describe('ConnectionsExplainer', () => {
}
});
- it('hides itself and persists dismissal to localStorage when closed', () => {
- const { container } = render(() => <ConnectionsExplainer />);
+ it('exposes Add connection and Install agent as the entry CTAs, not as duplicate buttons elsewhere', () => {
+ const onAddConnection = vi.fn();
+ const onInstallAgent = vi.fn();
+
+ render(() => (
+ <ConnectionsExplainer
+ onAddConnection={onAddConnection}
+ onInstallAgent={onInstallAgent}
+ />
+ ));
- fireEvent.click(screen.getByRole('button', { name: 'Dismiss' }));
+ const addBtn = screen.getByRole('button', { name: /^Add connection$/i });
+ const installBtn = screen.getByRole('button', { name: /^Install agent$/i });
- expect(container.querySelector('section')).toBeNull();
- expect(window.localStorage.getItem(DISMISS_KEY)).toBe('1');
+ fireEvent.click(addBtn);
+ expect(onAddConnection).toHaveBeenCalledTimes(1);
+ expect(onInstallAgent).not.toHaveBeenCalled();
+
+ fireEvent.click(installBtn);
+ expect(onInstallAgent).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not render the action CTAs in read-only mode', () => {
+ render(() => (
+ <ConnectionsExplainer
+ readOnly
+ onAddConnection={() => {}}
+ onInstallAgent={() => {}}
+ />
+ ));
+
+ expect(screen.queryByRole('button', { name: /^Add connection$/i })).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Install agent$/i })).toBeNull();
});
- it('stays dismissed across remounts once localStorage records it', () => {
- window.localStorage.setItem(DISMISS_KEY, '1');
- const { container } = render(() => <ConnectionsExplainer />);
+ it('no longer offers a dismiss affordance — the cards are the entry path, not a tutorial banner', () => {
+ render(() => <ConnectionsExplainer />);
- expect(container.querySelector('section')).toBeNull();
+ expect(screen.queryByRole('button', { name: /Dismiss/i })).toBeNull();
});
});
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index 20c2800f2f..cf2c80d3c9 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -232,10 +232,10 @@ describe('InfrastructureWorkspace', () => {
expect(setSearchParamsSpy).not.toHaveBeenCalled();
});
- it('routes to the agent install slot via the ledger-header Install agent button', () => {
+ it('routes to the agent install slot via the Install agent CTA inside the entry card', () => {
renderWorkspace();
- // The agent path is a first-class peer action in the ledger header, not
+ // The agent path is a first-class peer entry inside the unified cards, not
// a subtext offramp hidden inside the Add screen — a user who wants
// CPU/disk temps or is on bare-metal Linux should reach it in one click.
fireEvent.click(screen.getByRole('button', { name: /^Install agent$/i }));
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index a946caef9e..dbcac8d474 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -30,9 +30,9 @@ describe('settings architecture guardrails', () => {
it('keeps infrastructure onboarding route-backed under the shared settings shell', () => {
expect(settingsHeaderMetaSource).toContain("'infrastructure-systems': {");
- expect(settingsHeaderMetaSource).toContain('Review monitored systems in one ledger');
- expect(settingsHeaderMetaSource).toContain('Add connection for Platform API setup');
- expect(settingsHeaderMetaSource).toContain('Install agent for host-level metrics');
+ expect(settingsHeaderMetaSource).toContain(
+ 'Review monitored systems and add new connections or agent installs from one place',
+ );
expect(settingsNavigationHookSource).toContain('deriveAddStepFromLegacyPath(path)');
expect(settingsNavigationHookSource).toContain(
diff --git a/frontend-modern/src/components/Settings/settingsHeaderMeta.ts b/frontend-modern/src/components/Settings/settingsHeaderMeta.ts
index 878274f8fb..043a63c9a8 100644
--- a/frontend-modern/src/components/Settings/settingsHeaderMeta.ts
+++ b/frontend-modern/src/components/Settings/settingsHeaderMeta.ts
@@ -10,7 +10,7 @@ export const SETTINGS_HEADER_META: SettingsHeaderMetaMap = {
'infrastructure-systems': {
title: 'Infrastructure',
description:
- 'Review monitored systems in one ledger. Add connection for Platform API setup; Install agent for host-level metrics or bare-metal Linux / Unraid / FreeBSD.',
+ 'Review monitored systems and add new connections or agent installs from one place.',
},
'system-general': {
title: 'General',