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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Make discovery scan scope fully selectable
rcourtman82bf3138dc84
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 7db0d65dd7..d9654227bb 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -422,6 +422,11 @@ Its copy must describe only the platform APIs represented by the LAN discoverycandidate model, and it must not imply TrueNAS, VMware, Docker, Kubernetes, oragent command discovery when this source-manager path cannot surface thosecandidates.+The `DiscoverySettingsForm.tsx` scan-scope selector must make automatic versus+custom subnet selection a full-row operator control, not a narrow or hidden+input target; common subnet chips and the custom subnet field must share the+same environment-override and in-flight-save lock semantics as the scan-scope+selector.Reported agent-backed host profiles must be visible at the source-managergrouping level without changing the canonical connection type: an Unraid agentrow stays `agent` internally, but the connected-systems table groups it underdiff --git a/frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx b/frontend-modern/src/components/Settings/DiscoverySettingsForm.tsxindex e619dafd3b..7863f2a3d1 100644--- a/frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx+++ b/frontend-modern/src/components/Settings/DiscoverySettingsForm.tsx@@ -22,6 +22,28 @@ export const DiscoverySettingsForm: Component<DiscoverySettingsFormProps> = (proconst autoModePresentation = getNetworkDiscoveryModePresentation('auto');const customModePresentation = getNetworkDiscoveryModePresentation('custom');const subnetPresentation = () => getNetworkDiscoverySubnetPresentation(props.discoveryMode());+ const scanScopeLocked = () =>+ Boolean(props.envOverrides().discoverySubnet || props.savingDiscoverySettings());+ const scanScopeOptionClass = (mode: 'auto' | 'custom') =>+ `flex w-full items-start gap-3 rounded-md border p-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${+ props.discoveryMode() === mode+ ? 'border-blue-200 bg-blue-50 dark:border-blue-700 dark:bg-blue-900'+ : scanScopeLocked()+ ? 'border-transparent'+ : 'border-transparent hover:border-border'+ }`;+ const scanScopeIndicatorClass = (mode: 'auto' | 'custom') =>+ `mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border transition-colors sm:h-4 sm:w-4 ${+ props.discoveryMode() === mode+ ? 'border-blue-600 bg-blue-600 dark:border-blue-400 dark:bg-blue-500'+ : 'border-slate-300 bg-surface'+ }`;+ const selectDiscoveryMode = (mode: 'auto' | 'custom') => {+ if (scanScopeLocked() || props.discoveryMode() === mode) {+ return;+ }+ void props.handleDiscoveryModeChange(mode);+ };return (<div class="space-y-5">@@ -90,66 +112,52 @@ export const DiscoverySettingsForm: Component<DiscoverySettingsFormProps> = (pro<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 ${- props.discoveryMode() === 'auto'- ? 'border-blue-200 bg-blue-50 dark:border-blue-700 dark:bg-blue-900'- : 'border-transparent hover:border-border'- }`}+ <div+ class="space-y-2"+ role="radiogroup"+ aria-label={sectionPresentation().scanScopeLabel}+ >+ <button+ type="button"+ role="radio"+ aria-checked={props.discoveryMode() === 'auto'}+ disabled={scanScopeLocked()}+ onClick={() => selectDiscoveryMode('auto')}+ class={scanScopeOptionClass('auto')}>- <input- type="radio"- name="discoveryMode"- value="auto"- checked={props.discoveryMode() === 'auto'}- onChange={async () => {- if (props.discoveryMode() !== 'auto') {- await props.handleDiscoveryModeChange('auto');- }- }}- disabled={- props.envOverrides().discoverySubnet || props.savingDiscoverySettings()- }- class="mt-1 h-5 w-5 border-slate-300 text-blue-600 focus:ring-blue-500 sm:h-4 sm:w-4"- />+ <span class={scanScopeIndicatorClass('auto')} aria-hidden="true">+ <Show when={props.discoveryMode() === 'auto'}>+ <span class="h-2 w-2 rounded-full bg-white" />+ </Show>+ </span><div class="space-y-1"><p class="text-sm font-medium text-base-content">{autoModePresentation.label}</p><p class="text-xs text-muted">{autoModePresentation.description}</p></div>- </label>+ </button>- <label- class={`flex items-start gap-3 rounded-md border p-2 transition-colors ${- props.discoveryMode() === 'custom'- ? 'border-blue-200 bg-blue-50 dark:border-blue-700 dark:bg-blue-900'- : 'border-transparent hover:border-border'- }`}+ <button+ type="button"+ role="radio"+ aria-checked={props.discoveryMode() === 'custom'}+ disabled={scanScopeLocked()}+ onClick={() => selectDiscoveryMode('custom')}+ class={scanScopeOptionClass('custom')}>- <input- type="radio"- name="discoveryMode"- value="custom"- checked={props.discoveryMode() === 'custom'}- onChange={() => {- if (props.discoveryMode() !== 'custom') {- void props.handleDiscoveryModeChange('custom');- }- }}- disabled={- props.envOverrides().discoverySubnet || props.savingDiscoverySettings()- }- class="mt-1 h-5 w-5 border-slate-300 text-blue-600 focus:ring-blue-500 sm:h-4 sm:w-4"- />+ <span class={scanScopeIndicatorClass('custom')} aria-hidden="true">+ <Show when={props.discoveryMode() === 'custom'}>+ <span class="h-2 w-2 rounded-full bg-white" />+ </Show>+ </span><div class="space-y-1"><p class="text-sm font-medium text-base-content">{customModePresentation.label}</p><p class="text-xs text-muted">{customModePresentation.description}</p></div>- </label>+ </button><Show when={props.discoveryMode() === 'custom'}><div class="flex flex-wrap items-center gap-2 pl-9 pr-2">@@ -170,7 +178,7 @@ export const DiscoverySettingsForm: Component<DiscoverySettingsFormProps> = (pro: 'border-border text-base-content hover:border-blue-400 hover:bg-blue-50 dark:hover:border-blue-500 dark:hover:bg-blue-900'}`}onClick={async () => {- if (props.envOverrides().discoverySubnet) {+ if (scanScopeLocked()) {return;}let selections = [...currentSelections];@@ -194,9 +202,9 @@ export const DiscoverySettingsForm: Component<DiscoverySettingsFormProps> = (proprops.setDiscoverySubnetError(undefined);await props.commitDiscoverySubnet(updatedValue);}}- disabled={props.envOverrides().discoverySubnet}+ disabled={scanScopeLocked()}classList={{- 'cursor-not-allowed opacity-60': props.envOverrides().discoverySubnet,+ 'cursor-not-allowed opacity-60': scanScopeLocked(),}}>{preset}diff --git a/frontend-modern/src/components/Settings/__tests__/DiscoverySettingsForm.test.tsx b/frontend-modern/src/components/Settings/__tests__/DiscoverySettingsForm.test.tsxnew file mode 100644index 0000000000..b944853198--- /dev/null+++ b/frontend-modern/src/components/Settings/__tests__/DiscoverySettingsForm.test.tsx@@ -0,0 +1,105 @@+import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { DiscoverySettingsForm } from '../DiscoverySettingsForm';++const parseSubnetList = (value: string) => {+ const seen = new Set<string>();+ return value+ .split(',')+ .map((token) => token.trim())+ .filter((token) => {+ if (!token || token.toLowerCase() === 'auto' || seen.has(token)) {+ return false;+ }+ seen.add(token);+ return true;+ });+};++const normalizeSubnetList = (value: string) => parseSubnetList(value).join(', ');++function renderDiscoverySettingsForm(options: { initialMode?: 'auto' | 'custom' } = {}) {+ const [discoveryEnabled, setDiscoveryEnabled] = createSignal(true);+ const [discoveryMode, setDiscoveryMode] = createSignal<'auto' | 'custom'>(+ options.initialMode ?? 'auto',+ );+ const [discoverySubnetDraft, setDiscoverySubnetDraft] = createSignal('');+ const [lastCustomSubnet, setLastCustomSubnet] = createSignal('');+ const [discoverySubnetError, setDiscoverySubnetError] = createSignal<string | undefined>();+ const [savingDiscoverySettings] = createSignal(false);+ const [envOverrides] = createSignal<Record<string, boolean>>({});++ const handleDiscoveryModeChange = vi.fn(async (mode: 'auto' | 'custom') => {+ setDiscoveryMode(mode);+ if (mode === 'auto') {+ setDiscoverySubnetDraft('');+ } else {+ setDiscoverySubnetDraft(normalizeSubnetList(lastCustomSubnet()));+ }+ });+ const commitDiscoverySubnet = vi.fn(async (value: string) => {+ setDiscoverySubnetDraft(normalizeSubnetList(value));+ return true;+ });++ render(() => (+ <DiscoverySettingsForm+ discoveryEnabled={discoveryEnabled}+ discoveryMode={discoveryMode}+ discoverySubnetDraft={discoverySubnetDraft}+ discoverySubnetError={discoverySubnetError}+ savingDiscoverySettings={savingDiscoverySettings}+ envOverrides={envOverrides}+ handleDiscoveryEnabledChange={async (enabled) => {+ setDiscoveryEnabled(enabled);+ return true;+ }}+ handleDiscoveryModeChange={handleDiscoveryModeChange}+ setDiscoveryMode={setDiscoveryMode}+ setDiscoverySubnetDraft={setDiscoverySubnetDraft}+ setDiscoverySubnetError={setDiscoverySubnetError}+ setLastCustomSubnet={setLastCustomSubnet}+ commitDiscoverySubnet={commitDiscoverySubnet}+ parseSubnetList={parseSubnetList}+ normalizeSubnetList={normalizeSubnetList}+ isValidCIDR={(value) => parseSubnetList(value).length > 0}+ currentDraftSubnetValue={() => discoverySubnetDraft()}+ />+ ));++ return {+ commitDiscoverySubnet,+ discoveryMode,+ discoverySubnetDraft,+ handleDiscoveryModeChange,+ };+}++describe('DiscoverySettingsForm', () => {+ afterEach(() => cleanup());++ it('switches scan scope when the custom subnets row is clicked', async () => {+ const { discoveryMode, handleDiscoveryModeChange } = renderDiscoverySettingsForm();++ const customScope = screen.getByRole('radio', { name: /Custom subnets \(targeted\)/i });+ fireEvent.click(customScope);++ await waitFor(() => expect(handleDiscoveryModeChange).toHaveBeenCalledWith('custom'));+ expect(discoveryMode()).toBe('custom');+ expect(customScope).toHaveAttribute('aria-checked', 'true');+ expect(screen.getByRole('button', { name: '192.168.1.0/24' })).toBeInTheDocument();+ });++ it('commits a common custom subnet chip from the scan scope control', async () => {+ const { commitDiscoverySubnet, discoverySubnetDraft } = renderDiscoverySettingsForm({+ initialMode: 'custom',+ });++ fireEvent.click(screen.getByRole('button', { name: '192.168.0.0/24' }));++ await waitFor(() => expect(commitDiscoverySubnet).toHaveBeenCalledWith('192.168.0.0/24'));+ expect(discoverySubnetDraft()).toBe('192.168.0.0/24');+ expect(screen.getByLabelText('Discovery subnets')).toHaveValue('192.168.0.0/24');+ });+});diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.tsindex 2c7ef04e09..e7c17c9c5e 100644--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts@@ -37,6 +37,7 @@ import infrastructureInstallerSectionSource from '../InfrastructureInstallerSectimport infrastructureOperationsModelSource from '../infrastructureOperationsModel.tsx?raw';import infrastructureSourceManagerSource from '../InfrastructureSourceManager.tsx?raw';import infrastructureSourcePickerSource from '../InfrastructureSourcePicker.tsx?raw';+import discoverySettingsFormSource from '../DiscoverySettingsForm.tsx?raw';import availabilitySettingsPanelSource from '../AvailabilitySettingsPanel.tsx?raw';import availabilitySettingsModelSource from '../availabilitySettingsModel.ts?raw';import infrastructureWorkspaceModelSource from '../infrastructureWorkspaceModel.ts?raw';@@ -601,7 +602,9 @@ describe('settings architecture guardrails', () => {expect(updateInstallGuideSource).toContain('UpdateReadinessPanel');expect(updateInstallGuideSource).toContain("props.updatePlan?.readiness?.status === 'blocked'");expect(updateInstallGuideSource).toContain('Install blocked');- expect(updateInstallGuideSource).toContain('disabled={props.isInstalling || readinessBlocked()}');+ expect(updateInstallGuideSource).toContain(+ 'disabled={props.isInstalling || readinessBlocked()}',+ );});it('keeps infrastructure on a source-manager landing with route-backed dialogs', () => {@@ -658,6 +661,11 @@ describe('settings architecture guardrails', () => {// Discovery owns an explicit status/action band inside Connected systems// so manual scans are observable without opening the settings dialog.expect(infrastructureSourceManagerSource).toContain('Run discovery');+ // Scan scope choices must be full-row controls; a narrow native radio input+ // regressed the custom subnet path into a hard-to-click target.+ expect(discoverySettingsFormSource).toContain('role="radiogroup"');+ expect(discoverySettingsFormSource).toContain('role="radio"');+ expect(discoverySettingsFormSource).toContain('selectDiscoveryMode');expect(infrastructureSourceManagerSource).toContain('Discovery settings');expect(monitoredSystemImpactPreviewSource).toContain('getMonitoredSystemImpactPreviewTitle');expect(monitoredSystemImpactPreviewSource).toContain(