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 identified service in GuestDrawer overview

rcourtmanfe7b618e8f56
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index afcc56390e..1509598b89 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1362,6 +1362,15 @@ AI runtime.
entitlement. Cloud interest links from self-hosted plan surfaces must hand
off to Pulse Account/public Cloud ownership rather than route to an
in-product Cloud trial/signup page.
+37. Keep the identified-service reducer on `discoveryPresentation.ts`. Any
+ surface that wants to label a workload with the AI-identified service
+ (drawer overview card, future row chips, MCP capability payloads) must
+ consume `getDiscoveryIdentifiedSummary` rather than re-implement the
+ empty/low-signal gate. The helper returns null when the stored record
+ has no useful identification — mirroring the Discovery tab's
+ `hasValidDiscovery` — so the same record either renders in all
+ surfaces or hides in all surfaces, preventing "Unknown" rows or
+ zero-confidence noise from drifting into peripheral UI.
## Current State
@@ -3099,6 +3108,15 @@ the shared command-execution and `agent:exec` token-scope links; discovery
surfaces may explain those states, but the visible links must remain
`Settings → Infrastructure` and `Settings → API Access` through that helper,
not inline legacy labels or old settings paths.
+That same presentation owner also packages the identified-service summary
+consumed by surfaces outside the Discovery sub-tab.
+`getDiscoveryIdentifiedSummary` is the canonical reducer that turns a stored
+`ResourceDiscovery` into the compact card payload (service name, category,
+confidence percent, port and path counts, cli access hint). New surfaces that
+want to label a workload with its identified service must read through that
+helper rather than re-implementing the empty/low-signal gate, so the
+Discovery tab and out-of-tab surfaces collapse the same records and avoid
+surfacing "Unknown" rows or zero-confidence noise.
That same settings-shell boundary now also owns the shared settings
presentation helpers that those panels consume. `frontend-modern/src/utils/systemSettingsPresentation.ts`
is the canonical owner for shared system-settings presets, summaries, and
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 29ed2714d6..f15d32f2b7 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -1500,3 +1500,17 @@ other than `will_fix_later`. The newer `AutoResolved` attribution flag
on the same UnifiedFinding shape stays a fixed-size `bool` in the same
struct, so the operator-vs-Pulse closure attribution adds no per-row
allocation pressure on the same hot path.
+That same Workloads drawer boundary now also owns passive discovery
+surfacing in the overview. `useGuestDrawerState.ts` may issue a single
+`GET /api/discovery/{type}/{target}/{id}` per drawer open through
+`getDiscovery` to populate an "Identified Service" card in
+`GuestDrawerOverview.tsx`, but must never trigger a scan or modify
+discovery state — manual scans, progress UI, and approval prompts stay
+owned by `DiscoveryTab` and `useDiscoveryTabState`. Render is gated by
+`getDiscoveryIdentifiedSummary` so empty or low-signal records collapse
+the card entirely instead of mounting an empty container. The drawer
+fetch must reuse the existing `discoveryTarget` derivation (resource
+type, agent id, resource id) rather than re-implementing target
+resolution, so workloads without canonical discovery ownership (e.g.
+TrueNAS app-containers without explicit `discoveryTarget`) skip the
+fetch cleanly.
diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx
index b7b10f64a6..e43c1eb43a 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx
@@ -49,6 +49,18 @@ vi.mock('../Discovery/DiscoveryTab', () => ({
),
}));
+const discoveryApiMocks = vi.hoisted(() => ({
+ getDiscovery: vi.fn(async () => null),
+}));
+
+vi.mock('@/api/discovery', async () => {
+ const actual = await vi.importActual<typeof import('@/api/discovery')>('@/api/discovery');
+ return {
+ ...actual,
+ getDiscovery: discoveryApiMocks.getDiscovery,
+ };
+});
+
vi.mock('@/components/shared/WebInterfaceUrlField', () => ({
WebInterfaceUrlField: (props: {
metadataKind: string;
@@ -169,6 +181,45 @@ describe('GuestDrawer', () => {
expect(panels[1]).toHaveClass('hidden');
});
+ it('renders the Identified Service overview card when a populated discovery record exists', async () => {
+ discoveryApiMocks.getDiscovery.mockResolvedValueOnce({
+ id: 'vm:node1:100',
+ resource_type: 'vm',
+ resource_id: '100',
+ target_id: 'node1',
+ service_name: 'Homepage Dashboard',
+ service_type: 'homepage',
+ category: 'web_server',
+ confidence: 0.95,
+ cli_access: 'docker exec -it homepage /bin/sh',
+ ports: [],
+ facts: [],
+ config_paths: ['/opt/homepage/config'],
+ data_paths: [],
+ log_paths: [],
+ });
+
+ render(() => <GuestDrawer guest={makeGuest()} onClose={vi.fn()} />);
+
+ await waitFor(() => {
+ expect(screen.getByText('Identified Service')).toBeInTheDocument();
+ });
+ expect(screen.getByText('Homepage Dashboard')).toBeInTheDocument();
+ expect(screen.getByText('web_server')).toBeInTheDocument();
+ expect(screen.getByText('95%')).toBeInTheDocument();
+ expect(screen.getByText('docker exec -it homepage /bin/sh')).toBeInTheDocument();
+ });
+
+ it('hides the Identified Service card when the discovery record is null or empty', async () => {
+ discoveryApiMocks.getDiscovery.mockResolvedValueOnce(null);
+ render(() => <GuestDrawer guest={makeGuest()} onClose={vi.fn()} />);
+ // Allow the resource to resolve and a render cycle to happen.
+ await waitFor(() => {
+ expect(discoveryApiMocks.getDiscovery).toHaveBeenCalled();
+ });
+ expect(screen.queryByText('Identified Service')).toBeNull();
+ });
+
it('switches to Discovery tab on click', async () => {
const { container } = render(() => <GuestDrawer guest={makeGuest()} onClose={vi.fn()} />);
await fireEvent.click(screen.getByText('Discovery'));
@@ -684,14 +735,17 @@ describe('GuestDrawer', () => {
type: 'app-container',
platformType: 'docker',
dockerHostId: 'dh-1',
- id: 'container-abc',
+ containerId: 'container-abc-runtime-id',
+ id: 'app-container-synthetic-hash',
})}
onClose={vi.fn()}
/>
));
expect(screen.getByTestId('disc-resource-type').textContent).toBe('app-container');
expect(screen.getByTestId('disc-agent-id').textContent).toBe('dh-1');
- expect(screen.getByTestId('disc-resource-id').textContent).toBe('container-abc');
+ // Discovery routes by the Docker-native containerId, not the canonical
+ // synthetic workload id, so the agent can resolve `docker exec <id>`.
+ expect(screen.getByTestId('disc-resource-id').textContent).toBe('container-abc-runtime-id');
});
it('does not render DiscoveryTab for TrueNAS app-containers without explicit discovery support', () => {
diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.tsx
index 1e6e191ef1..1cd16b1daa 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawer.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawer.tsx
@@ -12,6 +12,7 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
agentTitle,
backupPresentation,
discoveryAgentId,
+ discoveryIdentifiedSummary,
discoveryLoadingState,
discoveryResourceId,
discoveryResourceType,
@@ -115,6 +116,7 @@ export const GuestDrawer: Component<GuestDrawerProps> = (props) => {
customUrl={props.customUrl}
backupPresentation={backupPresentation()}
diskThresholds={diskThresholds()}
+ discoveryIdentifiedSummary={discoveryIdentifiedSummary()}
webInterfaceTargetLabel={webInterfaceTargetLabel()}
/>
</div>
diff --git a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx
index 6698f4b227..e5782f9687 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx
@@ -1,6 +1,7 @@
import { For, Show } from 'solid-js';
import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';
+import type { DiscoveryIdentifiedSummary } from '@/utils/discoveryPresentation';
import { formatBytes, formatUptime } from '@/utils/format';
import type { MetricDisplayThresholds } from '@/utils/metricThresholds';
@@ -31,6 +32,7 @@ interface GuestDrawerOverviewProps {
dateLabel: string;
} | null;
diskThresholds?: MetricDisplayThresholds | null;
+ discoveryIdentifiedSummary?: DiscoveryIdentifiedSummary | null;
webInterfaceTargetLabel: string;
}
@@ -38,6 +40,56 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {
return (
<div>
<div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full [&>*]:overflow-hidden">
+ <Show when={props.discoveryIdentifiedSummary}>
+ {(summary) => (
+ <div class="rounded border border-border bg-surface p-3 shadow-sm">
+ <div class="flex items-center justify-between gap-2 mb-2">
+ <h3 class="text-[11px] font-medium uppercase tracking-wide text-base-content">
+ Identified Service
+ </h3>
+ <span class="text-[10px] font-medium text-muted">
+ {summary().confidencePercent}
+ </span>
+ </div>
+ <div class="space-y-1.5 text-[11px]">
+ <div class="flex items-center justify-between gap-2">
+ <span class="text-muted">Service</span>
+ <span
+ class="font-medium text-base-content truncate ml-2"
+ title={summary().serviceName}
+ >
+ {summary().serviceName}
+ </span>
+ </div>
+ <Show when={summary().category}>
+ <div class="flex items-center justify-between gap-2">
+ <span class="text-muted">Category</span>
+ <span class="font-medium text-base-content truncate ml-2">
+ {summary().category}
+ </span>
+ </div>
+ </Show>
+ <Show when={summary().portCount > 0}>
+ <div class="flex items-center justify-between gap-2">
+ <span class="text-muted">Ports</span>
+ <span class="font-medium text-base-content">{summary().portCount}</span>
+ </div>
+ </Show>
+ <Show when={summary().cliAccess}>
+ <div
+ class="text-[10px] text-muted truncate font-mono"
+ title={summary().cliAccess}
+ >
+ {summary().cliAccess}
+ </div>
+ </Show>
+ <p class="text-[10px] text-muted pt-1">
+ Full details in the Discovery tab.
+ </p>
+ </div>
+ </div>
+ )}
+ </Show>
<div class="rounded border border-border bg-surface p-3 shadow-sm">
<h3 class="text-[11px] font-medium uppercase tracking-wide text-base-content mb-2">
System
diff --git a/frontend-modern/src/components/Workloads/useGuestDrawerState.ts b/frontend-modern/src/components/Workloads/useGuestDrawerState.ts
index 32ed09c147..983270c4b4 100644
--- a/frontend-modern/src/components/Workloads/useGuestDrawerState.ts
+++ b/frontend-modern/src/components/Workloads/useGuestDrawerState.ts
@@ -1,8 +1,12 @@
-import { createEffect, createMemo, createSignal } from 'solid-js';
+import { createEffect, createMemo, createResource, createSignal } from 'solid-js';
+import { getDiscovery } from '@/api/discovery';
import type { HistoryTimeRange } from '@/api/charts';
import { useAlertsActivation } from '@/stores/alertsActivation';
-import { getDiscoveryLoadingState } from '@/utils/discoveryPresentation';
+import {
+ getDiscoveryIdentifiedSummary,
+ getDiscoveryLoadingState,
+} from '@/utils/discoveryPresentation';
import type { DisplayMetricType } from '@/utils/metricThresholds';
import {
getCanonicalWorkloadId,
@@ -84,6 +88,29 @@ export function useGuestDrawerState(props: GuestDrawerProps) {
getWebInterfaceTargetLabelForWorkload(props.guest),
);
+ // Load the existing discovery record (if any) so the Overview can surface
+ // the identified service alongside CPU/agent/OS metadata. This is a passive
+ // read — no scan is triggered. The discovery sub-tab continues to own
+ // manual scan triggering and progress UI.
+ const discoverySourceKey = createMemo(() => {
+ const type = discoveryResourceType();
+ const agent = discoveryAgentId();
+ const resource = discoveryResourceId();
+ if (!type || !agent || !resource) return null;
+ return { type, agent, resource } as const;
+ });
+ const [discoveryRecord] = createResource(discoverySourceKey, async (key) => {
+ if (!key) return null;
+ try {
+ return await getDiscovery(key.type, key.agent, key.resource);
+ } catch {
+ return null;
+ }
+ });
+ const discoveryIdentifiedSummary = createMemo(() =>
+ getDiscoveryIdentifiedSummary(discoveryRecord()),
+ );
+
const switchTab = (tab: GuestDrawerTab) => {
setActiveTab(tab);
};
@@ -103,6 +130,7 @@ export function useGuestDrawerState(props: GuestDrawerProps) {
agentTitle,
backupPresentation,
discoveryAgentId,
+ discoveryIdentifiedSummary,
discoveryLoadingState: getDiscoveryLoadingState(),
discoveryResourceId,
discoveryResourceType,
diff --git a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
index ce0c23c675..23c67ddc7b 100644
--- a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
getDiscoveryApiAccessSettingsTarget,
getDiscoveryCommandSettingsTarget,
+ getDiscoveryIdentifiedSummary,
getDiscoveryInitialEmptyState,
getDiscoveryLoadingState,
getDiscoveryNoConnectedAgentMessage,
@@ -15,6 +16,7 @@ import {
getDiscoverySuggestedURLFallback,
getDiscoveryURLSuggestionSourceLabel,
} from '@/utils/discoveryPresentation';
+import type { ResourceDiscovery } from '@/types/discovery';
describe('discoveryPresentation', () => {
it('returns canonical proxmox profile labels', () => {
@@ -141,4 +143,58 @@ describe('discoveryPresentation', () => {
'Example: 192.168.1.0/24, 10.0.0.0/24. Smaller ranges finish faster and reduce timeout risk.',
});
});
+
+ it('compacts a populated discovery record into the identified-service summary', () => {
+ const record: ResourceDiscovery = {
+ id: 'system-container:delly:141',
+ resource_type: 'system-container',
+ resource_id: '141',
+ target_id: 'delly',
+ service_name: 'Homepage Dashboard',
+ service_type: 'homepage',
+ category: 'web_server',
+ confidence: 0.95,
+ cli_access: 'docker exec -it homepage /bin/sh',
+ ports: [{ port: 3000, protocol: 'tcp', process: 'next-server', address: '0.0.0.0' }] as unknown as ResourceDiscovery['ports'],
+ facts: [{ key: 'os', value: 'Debian 12', source: 'os_release', category: 'security', confidence: 1, discovered_at: '' }] as unknown as ResourceDiscovery['facts'],
+ config_paths: ['/opt/homepage/config'],
+ data_paths: ['/opt/homepage/config'],
+ log_paths: ['/var/log/syslog', '/var/log/daemon.log'],
+ discovered_at: '2026-05-17T09:49:19.049058+01:00',
+ } as ResourceDiscovery;
+ expect(getDiscoveryIdentifiedSummary(record)).toEqual({
+ serviceName: 'Homepage Dashboard',
+ serviceType: 'homepage',
+ category: 'web_server',
+ confidence: 0.95,
+ confidencePercent: '95%',
+ cliAccess: 'docker exec -it homepage /bin/sh',
+ portCount: 1,
+ configPathCount: 1,
+ dataPathCount: 1,
+ logPathCount: 2,
+ discoveredAt: '2026-05-17T09:49:19.049058+01:00',
+ });
+ });
+
+ it('collapses empty / low-signal discovery records to null so out-of-tab surfaces hide cleanly', () => {
+ expect(getDiscoveryIdentifiedSummary(null)).toBeNull();
+ expect(getDiscoveryIdentifiedSummary(undefined)).toBeNull();
+ // Empty record: no service name, confidence zero, no ports / facts / paths / cli.
+ expect(
+ getDiscoveryIdentifiedSummary({
+ id: 'docker:agent:container',
+ resource_type: 'docker',
+ resource_id: 'container',
+ target_id: 'agent',
+ service_name: 'Unknown',
+ confidence: 0,
+ ports: [],
+ facts: [],
+ config_paths: [],
+ data_paths: [],
+ log_paths: [],
+ } as ResourceDiscovery),
+ ).toBeNull();
+ });
});
diff --git a/frontend-modern/src/utils/discoveryPresentation.ts b/frontend-modern/src/utils/discoveryPresentation.ts
index 556ccc8747..4400b9d7ce 100644
--- a/frontend-modern/src/utils/discoveryPresentation.ts
+++ b/frontend-modern/src/utils/discoveryPresentation.ts
@@ -1,8 +1,62 @@
+import type { ResourceDiscovery } from '@/types/discovery';
import {
getInfrastructureSettingsLocationLabel,
getInfrastructureSettingsTarget,
} from '@/utils/infrastructureSettingsPresentation';
+export interface DiscoveryIdentifiedSummary {
+ serviceName: string;
+ serviceType?: string;
+ category?: string;
+ confidence: number;
+ confidencePercent: string;
+ cliAccess?: string;
+ portCount: number;
+ configPathCount: number;
+ dataPathCount: number;
+ logPathCount: number;
+ discoveredAt?: string;
+}
+
+// getDiscoveryIdentifiedSummary returns a compact presentation object for
+// surfaces outside the Discovery sub-tab (e.g. the workload drawer overview)
+// to label a resource with its identified service. Returns null when the
+// stored record has no meaningful identification — the gate mirrors
+// hasValidDiscovery in useDiscoveryTabState so the same record either
+// renders in both surfaces or neither.
+export function getDiscoveryIdentifiedSummary(
+ discovery: ResourceDiscovery | null | undefined,
+): DiscoveryIdentifiedSummary | null {
+ if (!discovery) return null;
+ const serviceName = (discovery.service_name || '').trim();
+ const hasName = serviceName.length > 0 && serviceName.toLowerCase() !== 'unknown';
+ const confidence = typeof discovery.confidence === 'number' ? discovery.confidence : 0;
+ const hasConfidence = confidence > 0;
+ const portCount = Array.isArray(discovery.ports) ? discovery.ports.length : 0;
+ const configPathCount = Array.isArray(discovery.config_paths) ? discovery.config_paths.length : 0;
+ const dataPathCount = Array.isArray(discovery.data_paths) ? discovery.data_paths.length : 0;
+ const logPathCount = Array.isArray(discovery.log_paths) ? discovery.log_paths.length : 0;
+ const hasFacts = Array.isArray(discovery.facts) && discovery.facts.length > 0;
+ const hasCli = typeof discovery.cli_access === 'string' && discovery.cli_access.trim().length > 0;
+ const hasPaths = configPathCount + dataPathCount + logPathCount > 0;
+ if (!hasName && !hasConfidence && portCount === 0 && !hasFacts && !hasPaths && !hasCli) {
+ return null;
+ }
+ return {
+ serviceName: hasName ? serviceName : 'Unidentified service',
+ serviceType: discovery.service_type?.trim() || undefined,
+ category: discovery.category?.trim() || undefined,
+ confidence,
+ confidencePercent: `${Math.round(confidence * 100)}%`,
+ cliAccess: hasCli ? discovery.cli_access?.trim() : undefined,
+ portCount,
+ configPathCount,
+ dataPathCount,
+ logPathCount,
+ discoveredAt: discovery.discovered_at || undefined,
+ };
+}
+
export function getDiscoveryURLSuggestionSourceLabel(code?: string | null): string {
switch ((code || '').trim()) {
case 'service_default_match':