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.

Simplify infrastructure discovery and method cues

rcourtman395d654e711e
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 469bf30610..bc0ea8ef8b 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -359,7 +359,11 @@ an add-only capacity posture.
into the same typed add dialog with canonical prefills. Lifecycle flows
must not fork a second discovery-specific credential wizard or treat
discovery results as already-enrolled systems before the operator saves
- the governed add form.
+ the governed add form. That same landing-owned shell now keeps discovery
+ compact: the persistent page may expose only a concise discovery status
+ line plus `Run discovery` / `Discovery settings` actions, while new-source
+ admission stays on the per-platform table actions instead of competing
+ with discovery at the top of the page.
The editor's probe step calls the aggregator probe endpoint and
dispatches the detected or manually-selected type into a credential
slot; it must not bypass the probe endpoint or fabricate probe
@@ -1022,10 +1026,11 @@ label now means the shared Infrastructure onboarding path
`PlatformConnectionsWorkspace.tsx` shell.
That infrastructure destination now has one canonical mental model:
configured infrastructure sources stay visible on the landing page as the
-primary objects the operator manages. The landing grid is instance-first, not
-type-first: existing connections or agent-backed hosts render as source cards,
-the same grid carries one `Add infrastructure` tile, and the monitored-system
-ledger remains secondary context below.
+primary objects the operator manages. The landing table is instance-first, not
+type-first: existing connections or agent-backed hosts render inside one
+platform-banded systems ledger, each platform section owns its own `Add`
+action, and the page does not fork back into a second monitored-systems ledger
+below.
Adding infrastructure therefore happens in two governed steps. The
`?add=pick` modal owns grouped source-type selection and may offer
`Detect from address` as a secondary utility. The `?add=detect` modal owns
@@ -1035,6 +1040,12 @@ sidebar still owns only the top-level `Infrastructure` destination; movement
between landing, picker, detect flow, add form, and edit form belongs to
explicit actions inside `InfrastructureWorkspace.tsx`, not extra sidebar
entries or body-replacing workspace subtabs.
+That same landing/table contract now also owns collection-method phrasing.
+`connectionsTableModel.ts`, `useConnectionsLedger.ts`,
+`InfrastructureSourceManager.tsx`, and `ConnectionsTable.tsx` must present the
+same plain-language subtitle (`via platform API`, `via Pulse Agent`, or `via
+platform API and Pulse Agent`) from the shared ledger contract instead of
+shipping badge-only heuristics that operators have to decode visually.
That same lifecycle-owned platform onboarding boundary must keep API-backed
provider state operationally useful, not CRUD-only.
`useTrueNASSettingsPanelState.ts` and `useVMwareSettingsPanelState.ts` must
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index d75a73b8ae..f5c39df949 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -1552,6 +1552,11 @@ API-backed lifecycle state. The retired
`InfrastructureOperationsController.tsx` shell and
`useInfrastructureReportingState.tsx` reporting path must not be reintroduced
as parallel transport owners.
+That same `/api/connections` projection also owns collection-method truth for
+the infrastructure ledger: `useConnectionsLedger.ts` must derive one canonical
+subtitle (`via platform API`, `via Pulse Agent`, or `via platform API and
+Pulse Agent`) from the shared system/component payload instead of letting page-
+local tables invent their own API-versus-agent badge heuristics.
That same shared infrastructure-settings boundary also owns install-profile
semantics surfaced by
`frontend-modern/src/components/Settings/infrastructureOperationsModel.tsx`:
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 25b58267ed..940cde7608 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -255,15 +255,17 @@ work extends shared components instead of creating new local variants.
modal body instead of trapping the lower fields below the fold.
The same shared shell boundary now also owns grouped source-row composition.
`useConnectionsLedger.ts`, `InfrastructureSourceManager.tsx`, and
- `InfrastructureWorkspace.tsx` must render attached collection methods as
- composition on the owning row, with explicit badges and edit-dialog detail,
- instead of duplicating the same machine across multiple peer groups and
- forcing operators to infer the relationship visually.
+ `InfrastructureWorkspace.tsx` must render attached collection methods as a
+ plain-language row subtitle on the owning row (`via platform API`, `via
+ Pulse Agent`, or `via platform API and Pulse Agent`), with fuller detail in
+ the edit dialog, instead of duplicating the same machine across multiple
+ peer groups or forcing operators to decode badge jargon.
That same shared shell boundary owns the landing taxonomy too: the primary
grouping labels in the infrastructure manager must describe real
platform/system owners, not collection methods. Agent-only machines belong
- in a standalone-host bucket, while `Pulse Agent` remains a badge, install
- path, and detail-surface method label rather than a peer top-level
+ in a standalone-host bucket, while `Pulse Agent` remains a collection-
+ method label, install path, and detail-surface concept rather than a peer
+ top-level
pseudo-platform beside Proxmox, VMware, and TrueNAS.
That same shared shell boundary also owns compact version visibility for
agent-backed rows. The infrastructure source table must not grow a dedicated
@@ -277,12 +279,14 @@ work extends shared components instead of creating new local variants.
and local edit flows stay single-purpose instead of stacking multiple
page-level workspaces at once.
The source-manager landing now also owns the explicit discovery strip for
- that destination. `InfrastructureSourceManager.tsx` may expose `Run
- discovery`, `Add infrastructure`, and `Discovery settings` actions from the
- shared landing shell, but it must not start a network scan just because the
- page rendered. The direct address-probe utility is picker-owned rather than
- landing-owned: `Detect from address` must stay inside the grouped add
- dialog instead of competing with discovery actions on the page header.
+ that destination. `InfrastructureSourceManager.tsx` may expose a compact
+ discovery status line plus `Run discovery` and `Discovery settings`
+ actions from the shared landing shell, but it must not start a network scan
+ just because the page rendered. New-source admission belongs on the table's
+ per-platform `Add` actions rather than in the discovery strip, and the
+ direct address-probe utility is picker-owned rather than landing-owned:
+ `Detect from address` must stay inside the grouped add dialog instead of
+ competing with discovery actions on the page header.
Discovered API-backed candidates stay visible in the same platform-group
table as configured sources, using the existing tree/table hierarchy
instead of spawning a second discovery-only page or card stack.
@@ -313,10 +317,9 @@ work extends shared components instead of creating new local variants.
slot is exactly the ledger-inside-editor drift this contract forbids.
The configured-connections summary and source-manager rows themselves must
render exclusively from the aggregator.
- `InfrastructureWorkspace.tsx` composes the instance-first source cards plus
- the subordinate monitored-systems table from
- `frontend-modern/src/components/Settings/useConnectionsLedger.ts`
- (polling `GET /api/connections`). Source cards may open a governed edit
+ `InfrastructureWorkspace.tsx` composes the platform-banded systems table
+ from `frontend-modern/src/components/Settings/useConnectionsLedger.ts`
+ (polling `GET /api/connections`). Table rows may open a governed edit
dialog for mutable sources, but pause, resume, remove, last-error detail,
and agent uninstall commands must live inside that owned edit surface or
the shared row-action owner rather than returning to inline landing-page
diff --git a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
index 3e9f6b2e0c..72833159f5 100644
--- a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
@@ -26,7 +26,6 @@ interface InfrastructureSourceManagerProps {
discoveryEnabled: boolean;
discoveryScanStatus: Accessor<DiscoveryScanStatus>;
readOnly: boolean;
- onOpenAddInfrastructure?: () => void;
onAddSource?: (type: InfrastructureOnboardingConnectionType) => void;
onRunDiscovery?: () => void;
onOpenDiscoverySettings?: () => void;
@@ -88,28 +87,17 @@ const discoveredServerEndpoint = (server: DiscoveredServer): string =>
const discoveredCoverageText = (server: DiscoveredServer): string =>
getInfrastructureOnboardingProductPresentation(server.type).coverage;
-const rowAgentConnections = (row: InfrastructureSystemRow) => {
- const attachedAgents = row.attachedConnections.filter(
+const agentMethodTitleFor = (row: InfrastructureSystemRow): string | undefined => {
+ const agentConnections = row.attachedConnections.filter(
(connection) => connection.type === 'agent',
);
if (row.connection.type === 'agent') {
- return [row.connection, ...attachedAgents];
+ agentConnections.unshift(row.connection);
}
- return attachedAgents;
-};
-
-const pulseAgentBadgeTitle = (row: InfrastructureSystemRow): string | undefined => {
- const agentConnections = rowAgentConnections(row);
if (agentConnections.length === 0) return undefined;
if (agentConnections.length === 1) {
return connectionAgentVersionPresentation(agentConnections[0])?.title ?? 'Pulse Agent attached';
}
- const updateCount = agentConnections.filter(
- (connection) => connection.agentUpdateAvailable,
- ).length;
- if (updateCount > 0) {
- return `${agentConnections.length} Pulse Agent attachments · ${updateCount} update available`;
- }
return `${agentConnections.length} Pulse Agent attachments`;
};
@@ -186,45 +174,20 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
const lastDiscoveryResultText = createMemo(() =>
formatRelativeTimestamp(props.discoveryScanStatus().lastResultAt),
);
- const discoveryStatePresentation = createMemo(() => {
- if (props.discoveryScanStatus().scanning) {
- return {
- badgeLabel: 'Scanning',
- badgeClass:
- 'inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-[11px] font-medium text-blue-800 dark:bg-blue-950/40 dark:text-blue-200',
- description: 'Scanning the saved discovery scope now.',
- };
- }
-
- if (props.discoveryEnabled) {
- return {
- badgeLabel: 'Automatic',
- badgeClass:
- 'inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-[11px] font-medium text-green-800 dark:bg-green-950/40 dark:text-green-200',
- description: 'Automatic scanning is enabled.',
- };
- }
-
- return {
- badgeLabel: 'Manual',
- badgeClass:
- 'inline-flex items-center rounded-full bg-surface-alt px-2 py-0.5 text-[11px] font-medium text-base-content',
- description: 'Automatic scanning is off.',
- };
- });
-
const discoverySummary = createMemo(() => {
const parts: string[] = [];
+ parts.push(props.discoveryEnabled ? 'Automatic discovery on' : 'Automatic discovery off');
+ if (props.discoveryScanStatus().scanning) {
+ parts.push('Scanning now');
+ }
if (discoveredCount() > 0) {
- parts.push(`${discoveredCount()} candidate${discoveredCount() === 1 ? '' : 's'} visible`);
+ parts.push(`${discoveredCount()} candidate${discoveredCount() === 1 ? '' : 's'}`);
}
if (lastDiscoveryResultText()) {
parts.push(`Updated ${lastDiscoveryResultText()}`);
}
if (discoveryErrors().length > 0) {
- parts.push(
- `${discoveryErrors().length} discovery issue${discoveryErrors().length === 1 ? '' : 's'} reported`,
- );
+ parts.push(`${discoveryErrors().length} issue${discoveryErrors().length === 1 ? '' : 's'}`);
}
return parts;
});
@@ -236,20 +199,12 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
noPadding
icon={<Server class="h-5 w-5" strokeWidth={2} />}
>
- <div class="border-b border-border bg-surface-alt/40 px-3 py-3 sm:px-4">
- <div class="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between">
- <div class="min-w-0 space-y-1.5">
- <div class="flex flex-wrap items-center gap-2">
- <h3 class="text-sm font-medium text-base-content">Discovery</h3>
- <span class={discoveryStatePresentation().badgeClass}>
- {discoveryStatePresentation().badgeLabel}
- </span>
- </div>
- <div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted">
- <span>{discoveryStatePresentation().description}</span>
- <Show when={discoverySummary().length > 0}>
- <span class="text-xs text-muted">{discoverySummary().join(' · ')}</span>
- </Show>
+ <div class="border-b border-border bg-surface-alt/40 px-3 py-2.5 sm:px-4">
+ <div class="flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between">
+ <div class="min-w-0">
+ <div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
+ <span class="font-medium text-base-content">Discovery</span>
+ <span class="text-muted">{discoverySummary().join(' · ')}</span>
</div>
</div>
@@ -269,25 +224,16 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
</button>
</Show>
- <Show when={props.onOpenAddInfrastructure}>
- <button
- type="button"
- onClick={props.onOpenAddInfrastructure}
- class={utilityToolbarButtonClass}
- >
- <Plus class="h-4 w-4" />
- Add infrastructure
- </button>
- </Show>
-
<Show when={props.onOpenDiscoverySettings}>
<button
type="button"
onClick={props.onOpenDiscoverySettings}
class={utilityToolbarButtonClass}
+ aria-label="Discovery settings"
+ title="Discovery settings"
>
<SlidersHorizontal class="h-4 w-4" />
- Discovery settings
+ Settings
</button>
</Show>
</div>
@@ -380,22 +326,12 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
{row.name}
</div>
</div>
- <Show when={row.sourceBadges.length > 0}>
- <div class="flex flex-wrap items-center gap-1">
- <For each={row.sourceBadges}>
- {(badge) => (
- <span
- class="inline-flex items-center rounded-full border border-border bg-surface-alt px-1.5 py-0 text-[9px] font-medium leading-4 text-muted"
- title={
- badge === 'Pulse Agent'
- ? pulseAgentBadgeTitle(row)
- : undefined
- }
- >
- {badge}
- </span>
- )}
- </For>
+ <Show when={row.subtitle}>
+ <div
+ class="text-[11px] leading-4 text-muted"
+ title={agentMethodTitleFor(row) ?? row.subtitle}
+ >
+ {row.subtitle}
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index ebec8f720f..0d4cacc0df 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -800,7 +800,6 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
discoveryEnabled={props.discoveryEnabled()}
discoveryScanStatus={props.discoveryScanStatus}
readOnly={readOnly()}
- onOpenAddInfrastructure={readOnly() ? undefined : () => openAddFlow('pick')}
onAddSource={
readOnly()
? undefined
diff --git a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
index cc0809c45b..fb2f0fa4bc 100644
--- a/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx
@@ -31,7 +31,6 @@ const row = (overrides: Partial<InfrastructureSystemRow> = {}): InfrastructureSy
subtitle: undefined,
host: '10.0.0.1',
coverageLabels: ['Host telemetry'],
- sourceBadges: [],
statusLabel: 'online',
statusClassName: 'bg-green-100 text-green-800',
agentUpdateCount: 0,
@@ -79,7 +78,7 @@ describe('ConnectionsTable', () => {
row({
id: 'truenas:nas',
name: 'nas',
- subtitle: 'Platform API · TrueNAS',
+ subtitle: 'via platform API',
host: undefined,
coverageLabels: ['Datasets'],
statusLabel: 'Paused',
@@ -92,7 +91,7 @@ describe('ConnectionsTable', () => {
expect(screen.getByRole('table')).toBeInTheDocument();
expect(screen.getByText('tower')).toBeInTheDocument();
expect(screen.getByText('nas')).toBeInTheDocument();
- expect(screen.getByText('Platform API · TrueNAS')).toBeInTheDocument();
+ expect(screen.getByText('via platform API')).toBeInTheDocument();
expect(screen.getByText('Datasets')).toBeInTheDocument();
expect(screen.getByText('Paused')).toBeInTheDocument();
expect(screen.getByText('online')).toBeInTheDocument();
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index 1e978290f1..5723567820 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -69,13 +69,9 @@ vi.mock('../useConnectionsLedger', () => ({
id: connection.id,
ownerType: connection.type,
name: connection.name || connection.id,
- subtitle:
- connection.type === 'agent'
- ? 'Pulse Unified Agent'
- : `Platform API · ${connection.type === 'truenas' ? 'TrueNAS SCALE' : connection.type}`,
+ subtitle: connection.type === 'agent' ? 'via Pulse Agent' : 'via platform API',
host: connection.address,
coverageLabels: ['VMs'],
- sourceBadges: connection.type === 'agent' ? ['Pulse Agent'] : ['API'],
statusLabel: connection.state === 'paused' ? 'Paused' : 'Active',
statusClassName: 'bg-green-100 text-green-800',
agentUpdateCount: 0,
@@ -242,7 +238,6 @@ describe('InfrastructureWorkspace', () => {
await waitFor(() => expect(screen.getByText('Infrastructure systems')).toBeInTheDocument());
expect(screen.getByRole('button', { name: /Run discovery/i })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: /Add infrastructure/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Discovery settings/i })).toBeInTheDocument();
expect(screen.queryByRole('button', { name: /Detect from address/i })).toBeNull();
expect(screen.getByText('VMware vCenter')).toBeInTheDocument();
@@ -272,8 +267,8 @@ describe('InfrastructureWorkspace', () => {
await waitFor(() => expect(screen.getByText('discovered-pve.lab')).toBeInTheDocument());
expect(screen.getByText('Discovered')).toBeInTheDocument();
- expect(screen.getByText('Automatic scanning is off.')).toBeInTheDocument();
- expect(screen.getByText(/1 candidate visible/i)).toBeInTheDocument();
+ expect(screen.getByText(/Automatic discovery off/i)).toBeInTheDocument();
+ expect(screen.getByText(/1 candidate/i)).toBeInTheDocument();
expect(screen.getByText(/Updated /i)).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /Run discovery/i }));
@@ -291,16 +286,6 @@ describe('InfrastructureWorkspace', () => {
});
});
- it('opens the source picker from the source manager header action', () => {
- renderWorkspace();
-
- fireEvent.click(screen.getByRole('button', { name: /Add infrastructure/i }));
-
- expect(navigateSpy).toHaveBeenCalledWith('/settings/infrastructure?add=pick', {
- scroll: false,
- });
- });
-
it('opens a type-specific add route from the matching platform section', () => {
renderWorkspace();
@@ -431,10 +416,9 @@ describe('InfrastructureWorkspace', () => {
id: primaryConnection.id,
ownerType: 'pve',
name: primaryConnection.name || primaryConnection.id,
- subtitle: 'Platform API · pve',
+ subtitle: 'via platform API and Pulse Agent',
host: primaryConnection.address,
coverageLabels: ['VMs', 'Host telemetry'],
- sourceBadges: ['API', 'Pulse Agent'],
statusLabel: 'Active',
statusClassName: 'bg-green-100 text-green-800',
agentUpdateCount: 1,
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 3a5f717f77..cc13de3cca 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -139,9 +139,6 @@ describe('settings architecture guardrails', () => {
'const [showDiscoverySettings, setShowDiscoverySettings] = createSignal(false);',
);
expect(infrastructureWorkspaceSource).toContain('<InfrastructureDiscoverySettingsDialog');
- expect(infrastructureWorkspaceSource).toContain(
- "onOpenAddInfrastructure={readOnly() ? undefined : () => openAddFlow('pick')}",
- );
expect(infrastructureWorkspaceSource).toContain('onReviewDiscoveredSource');
expect(infrastructureWorkspaceSource).toContain('void props.loadDiscoveredNodes();');
expect(infrastructureWorkspaceSource).toContain('<InfrastructureSourceManager');
@@ -160,7 +157,6 @@ describe('settings architecture guardrails', () => {
expect(infrastructureWorkspaceSource).not.toContain('PlatformConnectionsWorkspace');
expect(infrastructureSourceManagerSource).toContain('Infrastructure systems');
expect(infrastructureSourceManagerSource).toContain('Run discovery');
- expect(infrastructureSourceManagerSource).toContain('Add infrastructure');
expect(infrastructureSourceManagerSource).toContain('Discovery settings');
expect(infrastructureSourceManagerSource).toContain(
'Configured systems and discovered candidates grouped by platform or host type.',
diff --git a/frontend-modern/src/components/Settings/connectionsTableModel.ts b/frontend-modern/src/components/Settings/connectionsTableModel.ts
index b025e37ca5..8b0e28145f 100644
--- a/frontend-modern/src/components/Settings/connectionsTableModel.ts
+++ b/frontend-modern/src/components/Settings/connectionsTableModel.ts
@@ -69,7 +69,6 @@ export interface InfrastructureSystemRow {
subtitle?: string;
host?: string;
coverageLabels: string[];
- sourceBadges: string[];
statusLabel: string;
statusClassName: string;
agentUpdateCount: number;
diff --git a/frontend-modern/src/components/Settings/useConnectionsLedger.ts b/frontend-modern/src/components/Settings/useConnectionsLedger.ts
index 0eb980ee9f..63107a40f0 100644
--- a/frontend-modern/src/components/Settings/useConnectionsLedger.ts
+++ b/frontend-modern/src/components/Settings/useConnectionsLedger.ts
@@ -87,12 +87,6 @@ const EDITABLE_CONNECTION_TYPES: readonly ConnectionType[] = [
'truenas',
];
-const subtitleFor = (connection: Connection): string | undefined => {
- if (connection.stateReason) return connection.stateReason;
- const productLabel = CONNECTION_TYPE_LABELS[connection.type] ?? connection.type;
- return PLATFORM_API_TYPES.has(connection.type) ? `Platform API · ${productLabel}` : productLabel;
-};
-
const coverageLabelsFor = (connections: readonly Connection[]): string[] => {
const seen = new Set<string>();
for (const connection of connections) {
@@ -110,15 +104,24 @@ const coverageLabelsFor = (connections: readonly Connection[]): string[] => {
return [...seen];
};
-const sourceBadgesFor = (connections: readonly Connection[]): string[] => {
- const badges: string[] = [];
- if (connections.some((connection) => PLATFORM_API_TYPES.has(connection.type))) {
- badges.push('API');
+const subtitleFor = (connections: readonly Connection[], primaryConnection: Connection): string => {
+ const hasPlatformAPI = connections.some((connection) => PLATFORM_API_TYPES.has(connection.type));
+ const hasPulseAgent = connections.some((connection) => connection.type === 'agent');
+
+ if (hasPlatformAPI && hasPulseAgent) {
+ return 'via platform API and Pulse Agent';
}
- if (connections.some((connection) => connection.type === 'agent')) {
- badges.push('Pulse Agent');
+
+ if (hasPlatformAPI) {
+ return 'via platform API';
}
- return badges;
+
+ if (hasPulseAgent) {
+ return 'via Pulse Agent';
+ }
+
+ const productLabel = CONNECTION_TYPE_LABELS[primaryConnection.type] ?? primaryConnection.type;
+ return `via ${productLabel}`;
};
const agentUpdateCountFor = (connections: readonly Connection[]): number =>
@@ -148,10 +151,9 @@ const buildRow = (
id: primaryConnection.id,
ownerType,
name,
- subtitle: subtitleFor(primaryConnection),
+ subtitle: subtitleFor(componentConnections, primaryConnection),
host,
coverageLabels: coverageLabelsFor(componentConnections),
- sourceBadges: sourceBadgesFor(componentConnections),
statusLabel: presentation.label,
statusClassName: presentation.badgeClass,
agentUpdateCount: agentUpdateCountFor(componentConnections),