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.

Align discovery guidance labels

rcourtmaneac12e12edb6
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index ebc8b7297d..3f46f6ed77 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -876,6 +876,12 @@ work extends shared components instead of creating new local variants.
## Current State
+`frontend-modern/src/utils/discoveryPresentation.ts` owns resource discovery
+command guidance targets. Discovery surfaces that need to tell operators where
+to enable command execution or verify `agent:exec` scope must use that helper's
+canonical `Settings → Infrastructure` and `Settings → API Access` handoffs
+instead of hard-coding legacy settings labels or old route paths.
+
`SettingsTab` no longer includes `infrastructure-connections` or
`infrastructure-install`. The single `infrastructure-systems` entry in
`settingsNavCatalog.ts`, `settingsPanelRegistry.ts`, and
@@ -2496,9 +2502,16 @@ network-boundary surface must extend
re-expanding the shell or reintroducing page-local section types.
`frontend-modern/src/utils/discoveryPresentation.ts` now owns the
customer-facing discovery-section framing copy, scan-scope labels, subnet
-guidance, and environment-lock messaging so
+guidance, command-execution settings targets, API Access handoff labels, and
+environment-lock messaging so
`frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx` stays a
shared presentation shell instead of re-accumulating that wording inline.
+Resource discovery command guidance must use that same presentation owner for
+settings handoffs. `frontend-modern/src/utils/discoveryPresentation.ts` owns
+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 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 48042872d0..36f39f4dee 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -928,6 +928,11 @@ Governance metadata such as sensitivity and routing scope may be visible in
the table, but it must remain on the same bounded row-windowing and mounted-row
budget proved by `UnifiedResourceTable.performance.contract.test.tsx` rather
than creating a separate unbounded rendering path for policy-rich fleets.
+Infrastructure cluster-header presentation must stay inside that same bounded
+row model. `unifiedResourceTableStateModel.ts` owns whether the compact
+`Cluster` chip is rendered, including suppressing it when the visible group
+name already ends in `Cluster`, so label cleanup does not add a second
+row-rendering path or per-page DOM workaround.
The shared table and detail drawer now also render governed resource labels
through the shared identity/display contract, which routes policy-aware
resources through the canonical policy-aware helper and suppresses the raw
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 06b0dcf01e..3a458a946e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -143,6 +143,11 @@ cross-source deduplication.
accessible group label, while Proxmox, Kubernetes, and other platform
clusters stay reserved for actual resource identity, filters, and detail
surfaces.
+ Cluster group headers may use a compact `Cluster` type chip when the group
+ name itself is only an estate label, but `unifiedResourceTableStateModel.ts`
+ must suppress that chip when the visible group name already ends in
+ `Cluster`, so rows do not read as duplicated labels such as `Production
+ Cluster Cluster`.
Infrastructure host and service table cards must consume the
frontend-primitives-owned `TableCard` frame and `TableCardHeader` header
band; unified resources owns the resource identity, rows, grouping, and
@@ -1164,6 +1169,10 @@ That access-side analysis surface still follows the same shell/runtime split as
the rest of the drawer: `DiscoveryTab.tsx` owns presentation and disclosures,
while `useDiscoveryTabState.ts` owns API fetches, websocket progress, and
note/discovery mutations.
+Command-availability guidance inside that analysis surface must consume the
+shared `frontend-modern/src/utils/discoveryPresentation.ts` settings targets
+and scan-error copy instead of hard-coding legacy settings labels such as
+Unified Agents, API Tokens, or `/settings/integrations/api`.
The overview keeps access, investigation detail, service detail, and host
detail as collapsed sibling disclosures under the primary card pair, so the
drawer keeps
diff --git a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
index c713453215..5307ae63ea 100644
--- a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
+++ b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx
@@ -9,8 +9,10 @@ import {
getDiscoveryInitialEmptyState,
getDiscoveryLoadingState,
getDiscoveryNotesEmptyState,
+ getDiscoveryApiAccessSettingsTarget,
getDiscoveryAnalysisProviderBadgeClass,
getDiscoveryCategoryBadgeClass,
+ getDiscoveryCommandSettingsTarget,
getDiscoverySuggestedURLFallback,
getDiscoveryURLSuggestionSourceLabel,
} from '@/utils/discoveryPresentation';
@@ -93,6 +95,8 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
}
return getConfidenceLevel(current.confidence);
});
+ const commandSettingsTarget = getDiscoveryCommandSettingsTarget();
+ const apiAccessSettingsTarget = getDiscoveryApiAccessSettingsTarget();
return (
<div class="space-y-4">
@@ -412,9 +416,9 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
Commands not enabled
</p>
<p class="text-amber-700 dark:text-amber-300 mt-0.5">
- Discovery requires command execution. Enable "Pulse Commands" in{' '}
- <a href="/settings" class="underline hover:no-underline">
- Settings → Unified Agents
+ Discovery requires command execution. Enable Pulse commands from{' '}
+ <a href={commandSettingsTarget.href} class="underline hover:no-underline">
+ {commandSettingsTarget.label}
</a>
.
</p>
@@ -449,8 +453,8 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {
agent:exec
</code>{' '}
scope in{' '}
- <a href="/settings/integrations/api" class="underline hover:no-underline">
- Settings → API Tokens
+ <a href={apiAccessSettingsTarget.href} class="underline hover:no-underline">
+ {apiAccessSettingsTarget.label}
</a>
.
</p>
diff --git a/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx b/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx
index 8c4ed33bc4..fb200d5d2a 100644
--- a/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx
+++ b/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx
@@ -32,6 +32,48 @@ describe('DiscoveryTab', () => {
expect(await screen.findByRole('button', { name: 'Run Discovery Now' })).toBeInTheDocument();
});
+ it('uses canonical settings copy for disabled command guidance', async () => {
+ vi.mocked(discoveryApi.getDiscovery).mockResolvedValue(null);
+
+ render(() => (
+ <DiscoveryTab
+ resourceType="agent"
+ agentId="agent-1"
+ resourceId="agent-1"
+ hostname="pve1"
+ commandsEnabled={false}
+ />
+ ));
+
+ expect(await screen.findByText('Commands not enabled')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Settings → Infrastructure' })).toHaveAttribute(
+ 'href',
+ '/settings/infrastructure',
+ );
+ expect(screen.queryByText('Settings → Unified Agents')).not.toBeInTheDocument();
+ });
+
+ it('uses canonical API Access copy for missing command connection guidance', async () => {
+ vi.mocked(discoveryApi.getDiscovery).mockResolvedValue(null);
+
+ render(() => (
+ <DiscoveryTab
+ resourceType="agent"
+ agentId="agent-1"
+ resourceId="agent-1"
+ hostname="pve1"
+ commandsEnabled={true}
+ />
+ ));
+
+ expect(await screen.findByText('Agent not connected for commands')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Settings → API Access' })).toHaveAttribute(
+ 'href',
+ '/settings/security/api',
+ );
+ expect(screen.queryByText('Settings → API Tokens')).not.toBeInTheDocument();
+ });
+
it('renders task-first analysis copy for provider and reasoning context', async () => {
vi.mocked(discoveryApi.getDiscoveryInfo).mockResolvedValue({
ai_provider: {
diff --git a/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts b/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts
index d550f2cc09..ed306393b1 100644
--- a/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts
+++ b/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts
@@ -9,6 +9,7 @@ import {
} from '@/api/discovery';
import { eventBus } from '@/stores/events';
import type { DiscoveryProgress, ResourceType } from '@/types/discovery';
+import { getDiscoveryNoConnectedAgentMessage } from '@/utils/discoveryPresentation';
import { toDiscoveryAPIResourceType } from '@/utils/discoveryTarget';
export interface DiscoveryTabStateProps {
@@ -162,19 +163,7 @@ export function useDiscoveryTabState(props: DiscoveryTabStateProps) {
const message = err instanceof Error ? err.message : 'Discovery scan failed';
if (message.includes('no connected agent')) {
- if (props.commandsEnabled === false) {
- setScanError(
- 'Commands not enabled. Enable "Pulse Commands" in Settings → Unified Agents for this agent.',
- );
- } else if (props.commandsEnabled === true) {
- setScanError(
- 'Agent not connected for command execution. The API token may be missing the "agent:exec" scope. Check Settings → API Tokens.',
- );
- } else {
- setScanError(
- 'No agent available for command execution. Ensure "Pulse Commands" is enabled in Settings → Unified Agents and the API token has "agent:exec" scope.',
- );
- }
+ setScanError(getDiscoveryNoConnectedAgentMessage(props.commandsEnabled));
} else {
setScanError(message);
}
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
index 3877cf9c57..6c5de4d428 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
@@ -48,6 +48,7 @@ import {
type UnifiedResourceTableProps,
type UnifiedResourceTableState,
} from './useUnifiedResourceTableState';
+import { shouldShowClusterGroupTypeLabel } from './unifiedResourceTableStateModel';
import { getOutlierEmphasis, isResourceOnline } from './unifiedResourceTableModel';
import { getCpuPercent, getDiskPercent, getMemoryPercent } from '@/types/resource';
@@ -200,9 +201,11 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
fallback={<span class="text-muted">Standalone</span>}
>
<span>{group.cluster}</span>
- <span class="inline-flex items-center rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300">
- Cluster
- </span>
+ <Show when={shouldShowClusterGroupTypeLabel(group.cluster)}>
+ <span class="inline-flex items-center rounded px-2 py-0.5 text-[10px] font-medium whitespace-nowrap bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300">
+ Cluster
+ </span>
+ </Show>
</Show>
<span class="text-[10px] text-muted font-normal">
{group.resources.length}{' '}
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
index 42a367321f..65ccccb096 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/unifiedResourceTableStateModel.test.ts
@@ -19,6 +19,7 @@ import {
isUnifiedResourceServiceColumnVisible,
isUnifiedResourceTableColumnVisible,
normalizeUnifiedResourceTableLayoutWidth,
+ shouldShowClusterGroupTypeLabel,
shouldShowUnifiedResourceHostTable,
shouldUseUnifiedResourceTableMobileLayout,
} from '@/components/Infrastructure/unifiedResourceTableStateModel';
@@ -65,6 +66,13 @@ describe('unifiedResourceTableStateModel', () => {
expect(buildHostTableItems(groups, 'flat').map((item) => item.type)).toEqual(['row', 'row']);
});
+ it('suppresses duplicate cluster type labels when the group name already ends with cluster', () => {
+ expect(shouldShowClusterGroupTypeLabel('Core Fabric')).toBe(true);
+ expect(shouldShowClusterGroupTypeLabel('Production Cluster')).toBe(false);
+ expect(shouldShowClusterGroupTypeLabel('production cluster')).toBe(false);
+ expect(shouldShowClusterGroupTypeLabel('')).toBe(false);
+ });
+
it('tracks reveal indexes only for row items', () => {
const items = buildHostTableItems(
[{ cluster: 'cluster-a', resources: [makeResource('a'), makeResource('b')] }],
diff --git a/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts b/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
index f0d65eff22..8ec1918b8e 100644
--- a/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
+++ b/frontend-modern/src/components/Infrastructure/unifiedResourceTableStateModel.ts
@@ -160,6 +160,13 @@ export const getVisibleHostTableItems = (
return items.slice(startIndex, endIndex);
};
+export const shouldShowClusterGroupTypeLabel = (
+ clusterLabel: string | null | undefined,
+): boolean => {
+ const normalized = (clusterLabel ?? '').trim().replace(/\s+/g, ' ').toLowerCase();
+ return Boolean(normalized) && !/\bcluster$/.test(normalized);
+};
+
export const getHostSpacerHeights = (
totalCount: number,
startIndex: number,
diff --git a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
index 12eae34cea..22c818cb90 100644
--- a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
@@ -1,7 +1,10 @@
import { describe, expect, it } from 'vitest';
import {
+ getDiscoveryApiAccessSettingsTarget,
+ getDiscoveryCommandSettingsTarget,
getDiscoveryInitialEmptyState,
getDiscoveryLoadingState,
+ getDiscoveryNoConnectedAgentMessage,
getNetworkDiscoveryModePresentation,
getDiscoveryNotesEmptyState,
getNetworkDiscoveryPriorityNotice,
@@ -62,6 +65,26 @@ describe('discoveryPresentation', () => {
});
});
+ it('returns canonical discovery command guidance targets and errors', () => {
+ expect(getDiscoveryCommandSettingsTarget()).toEqual({
+ href: '/settings/infrastructure',
+ label: 'Settings → Infrastructure',
+ });
+ expect(getDiscoveryApiAccessSettingsTarget()).toEqual({
+ href: '/settings/security/api',
+ label: 'Settings → API Access',
+ });
+ expect(getDiscoveryNoConnectedAgentMessage(false)).toBe(
+ 'Commands not enabled. Enable Pulse commands from Settings → Infrastructure for this agent.',
+ );
+ expect(getDiscoveryNoConnectedAgentMessage(true)).toBe(
+ 'Agent not connected for command execution. The API token may be missing the "agent:exec" scope. Check Settings → API Access.',
+ );
+ expect(getDiscoveryNoConnectedAgentMessage()).toBe(
+ 'No agent available for command execution. Enable Pulse commands from Settings → Infrastructure and make sure the API token has "agent:exec" scope in Settings → API Access.',
+ );
+ });
+
it('returns canonical network discovery settings copy', () => {
expect(getNetworkDiscoveryPriorityNotice()).toEqual({
title: 'Network scan safety',
diff --git a/frontend-modern/src/utils/discoveryPresentation.ts b/frontend-modern/src/utils/discoveryPresentation.ts
index fc311b3f5b..589de71c3e 100644
--- a/frontend-modern/src/utils/discoveryPresentation.ts
+++ b/frontend-modern/src/utils/discoveryPresentation.ts
@@ -62,6 +62,32 @@ export function getDiscoveryNotesEmptyState() {
} as const;
}
+export function getDiscoveryCommandSettingsTarget() {
+ return {
+ href: '/settings/infrastructure',
+ label: 'Settings → Infrastructure',
+ } as const;
+}
+
+export function getDiscoveryApiAccessSettingsTarget() {
+ return {
+ href: '/settings/security/api',
+ label: 'Settings → API Access',
+ } as const;
+}
+
+export function getDiscoveryNoConnectedAgentMessage(commandsEnabled?: boolean): string {
+ if (commandsEnabled === false) {
+ return 'Commands not enabled. Enable Pulse commands from Settings → Infrastructure for this agent.';
+ }
+
+ if (commandsEnabled === true) {
+ return 'Agent not connected for command execution. The API token may be missing the "agent:exec" scope. Check Settings → API Access.';
+ }
+
+ return 'No agent available for command execution. Enable Pulse commands from Settings → Infrastructure and make sure the API token has "agent:exec" scope in Settings → API Access.';
+}
+
export function getNetworkDiscoveryPriorityNotice() {
return {
title: 'Network scan safety',