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.

Surface the primary action inline in the empty connections table

rcourtman6058f1397489
diff --git a/frontend-modern/src/components/Settings/ConnectionsTable.tsx b/frontend-modern/src/components/Settings/ConnectionsTable.tsx
index 6cf852e860..7dcf40cfc4 100644
--- a/frontend-modern/src/components/Settings/ConnectionsTable.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionsTable.tsx
@@ -11,10 +11,7 @@ import {
import type { Connection } from '@/api/connections';
import type { InfrastructureSystemRow } from './connectionsTableModel';
import type { ConnectionRowActions } from './useConnectionRowActions';
-import {
- getInfrastructureEmptyStateDetail,
- getInfrastructureEmptyStateSummary,
-} from '@/utils/infrastructureOnboardingPresentation';
+import { getInfrastructureEmptyStateSummary } from '@/utils/infrastructureOnboardingPresentation';
export interface ConnectionsTableHeaderAction {
label: string;
@@ -84,11 +81,28 @@ export const ConnectionsTable: Component<ConnectionsTableProps> = (props) => {
<Show
when={props.rows().length > 0}
fallback={
- <div class="space-y-2 px-4 py-10 text-center">
- <div class="text-sm font-medium text-base-content">Start monitoring infrastructure</div>
+ <div class="space-y-3 px-4 py-10 text-center">
+ <div class="text-base font-semibold text-base-content">
+ Start monitoring infrastructure
+ </div>
<div class="mx-auto max-w-3xl text-sm text-muted">
- {getInfrastructureEmptyStateDetail()}
+ Add your first server, cluster, or appliance to begin. Supported sources include
+ Proxmox VE, TrueNAS SCALE, Unraid, network endpoints, and any host running Pulse
+ Agent.
</div>
+ <Show when={(props.headerActions ?? []).find((action) => action.tone === 'primary')}>
+ {(primary) => (
+ <div class="pt-2">
+ <button
+ type="button"
+ onClick={primary().onSelect}
+ class="inline-flex items-center gap-1.5 rounded-md bg-blue-600 px-4 py-2 text-sm font-semibold text-white hover:bg-blue-700"
+ >
+ {primary().label}
+ </button>
+ </div>
+ )}
+ </Show>
</div>
}
>
diff --git a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
index 202d2f8c65..c1e9f37023 100644
--- a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
@@ -70,12 +70,30 @@ describe('ConnectionsTable', () => {
render(() => <ConnectionsTable rows={() => []} />);
expect(screen.getByText('Start monitoring infrastructure')).toBeInTheDocument();
+ // Empty-state copy now leads with the action ('Add your first server,
+ // cluster, or appliance to begin') and lists a curated short set of
+ // supported sources rather than the full enumeration.
expect(
- screen.getByText(/Supported source types include VMware vCenter, TrueNAS SCALE/i),
+ screen.getByText(/Add your first server, cluster, or appliance to begin/i),
).toBeInTheDocument();
expect(screen.queryByRole('table')).toBeNull();
});
+ it('surfaces the primary action inline in the empty state when one is provided', () => {
+ const onSelect = vi.fn();
+ render(() => (
+ <ConnectionsTable
+ rows={() => []}
+ headerActions={[{ label: 'Add infrastructure', tone: 'primary', onSelect }]}
+ />
+ ));
+
+ const button = screen.getAllByRole('button', { name: 'Add infrastructure' });
+ expect(button.length).toBeGreaterThan(0);
+ fireEvent.click(button[button.length - 1]);
+ expect(onSelect).toHaveBeenCalled();
+ });
+
it('renders one row per monitored system with coverage and status labels', () => {
render(() => (
<ConnectionsTable
@@ -112,7 +130,12 @@ describe('ConnectionsTable', () => {
/>
));
- fireEvent.click(screen.getByRole('button', { name: /Add connection/i }));
+ // Empty state now also surfaces the primary action inline so the
+ // button appears in both the header and the empty-state body. Click
+ // either; both wire to the same callback.
+ const buttons = screen.getAllByRole('button', { name: /Add connection/i });
+ expect(buttons.length).toBeGreaterThan(0);
+ fireEvent.click(buttons[0]);
expect(onAdd).toHaveBeenCalledTimes(1);
});