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.

Govern discovery presentation helper

rcourtmanb3bb9f6cfa39
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index f657018f71..a1c2cfe8d1 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -227,7 +227,9 @@ fields only. It represents the freshest included grouped observation, not a
guarantee that every grouped source is healthy, so the UI must not present it
with single-source `Last Seen` wording. When the canonical object is present,
the surface should use its source/name/type attribution instead of showing an
-unqualified aggregate timestamp.
+unqualified aggregate timestamp, and that attribution should stay
+customer-facing rather than exposing raw monitored-system type/source slugs in
+the settings table or included-surface details.
Frontend billing/admin surfaces must not synthesize `plan_version` from
subscription lifecycle state. When a hosted billing record lacks a plan label,
the UI must preserve that absence instead of fabricating values like `active`
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 8163eb03bc..cf352103fd 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -43,6 +43,7 @@ work extends shared components instead of creating new local variants.
21. `frontend-modern/src/components/Settings/DiagnosticsPanel.tsx`
22. `frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx`
23. `frontend-modern/src/utils/diagnosticsPresentation.ts`
+24. `frontend-modern/src/utils/discoveryPresentation.ts`
24. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`
25. `frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx`
26. `frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx`
@@ -924,6 +925,11 @@ owns the public URL, CORS, embedding, and webhook-boundary UI. Shared prop
contracts for that surface must extend
`frontend-modern/src/components/Settings/networkSettingsModel.ts` instead of
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
+`frontend-modern/src/components/Settings/NetworkDiscoverySection.tsx` stays a
+settings section shell instead of re-accumulating that wording inline.
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/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 398dfa3191..52f08ea868 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2098,6 +2098,7 @@
"frontend-modern/src/pages/Operations.tsx",
"frontend-modern/src/utils/aiSettingsPresentation.ts",
"frontend-modern/src/utils/diagnosticsPresentation.ts",
+ "frontend-modern/src/utils/discoveryPresentation.ts",
"frontend-modern/src/utils/reportingPresentation.ts",
"frontend-modern/src/utils/settingsShellPresentation.ts",
"frontend-modern/src/utils/ssoProviderPresentation.ts",
@@ -2240,6 +2241,19 @@
"frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts"
]
},
+ {
+ "id": "discovery-presentation-helper",
+ "label": "discovery presentation helper proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/utils/discoveryPresentation.ts"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts"
+ ]
+ },
{
"id": "diagnostics-presentation-helper",
"label": "diagnostics presentation helper proof",
diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
index 32a5be104d..d32ea9d14b 100644
--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
@@ -22,6 +22,7 @@ import {
getMonitoredSystemLedgerLoadingState,
} from '@/utils/unifiedAgentInventoryPresentation';
import { PulseLogoIcon } from '@/components/icons/PulseLogoIcon';
+import { formatMonitoredSystemSurfaceAttribution } from '@/utils/monitoredSystemPresentation';
import {
SELF_HOSTED_MONITORED_SYSTEM_LEDGER_DESCRIPTION,
} from '@/utils/selfHostedPlans';
@@ -55,37 +56,17 @@ function systemStatusExplanation(system: MonitoredSystemLedgerEntry): MonitoredS
};
}
-function monitoredSystemSourceLabel(source: string | undefined): string {
- switch ((source ?? '').trim().toLowerCase()) {
- case 'agent':
- return 'Agent';
- case 'docker':
- return 'Docker';
- case 'kubernetes':
- return 'Kubernetes';
- case 'pbs':
- return 'PBS';
- case 'pmg':
- return 'PMG';
- case 'proxmox':
- return 'Proxmox';
- case 'truenas':
- return 'TrueNAS';
- default:
- return '';
- }
-}
-
-function latestIncludedSignalLabel(system: MonitoredSystemLedgerEntry): string {
+function latestIncludedSignalSummary(system: MonitoredSystemLedgerEntry): {
+ relative: string;
+ attribution: string;
+} | null {
if (!system.latest_included_signal?.at) {
- return '—';
- }
- const relative = formatRelativeTime(system.latest_included_signal.at, { compact: true });
- const source = monitoredSystemSourceLabel(system.latest_included_signal.source);
- if (source === '') {
- return relative;
+ return null;
}
- return `${relative} via ${source}`;
+ return {
+ relative: formatRelativeTime(system.latest_included_signal.at, { compact: true }),
+ attribution: formatMonitoredSystemSurfaceAttribution(system.latest_included_signal),
+ };
}
export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProps = {}) {
@@ -189,6 +170,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
const expanded = () => expandedSystemKey() === key;
const explanation = systemExplanation(system);
const statusExplanation = systemStatusExplanation(system);
+ const latestSignal = latestIncludedSignalSummary(system);
return (
<TableRow>
<TableCell>
@@ -237,9 +219,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
<ul class="space-y-1 whitespace-normal">
<For each={explanation.surfaces}>
{(surface) => (
- <li>
- {surface.name} ({surface.type}, {surface.source})
- </li>
+ <li>{formatMonitoredSystemSurfaceAttribution(surface)}</li>
)}
</For>
</ul>
@@ -256,9 +236,19 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
</span>
</TableCell>
<TableCell>
- <span class="text-xs text-muted">
- {latestIncludedSignalLabel(system)}
- </span>
+ <Show
+ when={latestSignal}
+ fallback={<span class="text-xs text-muted">—</span>}
+ >
+ {(signal) => (
+ <div class="space-y-0.5">
+ <span class="block text-xs text-muted">{signal().relative}</span>
+ <span class="block text-[11px] text-muted whitespace-normal">
+ {signal().attribution}
+ </span>
+ </div>
+ )}
+ </Show>
</TableCell>
</TableRow>
);
diff --git a/frontend-modern/src/components/Settings/NetworkDiscoverySection.tsx b/frontend-modern/src/components/Settings/NetworkDiscoverySection.tsx
index 4ccb638658..055bf98821 100644
--- a/frontend-modern/src/components/Settings/NetworkDiscoverySection.tsx
+++ b/frontend-modern/src/components/Settings/NetworkDiscoverySection.tsx
@@ -2,10 +2,27 @@ import { Component, For, Show } from 'solid-js';
import { SectionHeader } from '@/components/shared/SectionHeader';
import { Toggle } from '@/components/shared/Toggle';
import type { ToggleChangeEvent } from '@/components/shared/Toggle';
+import {
+ getDiscoverySubnetInvalidFormatMessage,
+ getDiscoverySubnetRequiredMessage,
+} from '@/utils/infrastructureSettingsPresentation';
+import {
+ getNetworkDiscoveryModePresentation,
+ getNetworkDiscoveryPriorityNotice,
+ getNetworkDiscoverySectionPresentation,
+ getNetworkDiscoverySubnetPresentation,
+} from '@/utils/discoveryPresentation';
import { COMMON_DISCOVERY_SUBNETS } from '@/utils/systemSettingsPresentation';
import type { NetworkDiscoverySectionProps } from './networkSettingsModel';
export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> = (props) => {
+ const priorityNotice = getNetworkDiscoveryPriorityNotice();
+ const sectionPresentation = () =>
+ getNetworkDiscoverySectionPresentation(props.discoveryEnabled());
+ const autoModePresentation = getNetworkDiscoveryModePresentation('auto');
+ const customModePresentation = getNetworkDiscoveryModePresentation('custom');
+ const subnetPresentation = () => getNetworkDiscoverySubnetPresentation(props.discoveryMode());
+
return (
<>
<div class="p-4 sm:p-6">
@@ -25,11 +42,9 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
/>
</svg>
<div class="text-sm text-blue-800 dark:text-blue-200">
- <p class="font-medium mb-1">Configuration priority</p>
+ <p class="font-medium mb-1">{priorityNotice.title}</p>
<ul class="space-y-1">
- <li>• Some environment variables still override these settings.</li>
- <li>• Changes made here are written to `system.json` immediately.</li>
- <li>• Settings persist until an environment override replaces them.</li>
+ <For each={priorityNotice.items}>{(item) => <li>• {item}</li>}</For>
</ul>
</div>
</div>
@@ -38,18 +53,16 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
<section class="p-4 sm:p-6 space-y-5">
<SectionHeader
- title="Network discovery"
- description="Control how Pulse scans for Proxmox services on your network."
+ title={sectionPresentation().headerTitle}
+ description={sectionPresentation().headerDescription}
size="sm"
align="left"
/>
<div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
<div class="text-sm text-muted">
- <p class="font-medium text-base-content">Automatic scanning</p>
- <p class="text-xs text-muted">
- Enable discovery to surface Proxmox VE, PBS, and PMG endpoints automatically.
- </p>
+ <p class="font-medium text-base-content">{sectionPresentation().toggleTitle}</p>
+ <p class="text-xs text-muted">{sectionPresentation().toggleDescription}</p>
</div>
<Toggle
checked={props.discoveryEnabled()}
@@ -67,7 +80,7 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
containerClass="gap-2"
label={
<span class="text-xs font-medium text-muted">
- {props.discoveryEnabled() ? 'On' : 'Off'}
+ {sectionPresentation().toggleStateLabel}
</span>
}
/>
@@ -76,7 +89,9 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
<Show when={props.discoveryEnabled()}>
<div class="space-y-4 rounded-md border border-border bg-surface p-3">
<fieldset class="space-y-2">
- <legend class="text-xs font-medium text-base-content">Scan scope</legend>
+ <legend class="text-xs font-medium text-base-content">
+ {sectionPresentation().scanScopeLabel}
+ </legend>
<div class="space-y-2">
<label
class={`flex items-start gap-3 rounded-md border p-2 transition-colors ${
@@ -99,12 +114,8 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
class="mt-1 h-5 w-5 sm:h-4 sm:w-4 border-slate-300 text-blue-600 focus:ring-blue-500"
/>
<div class="space-y-1">
- <p class="text-sm font-medium text-base-content">Auto (slower, full scan)</p>
- <p class="text-xs text-muted">
- Scans all network interfaces on this host, including container bridges, local
- subnets, and gateways. On large or shared networks, consider using a custom
- subnet instead.
- </p>
+ <p class="text-sm font-medium text-base-content">{autoModePresentation.label}</p>
+ <p class="text-xs text-muted">{autoModePresentation.description}</p>
</div>
</label>
@@ -129,18 +140,17 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
class="mt-1 h-5 w-5 sm:h-4 sm:w-4 border-slate-300 text-blue-600 focus:ring-blue-500"
/>
<div class="space-y-1">
- <p class="text-sm font-medium text-base-content">Custom subnet (faster)</p>
- <p class="text-xs text-muted">
- Limit discovery to one or more CIDR ranges to finish faster on large
- networks.
+ <p class="text-sm font-medium text-base-content">
+ {customModePresentation.label}
</p>
+ <p class="text-xs text-muted">{customModePresentation.description}</p>
</div>
</label>
<Show when={props.discoveryMode() === 'custom'}>
<div class="flex flex-wrap items-center gap-2 pl-9 pr-2">
<span class="text-[0.68rem] uppercase tracking-wide text-muted">
- Common networks:
+ {sectionPresentation().commonNetworksLabel}:
</span>
<For each={COMMON_DISCOVERY_SUBNETS}>
{(preset) => {
@@ -165,9 +175,7 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
if (selections.length === 0) {
props.setDiscoverySubnetDraft('');
props.setLastCustomSubnet('');
- props.setDiscoverySubnetError(
- 'Enter at least one subnet in CIDR format (e.g., 192.168.1.0/24)',
- );
+ props.setDiscoverySubnetError(getDiscoverySubnetRequiredMessage());
return;
}
@@ -199,11 +207,11 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
<div class="space-y-2">
<div class="flex items-center justify-between gap-2">
<label for="discoverySubnetInput" class="text-xs font-medium text-base-content">
- Discovery subnet
+ {subnetPresentation().label}
</label>
<span
class="text-slate-400 hover:text-muted"
- title="Use CIDR notation (comma-separated for multiple), e.g. 192.168.1.0/24, 10.0.0.0/24. Smaller ranges keep scans quick."
+ title={subnetPresentation().helpTooltip}
>
<svg
class="h-5 w-5 sm:h-4 sm:w-4"
@@ -223,11 +231,7 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
ref={props.discoverySubnetInputRef}
type="text"
value={props.discoverySubnetDraft()}
- placeholder={
- props.discoveryMode() === 'auto'
- ? 'auto (scan every network phase)'
- : '192.168.1.0/24, 10.0.0.0/24'
- }
+ placeholder={subnetPresentation().placeholder}
class={`w-full min-h-10 sm:min-h-10 rounded-md border px-3 py-2.5 text-sm transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 ${
props.envOverrides().discoverySubnet
? 'border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-600 dark:bg-amber-900 dark:text-amber-200 cursor-not-allowed opacity-60'
@@ -250,9 +254,7 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
return;
}
if (!props.isValidCIDR(trimmed)) {
- props.setDiscoverySubnetError(
- 'Use CIDR format such as 192.168.1.0/24 (comma-separated for multiple)',
- );
+ props.setDiscoverySubnetError(getDiscoverySubnetInvalidFormatMessage());
} else {
props.setDiscoverySubnetError(undefined);
}
@@ -265,15 +267,11 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
props.setDiscoverySubnetDraft(rawValue);
const trimmed = rawValue.trim();
if (!trimmed) {
- props.setDiscoverySubnetError(
- 'Enter at least one subnet in CIDR format (e.g., 192.168.1.0/24)',
- );
+ props.setDiscoverySubnetError(getDiscoverySubnetRequiredMessage());
return;
}
if (!props.isValidCIDR(trimmed)) {
- props.setDiscoverySubnetError(
- 'Use CIDR format such as 192.168.1.0/24 (comma-separated for multiple)',
- );
+ props.setDiscoverySubnetError(getDiscoverySubnetInvalidFormatMessage());
return;
}
props.setDiscoverySubnetError(undefined);
@@ -290,16 +288,10 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
<p class="text-xs text-red-600 dark:text-red-400">{props.discoverySubnetError()}</p>
</Show>
<Show when={!props.discoverySubnetError() && props.discoveryMode() === 'auto'}>
- <p class="text-xs text-muted">
- Auto scans all host network interfaces, which may include corporate or shared
- networks. Switch to a custom subnet for faster, more targeted scans.
- </p>
+ <p class="text-xs text-muted">{subnetPresentation().guidance}</p>
</Show>
<Show when={!props.discoverySubnetError() && props.discoveryMode() === 'custom'}>
- <p class="text-xs text-muted">
- Example: 192.168.1.0/24, 10.0.0.0/24 (comma-separated). Smaller ranges finish
- faster and avoid timeouts.
- </p>
+ <p class="text-xs text-muted">{subnetPresentation().guidance}</p>
</Show>
</div>
</div>
@@ -307,8 +299,7 @@ export const NetworkDiscoverySection: Component<NetworkDiscoverySectionProps> =
<Show when={props.envOverrides().discoveryEnabled || props.envOverrides().discoverySubnet}>
<div class="rounded-md border border-amber-200 bg-amber-100 p-3 text-xs text-amber-800 dark:border-amber-700 dark:bg-amber-900 dark:text-amber-200">
- Discovery settings are locked by environment variables. Update the service
- configuration and restart Pulse to change them here.
+ {sectionPresentation().environmentOverrideMessage}
</div>
</Show>
</section>
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index b267032337..7fcb21cc08 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -232,7 +232,8 @@ describe('MonitoredSystemLedgerPanel', () => {
expect(screen.getByText('Monitored System Ledger')).toBeInTheDocument();
expect(screen.getByText('Latest Included Signal')).toBeInTheDocument();
- expect(screen.getByText('2026-01-02T00:00:00Z via PBS')).toBeInTheDocument();
+ expect(screen.getByText('2026-01-02T00:00:00Z')).toBeInTheDocument();
+ expect(screen.getByText('server-b (PBS Server via PBS)')).toBeInTheDocument();
expect(
screen.getByText(
'Review the monitored systems currently counted against your Pulse Pro plan limit.',
@@ -269,7 +270,7 @@ describe('MonitoredSystemLedgerPanel', () => {
),
).toBeInTheDocument();
expect(screen.getByText('Included collection paths')).toBeInTheDocument();
- expect(screen.getByText('server-b host (host, agent)')).toBeInTheDocument();
+ expect(screen.getByText('server-b host (Host via Agent)')).toBeInTheDocument();
expect(
screen.queryByText('Monitored system usage is temporarily unavailable.'),
).not.toBeInTheDocument();
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 4355b28f8a..41b19089b8 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -568,8 +568,16 @@ describe('Settings architecture guardrails', () => {
expect(networkSettingsPanelSource).not.toContain('Dashboard URL for Notifications');
expect(networkSettingsPanelSource).not.toContain('Allowed Private IP Ranges for Webhooks');
expect(networkDiscoverySectionSource).toContain('COMMON_DISCOVERY_SUBNETS');
- expect(networkDiscoverySectionSource).toContain('title="Network discovery"');
- expect(networkDiscoverySectionSource).toContain('Configuration priority');
+ expect(networkDiscoverySectionSource).toContain('@/utils/discoveryPresentation');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoveryPriorityNotice');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoverySectionPresentation');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoveryModePresentation');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoverySubnetPresentation');
+ expect(networkDiscoverySectionSource).not.toContain('Configuration priority');
+ expect(networkDiscoverySectionSource).not.toContain('Automatic scanning');
+ expect(networkDiscoverySectionSource).not.toContain(
+ 'Discovery settings are locked by environment variables.',
+ );
expect(networkBoundarySettingsSectionSource).toContain('Dashboard URL for Notifications');
expect(networkBoundarySettingsSectionSource).toContain(
'Allowed Private IP Ranges for Webhooks',
diff --git a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
index b719e8c80e..90806d8564 100644
--- a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts
@@ -2,7 +2,11 @@ import { describe, expect, it } from 'vitest';
import {
getDiscoveryInitialEmptyState,
getDiscoveryLoadingState,
+ getNetworkDiscoveryModePresentation,
getDiscoveryNotesEmptyState,
+ getNetworkDiscoveryPriorityNotice,
+ getNetworkDiscoverySectionPresentation,
+ getNetworkDiscoverySubnetPresentation,
getDiscoveryAnalysisProviderBadgeClass,
getDiscoveryCategoryBadgeClass,
getDiscoverySuggestedURLFallback,
@@ -40,21 +44,73 @@ describe('discoveryPresentation', () => {
it('returns canonical discovery empty-state copy', () => {
expect(getDiscoveryInitialEmptyState(true)).toEqual({
title: 'Checking existing discovery data...',
- description: 'You can run discovery now if this takes too long.',
+ description: 'You can run a discovery scan if this takes too long.',
});
expect(getDiscoveryInitialEmptyState(false)).toEqual({
title: 'No discovery data yet',
- description: 'Run a discovery scan to identify services and configurations',
+ description: 'Run a discovery scan to identify services and configuration details.',
});
expect(getDiscoverySuggestedURLFallback('diag')).toEqual({
- title: 'No suggested URL found',
+ title: 'No suggested URL available',
description: 'diag',
});
expect(getDiscoveryLoadingState()).toEqual({
- text: 'Loading discovery...',
+ text: 'Loading discovery data...',
});
expect(getDiscoveryNotesEmptyState()).toEqual({
- text: 'No notes yet. Add notes to document important information.',
+ text: 'No discovery notes yet. Add notes to capture important context.',
+ });
+ });
+
+ it('returns canonical network discovery settings copy', () => {
+ expect(getNetworkDiscoveryPriorityNotice()).toEqual({
+ title: 'Configuration precedence',
+ items: [
+ 'Environment variables still override these settings.',
+ 'Changes made here are saved to system.json immediately.',
+ 'These settings remain in effect until an environment override replaces them.',
+ ],
+ });
+
+ expect(getNetworkDiscoverySectionPresentation(true)).toEqual({
+ headerTitle: 'Network discovery',
+ headerDescription: 'Control how Pulse scans your network for Proxmox services.',
+ toggleTitle: 'Automatic scanning',
+ toggleDescription:
+ 'Enable discovery to surface Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway endpoints automatically.',
+ toggleStateLabel: 'Enabled',
+ scanScopeLabel: 'Scan scope',
+ commonNetworksLabel: 'Common networks',
+ environmentOverrideMessage:
+ 'Discovery settings are locked by environment variables. Update the service configuration and restart Pulse to change them here.',
+ });
+
+ expect(getNetworkDiscoveryModePresentation('auto')).toEqual({
+ label: 'Automatic scan (full network scope)',
+ description:
+ 'Scan every network interface on this host, including container bridges, local subnets, and gateways. Use custom subnets on large or shared networks to reduce scan time.',
+ });
+ expect(getNetworkDiscoveryModePresentation('custom')).toEqual({
+ label: 'Custom subnets (targeted)',
+ description:
+ 'Limit discovery to one or more CIDR ranges for faster, more targeted scans on large networks.',
+ });
+
+ expect(getNetworkDiscoverySubnetPresentation('auto')).toEqual({
+ label: 'Discovery subnets',
+ helpTooltip:
+ 'Use CIDR notation, for example 192.168.1.0/24 or 10.0.0.0/24. Smaller ranges finish more quickly.',
+ placeholder: 'automatic (scan every detected network)',
+ guidance:
+ 'Automatic mode scans all host network interfaces, which can include shared or corporate networks. Switch to custom subnets for a faster, more targeted scan.',
+ });
+ expect(getNetworkDiscoverySubnetPresentation('custom')).toEqual({
+ label: 'Discovery subnets',
+ helpTooltip:
+ 'Use CIDR notation, for example 192.168.1.0/24 or 10.0.0.0/24. Smaller ranges finish more quickly.',
+ placeholder: '192.168.1.0/24, 10.0.0.0/24',
+ guidance:
+ 'Example: 192.168.1.0/24, 10.0.0.0/24. Smaller ranges finish faster and reduce timeout risk.',
});
});
});
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 9027671d6f..0575ea41f9 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -3262,12 +3262,12 @@ describe('frontend resource type boundaries', () => {
expect(guestDrawerSource).not.toContain('Loading discovery...');
expect(infrastructureDetailsDrawerSource).not.toContain('Loading discovery...');
expect(resourceDetailDrawerSource).not.toContain('Loading discovery...');
- expect(discoveryTabSource).not.toContain('No suggested URL found');
+ expect(discoveryTabSource).not.toContain('No suggested URL available');
expect(discoveryTabSource).not.toContain(
- 'No notes yet. Add notes to document important information.',
+ 'No discovery notes yet. Add notes to capture important context.',
);
expect(webInterfaceUrlFieldSource).toContain('useWebInterfaceUrlFieldState');
- expect(webInterfaceUrlFieldSource).not.toContain('No suggested URL found');
+ expect(webInterfaceUrlFieldSource).not.toContain('No suggested URL available');
expect(webInterfaceUrlFieldSource).not.toContain('GuestMetadataAPI.getMetadata');
expect(webInterfaceUrlFieldStateSource).toContain('GuestMetadataAPI.getMetadata');
expect(webInterfaceUrlFieldStateSource).toContain('AgentMetadataAPI.updateMetadata');
@@ -3282,6 +3282,29 @@ describe('frontend resource type boundaries', () => {
'export function getDiscoverySuggestedURLFallback',
);
expect(discoveryPresentationSource).toContain('export function getDiscoveryNotesEmptyState');
+ expect(discoveryPresentationSource).toContain(
+ 'export function getNetworkDiscoveryPriorityNotice',
+ );
+ expect(discoveryPresentationSource).toContain(
+ 'export function getNetworkDiscoverySectionPresentation',
+ );
+ expect(discoveryPresentationSource).toContain(
+ 'export function getNetworkDiscoveryModePresentation',
+ );
+ expect(discoveryPresentationSource).toContain(
+ 'export function getNetworkDiscoverySubnetPresentation',
+ );
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoveryPriorityNotice');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoverySectionPresentation');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoveryModePresentation');
+ expect(networkDiscoverySectionSource).toContain('getNetworkDiscoverySubnetPresentation');
+ expect(networkDiscoverySectionSource).toContain('getDiscoverySubnetRequiredMessage');
+ expect(networkDiscoverySectionSource).toContain('getDiscoverySubnetInvalidFormatMessage');
+ expect(networkDiscoverySectionSource).not.toContain('Configuration priority');
+ expect(networkDiscoverySectionSource).not.toContain('Automatic scanning');
+ expect(networkDiscoverySectionSource).not.toContain(
+ 'Discovery settings are locked by environment variables.',
+ );
expect(mailGatewaySource).toContain('getPMGThreatPresentation');
expect(mailGatewaySource).not.toContain('const barColor =');
expect(mailGatewaySource).not.toContain('const textColor =');
diff --git a/frontend-modern/src/utils/discoveryPresentation.ts b/frontend-modern/src/utils/discoveryPresentation.ts
index 3cfe8cf228..02fbef9796 100644
--- a/frontend-modern/src/utils/discoveryPresentation.ts
+++ b/frontend-modern/src/utils/discoveryPresentation.ts
@@ -35,29 +35,87 @@ export function getDiscoveryInitialEmptyState(loading: boolean) {
return loading
? {
title: 'Checking existing discovery data...',
- description: 'You can run discovery now if this takes too long.',
+ description: 'You can run a discovery scan if this takes too long.',
}
: {
title: 'No discovery data yet',
- description: 'Run a discovery scan to identify services and configurations',
+ description: 'Run a discovery scan to identify services and configuration details.',
};
}
export function getDiscoveryLoadingState() {
return {
- text: 'Loading discovery...',
+ text: 'Loading discovery data...',
} as const;
}
export function getDiscoverySuggestedURLFallback(diagnostic?: string | null) {
return {
- title: 'No suggested URL found',
+ title: 'No suggested URL available',
description: diagnostic || '',
} as const;
}
export function getDiscoveryNotesEmptyState() {
return {
- text: 'No notes yet. Add notes to document important information.',
+ text: 'No discovery notes yet. Add notes to capture important context.',
+ } as const;
+}
+
+export function getNetworkDiscoveryPriorityNotice() {
+ return {
+ title: 'Configuration precedence',
+ items: [
+ 'Environment variables still override these settings.',
+ 'Changes made here are saved to system.json immediately.',
+ 'These settings remain in effect until an environment override replaces them.',
+ ],
+ } as const;
+}
+
+export function getNetworkDiscoverySectionPresentation(discoveryEnabled: boolean) {
+ return {
+ headerTitle: 'Network discovery',
+ headerDescription: 'Control how Pulse scans your network for Proxmox services.',
+ toggleTitle: 'Automatic scanning',
+ toggleDescription:
+ 'Enable discovery to surface Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway endpoints automatically.',
+ toggleStateLabel: discoveryEnabled ? 'Enabled' : 'Disabled',
+ scanScopeLabel: 'Scan scope',
+ commonNetworksLabel: 'Common networks',
+ environmentOverrideMessage:
+ 'Discovery settings are locked by environment variables. Update the service configuration and restart Pulse to change them here.',
+ } as const;
+}
+
+export function getNetworkDiscoveryModePresentation(mode: 'auto' | 'custom') {
+ if (mode === 'auto') {
+ return {
+ label: 'Automatic scan (full network scope)',
+ description:
+ 'Scan every network interface on this host, including container bridges, local subnets, and gateways. Use custom subnets on large or shared networks to reduce scan time.',
+ } as const;
+ }
+
+ return {
+ label: 'Custom subnets (targeted)',
+ description:
+ 'Limit discovery to one or more CIDR ranges for faster, more targeted scans on large networks.',
+ } as const;
+}
+
+export function getNetworkDiscoverySubnetPresentation(mode: 'auto' | 'custom') {
+ return {
+ label: 'Discovery subnets',
+ helpTooltip:
+ 'Use CIDR notation, for example 192.168.1.0/24 or 10.0.0.0/24. Smaller ranges finish more quickly.',
+ placeholder:
+ mode === 'auto'
+ ? 'automatic (scan every detected network)'
+ : '192.168.1.0/24, 10.0.0.0/24',
+ guidance:
+ mode === 'auto'
+ ? 'Automatic mode scans all host network interfaces, which can include shared or corporate networks. Switch to custom subnets for a faster, more targeted scan.'
+ : 'Example: 192.168.1.0/24, 10.0.0.0/24. Smaller ranges finish faster and reduce timeout risk.',
} as const;
}
diff --git a/frontend-modern/src/utils/monitoredSystemPresentation.ts b/frontend-modern/src/utils/monitoredSystemPresentation.ts
new file mode 100644
index 0000000000..6ad940849e
--- /dev/null
+++ b/frontend-modern/src/utils/monitoredSystemPresentation.ts
@@ -0,0 +1,70 @@
+const normalizeMonitoredSystemValue = (value: string | undefined): string =>
+ value?.trim().toLowerCase() ?? '';
+
+const titleCaseWords = (value: string): string =>
+ value
+ .split(/\s+/)
+ .filter((part) => part.length > 0)
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
+ .join(' ');
+
+export function getMonitoredSystemSourceLabel(source: string | undefined): string {
+ switch (normalizeMonitoredSystemValue(source)) {
+ case 'agent':
+ return 'Agent';
+ case 'docker':
+ return 'Docker';
+ case 'kubernetes':
+ return 'Kubernetes';
+ case 'pbs':
+ return 'PBS';
+ case 'pmg':
+ return 'PMG';
+ case 'proxmox':
+ return 'Proxmox';
+ case 'truenas':
+ return 'TrueNAS';
+ case '':
+ case 'unknown':
+ return '';
+ default:
+ return source?.trim() ?? '';
+ }
+}
+
+export function getMonitoredSystemSurfaceTypeLabel(type: string | undefined): string {
+ switch (normalizeMonitoredSystemValue(type)) {
+ case 'docker-host':
+ return 'Docker Host';
+ case 'host':
+ return 'Host';
+ case 'kubernetes-cluster':
+ return 'Kubernetes Cluster';
+ case 'pbs-server':
+ return 'PBS Server';
+ case 'pmg-server':
+ return 'PMG Server';
+ case 'proxmox-node':
+ return 'Proxmox Node';
+ case 'truenas-system':
+ return 'TrueNAS System';
+ case '':
+ return 'System';
+ default:
+ return titleCaseWords((type ?? '').trim().replace(/[-_]+/g, ' '));
+ }
+}
+
+export function formatMonitoredSystemSurfaceAttribution(surface: {
+ name: string;
+ type?: string;
+ source?: string;
+}): string {
+ const name = surface.name?.trim() || 'Unnamed source';
+ const typeLabel = getMonitoredSystemSurfaceTypeLabel(surface.type);
+ const sourceLabel = getMonitoredSystemSourceLabel(surface.source);
+ if (sourceLabel === '' || sourceLabel.toLowerCase() === typeLabel.toLowerCase()) {
+ return `${name} (${typeLabel})`;
+ }
+ return `${name} (${typeLabel} via ${sourceLabel})`;
+}