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
Broaden shared form select governance
rcourtman6d27522ce40a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 6746fe6c71..884c6523de 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -2453,11 +2453,12 @@ green/yellow span classes in storage components or storage-backup presentationhelpers.Native select controls are registry-backed too. `FormSelect` owns label/idwiring, helper-text description merging, value synchronization, default select-chrome, and compact styling hooks for native selects. Workloads guest and node-history range controls must compose `FormSelect` rather than recreating a-screen-reader label plus raw `<select>` shell locally, and future native-select-migrations should extend that primitive instead of forking labelled select-wrappers.+chrome, dynamic-option value synchronization, and compact styling hooks for+native selects. Product components and shared filter/menu internals must+compose `FormSelect` rather than recreating screen-reader labels, native+`<select>` shells, value-reapply effects, or compact select chrome locally; the+only raw native select in frontend runtime code should live inside that+primitive.Native textarea controls follow the same contract. `FormTextarea` ownslabel/id wiring, helper-text description merging, value synchronization, defaulttextarea chrome, and compact styling hooks for multi-line text fields. Alertdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 8c88fa894b..2a3fda5878 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -1665,7 +1665,10 @@ Storage filter option labels for grouped views, node/host filters, sortcontrols, and source selectors are also canonical presentation contracts:storage surfaces must consume `frontend-modern/src/components/Storage/storagePageState.ts`and `frontend-modern/src/utils/storageSources.ts` rather than re-declaring-page-local title casing or alternate all-option labels.+page-local title casing or alternate all-option labels. The storage toolbar may+own sort/filter semantics, but native select label/id/chrome and dynamic value+sync must come from the frontend-primitives-owned `FormSelect` rather than a+storage-local raw `<select>` wrapper.Recovery all-history, all-item-type, and all-platform defaults follow the sameshared filter-option contract through`frontend-modern/src/utils/recoveryTablePresentation.ts`, so recovery historydiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 150812d070..55186aeba8 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1109,6 +1109,11 @@ in `frontend-modern/src/routing/resourceLinks.ts` now serialize query stateonly; the owning platform/runtime route supplies the pathname. New drawer orcorrelation surfaces must anchor on platform routes (or stay-in-place drawerexpansion) instead of resurrecting the retired top-level paths.+Unified-resource drawers and Kubernetes drill-down controls may own resource+timeline filter semantics, namespace choices, and destination routes, but their+native select chrome must compose the frontend-primitives-owned `FormSelect`.+`ResourceDetailDrawerOverviewTab.tsx` and `K8sDeploymentsDrawer.tsx` must not+recreate raw labelled `<select>` controls for those filters locally.The Proxmox platform page is a route-level consumer of canonical unifiedresources, not a new resource source. It filters the existing resource snapshotdiff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex fc5bc507dd..693581feda 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -192,6 +192,9 @@{ "path": "src/components/AI/FindingsPanel.tsx" },{ "path": "src/components/Alerts/EmailProviderSelect.tsx" },{ "path": "src/components/Alerts/WebhookConfigForm.tsx" },+ { "path": "src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx" },+ { "path": "src/components/Kubernetes/K8sDeploymentsDrawer.tsx" },+ { "path": "src/components/OrgSwitcher.tsx" },{ "path": "src/components/Settings/AIChatMaintenanceSection.tsx" },{ "path": "src/components/Settings/AIModelSelectionSection.tsx" },{ "path": "src/components/Settings/AIRuntimeControlsSection.tsx" },@@ -209,8 +212,11 @@{ "path": "src/components/Settings/SystemLogsPanel.tsx" },{ "path": "src/components/Settings/UpdatesSettingsPanel.tsx" },{ "path": "src/components/Storage/DiskDetail.tsx" },+ { "path": "src/components/Storage/StoragePageControls.tsx" },{ "path": "src/components/Storage/StoragePoolDetail.tsx" },{ "path": "src/components/Workloads/GuestDrawerHistory.tsx" },+ { "path": "src/components/shared/FilterBar/AddFilterMenu.tsx" },+ { "path": "src/components/shared/FilterToolbar.tsx" },{ "path": "src/features/alerts/AlertAppriseDestinationsSection.tsx" },{ "path": "src/features/alerts/AlertEscalationSection.tsx" },{ "path": "src/features/alerts/AlertQuietHoursSection.tsx" },@@ -851,19 +857,24 @@]},{- "id": "form-select-local-guest-history-range-select",+ "id": "form-select-local-native-select","category": "form-control",- "summary": "Guest and node drawer history range controls must compose FormSelect instead of recreating the labelled native select locally.",+ "summary": "Product and shared filter components must compose FormSelect instead of recreating labelled native select shells locally.","canonical": {"path": "src/components/shared/FormSelect.tsx","export": "FormSelect"},- "scopes": ["src/components/Workloads"],+ "scopes": ["src/components", "src/features"],"extensions": [".tsx"],- "allPatterns": ["<select", "guest-history-range"],- "legacyReason": "Retired migration debt. Guest history range controls must use FormSelect for label/id/select chrome wiring.",+ "allPatterns": ["<select"],+ "legacyReason": "Retired migration debt. Native select controls must use FormSelect for label/id/select chrome wiring and dynamic option value synchronization.","allowedPaths": [],- "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],+ "ignoredPaths": [+ "src/components/Infrastructure/__tests__/ResourceDetailDrawer.docker-container.test.tsx",+ "src/components/Infrastructure/__tests__/ResourceDetailDrawer.machine-history.test.tsx",+ "src/components/shared/FilterToolbar.test.tsx",+ "src/components/shared/SharedPrimitives.guardrails.test.ts"+ ],"proof": ["src/components/shared/SharedPrimitives.guardrails.test.ts","scripts/shared-template-audit.mjs"diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsxindex 3ad255b210..1389e1888d 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx@@ -15,6 +15,7 @@ import { DisksCard } from '@/components/shared/cards/DisksCard';import { TemperaturesCard } from '@/components/shared/cards/TemperaturesCard';import { RaidCard } from '@/components/shared/cards/RaidCard';import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';+import { FormSelect } from '@/components/shared/FormSelect';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';import { getAllFilterOptionLabel } from '@/components/shared/filterOptionPresentation';import { getServiceHealthPresentation } from '@/utils/serviceHealthPresentation';@@ -423,54 +424,54 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver</div><Show when={drawer.showHistoryFilters() || drawer.hasTimelineFilters()}><div class="mt-3 space-y-2">- <label class="space-y-1 text-[10px]">- <span class="text-muted">Change kind</span>- <select- class="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"- value={drawer.timelineKindFilter()}- onChange={(event) =>- drawer.setTimelineKindFilter(- (event.currentTarget.value || '') as ResourceChangeKind | '',- )- }- >- <For each={timelineKindOptions}>- {(option) => <option value={option.value}>{option.label}</option>}- </For>- </select>- </label>- <label class="space-y-1 text-[10px]">- <span class="text-muted">Source type</span>- <select- class="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"- value={drawer.timelineSourceTypeFilter()}- onChange={(event) =>- drawer.setTimelineSourceTypeFilter(- (event.currentTarget.value || '') as ResourceChangeSourceType | '',- )- }- >- <For each={timelineSourceTypeOptions}>- {(option) => <option value={option.value}>{option.label}</option>}- </For>- </select>- </label>- <label class="space-y-1 text-[10px]">- <span class="text-muted">Source adapter</span>- <select- class="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"- value={drawer.timelineSourceAdapterFilter()}- onChange={(event) =>- drawer.setTimelineSourceAdapterFilter(- (event.currentTarget.value || '') as ResourceChangeSourceAdapter | '',- )- }- >- <For each={timelineSourceAdapterOptions}>- {(option) => <option value={option.value}>{option.label}</option>}- </For>- </select>- </label>+ <FormSelect+ label="Change kind"+ fieldBaseClass="space-y-1 text-[10px]"+ labelClass="text-muted"+ selectBaseClass="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"+ value={drawer.timelineKindFilter()}+ onChange={(event) =>+ drawer.setTimelineKindFilter(+ (event.currentTarget.value || '') as ResourceChangeKind | '',+ )+ }+ >+ <For each={timelineKindOptions}>+ {(option) => <option value={option.value}>{option.label}</option>}+ </For>+ </FormSelect>+ <FormSelect+ label="Source type"+ fieldBaseClass="space-y-1 text-[10px]"+ labelClass="text-muted"+ selectBaseClass="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"+ value={drawer.timelineSourceTypeFilter()}+ onChange={(event) =>+ drawer.setTimelineSourceTypeFilter(+ (event.currentTarget.value || '') as ResourceChangeSourceType | '',+ )+ }+ >+ <For each={timelineSourceTypeOptions}>+ {(option) => <option value={option.value}>{option.label}</option>}+ </For>+ </FormSelect>+ <FormSelect+ label="Source adapter"+ fieldBaseClass="space-y-1 text-[10px]"+ labelClass="text-muted"+ selectBaseClass="w-full rounded border border-border bg-base px-2 py-1 text-[11px] text-base-content"+ value={drawer.timelineSourceAdapterFilter()}+ onChange={(event) =>+ drawer.setTimelineSourceAdapterFilter(+ (event.currentTarget.value || '') as ResourceChangeSourceAdapter | '',+ )+ }+ >+ <For each={timelineSourceAdapterOptions}>+ {(option) => <option value={option.value}>{option.label}</option>}+ </For>+ </FormSelect><Show when={drawer.hasTimelineFilters()}><div class="flex justify-end">diff --git a/frontend-modern/src/components/Kubernetes/K8sDeploymentsDrawer.tsx b/frontend-modern/src/components/Kubernetes/K8sDeploymentsDrawer.tsxindex 1476662199..a91a23643a 100644--- a/frontend-modern/src/components/Kubernetes/K8sDeploymentsDrawer.tsx+++ b/frontend-modern/src/components/Kubernetes/K8sDeploymentsDrawer.tsx@@ -3,6 +3,7 @@ import { For, Show, createMemo, createResource, createSignal, createEffect } froimport { useNavigate } from '@solidjs/router';import { apiFetchJSON } from '@/utils/apiClient';import { Card } from '@/components/shared/Card';+import { FormSelect } from '@/components/shared/FormSelect';import {filterGroupClass,filterLabelClass,@@ -202,21 +203,20 @@ export const K8sDeploymentsDrawer: Component<{</div><Show when={namespaceOptions().length > 0}>- <div class={filterGroupClass}>- <label for="k8s-deployments-namespace" class={filterLabelClass}>- {drawerPresentation.namespaceFilterLabel}- </label>- <select- id="k8s-deployments-namespace"- class={`${filterSelectClass} min-w-[10rem]`}- value={namespace()}- aria-label={drawerPresentation.namespaceFilterLabel}- onChange={(e) => setNamespace(e.currentTarget.value)}- >- <option value="">{drawerPresentation.allNamespacesLabel}</option>- <For each={namespaceOptions()}>{(ns) => <option value={ns}>{ns}</option>}</For>- </select>- </div>+ <FormSelect+ id="k8s-deployments-namespace"+ label={drawerPresentation.namespaceFilterLabel}+ fieldBaseClass={filterGroupClass}+ labelClass={filterLabelClass}+ selectBaseClass={filterSelectClass}+ selectClass="min-w-[10rem]"+ value={namespace()}+ aria-label={drawerPresentation.namespaceFilterLabel}+ onChange={(e) => setNamespace(e.currentTarget.value)}+ >+ <option value="">{drawerPresentation.allNamespacesLabel}</option>+ <For each={namespaceOptions()}>{(ns) => <option value={ns}>{ns}</option>}</For>+ </FormSelect></Show><buttondiff --git a/frontend-modern/src/components/OrgSwitcher.tsx b/frontend-modern/src/components/OrgSwitcher.tsxindex 21609b876f..2d8c839676 100644--- a/frontend-modern/src/components/OrgSwitcher.tsx+++ b/frontend-modern/src/components/OrgSwitcher.tsx@@ -1,5 +1,6 @@import { For, Show, createMemo } from 'solid-js';import type { Organization } from '@/api/orgs';+import { FormSelect } from '@/components/shared/FormSelect';interface OrgSwitcherProps {orgs: Organization[];@@ -28,21 +29,21 @@ export function OrgSwitcher(props: OrgSwitcherProps) {</span>}>- <label class="sr-only" for="org-switcher-select">- Organization- </label>- <select+ <FormSelectid="org-switcher-select"+ label="Organization"+ labelClass="sr-only"+ fieldBaseClass="contents"+ selectBaseClass="h-7 max-w-44 rounded-md border border-border bg-surface px-2 text-xs text-base-content shadow-sm transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60"aria-label="Organization"value={props.selectedOrgId}disabled={Boolean(props.loading)}onChange={(event) => props.onChange(event.currentTarget.value)}- class="h-7 max-w-44 rounded-md border border-border bg-surface px-2 text-xs text-base-content shadow-sm transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60"><For each={props.orgs}>{(org) => <option value={org.id}>{org.displayName || org.id}</option>}</For>- </select>+ </FormSelect></Show><Show when={props.loading}><svgdiff --git a/frontend-modern/src/components/Storage/StoragePageControls.tsx b/frontend-modern/src/components/Storage/StoragePageControls.tsxindex a4e9510e17..ab77afc34f 100644--- a/frontend-modern/src/components/Storage/StoragePageControls.tsx+++ b/frontend-modern/src/components/Storage/StoragePageControls.tsx@@ -2,6 +2,7 @@ import { Component, JSX, Show, createMemo } from 'solid-js';import DatabaseIcon from 'lucide-solid/icons/database';import HardDriveIcon from 'lucide-solid/icons/hard-drive';import { FilterBar, filterChipStatusDot, type FilterDef } from '@/components/shared/FilterBar';+import { FormSelect } from '@/components/shared/FormSelect';import { Subtabs } from '@/components/shared/Subtabs';import { useBreakpoint } from '@/hooks/useBreakpoint';import { STORAGE_KEYS } from '@/utils/localStorage';@@ -315,17 +316,20 @@ export const StoragePageControls: Component<StoragePageControlsProps> = (props)viewOptionsTrailing={<><div class={STORAGE_FILTER_SORT_WRAP_CLASS}>- <select+ <FormSelect+ label="Sort by"+ labelClass="sr-only"+ fieldBaseClass="contents"+ selectBaseClass={STORAGE_FILTER_SORT_SELECT_CLASS}value={props.sortKey()}onChange={(event) => handleSortKeyChange(event.currentTarget.value)}disabled={sortDisabled()}aria-label="Sort by"- class={STORAGE_FILTER_SORT_SELECT_CLASS}>{DEFAULT_STORAGE_SORT_OPTIONS.map((option) => (<option value={option.value}>{option.label}</option>))}- </select>+ </FormSelect><buttontype="button"title={getStorageSortDirectionTitle(props.sortDirection())}diff --git a/frontend-modern/src/components/shared/FilterBar/AddFilterMenu.tsx b/frontend-modern/src/components/shared/FilterBar/AddFilterMenu.tsxindex 91e047225a..9d30d4ed35 100644--- a/frontend-modern/src/components/shared/FilterBar/AddFilterMenu.tsx+++ b/frontend-modern/src/components/shared/FilterBar/AddFilterMenu.tsx@@ -4,6 +4,7 @@ import {filterLabelClass,filterSelectClass,} from '@/components/shared/FilterToolbar';+import { FormSelect } from '@/components/shared/FormSelect';import {isFilterSet,type FilterDef,@@ -102,39 +103,36 @@ export const AddFilterMenu: Component<AddFilterMenuProps> = (props) => {};return (- <div class={`${filterGroupClass} flex-shrink-0`}>- <label for={selectId} class={filterLabelClass}>- Filter- </label>- <select- id={selectId}- value=""- onChange={handleChange}- disabled={isDisabled()}- aria-label="Filter"- class={`${filterSelectClass} min-w-[9rem] disabled:cursor-not-allowed disabled:opacity-50`}- >- <option value="">- {isDisabled() ? 'No filters' : 'Add filter'}- </option>- <For each={selectableGroups()}>- {(group) => (- <optgroup label={GROUP_LABELS[group.key]}>- <For each={group.filters}>- {(filter) => (- <For each={filter.options}>- {(option) => (- <option value={option.token}>- {filter.filter.label}: {option.option.label}- </option>- )}- </For>- )}- </For>- </optgroup>- )}- </For>- </select>- </div>+ <FormSelect+ id={selectId}+ label="Filter"+ fieldBaseClass={`${filterGroupClass} flex-shrink-0`}+ labelClass={filterLabelClass}+ selectBaseClass={filterSelectClass}+ selectClass="min-w-[9rem] disabled:cursor-not-allowed disabled:opacity-50"+ value=""+ onChange={handleChange}+ disabled={isDisabled()}+ aria-label="Filter"+ >+ <option value="">{isDisabled() ? 'No filters' : 'Add filter'}</option>+ <For each={selectableGroups()}>+ {(group) => (+ <optgroup label={GROUP_LABELS[group.key]}>+ <For each={group.filters}>+ {(filter) => (+ <For each={filter.options}>+ {(option) => (+ <option value={option.token}>+ {filter.filter.label}: {option.option.label}+ </option>+ )}+ </For>+ )}+ </For>+ </optgroup>+ )}+ </For>+ </FormSelect>);};diff --git a/frontend-modern/src/components/shared/FilterToolbar.test.tsx b/frontend-modern/src/components/shared/FilterToolbar.test.tsxindex a665fac990..c69cbd0813 100644--- a/frontend-modern/src/components/shared/FilterToolbar.test.tsx+++ b/frontend-modern/src/components/shared/FilterToolbar.test.tsx@@ -16,6 +16,7 @@ import {import toggleSource from './Toggle.tsx?raw';import toggleModelSource from './toggleModel.ts?raw';import toggleStateSource from './useToggleState.ts?raw';+import filterToolbarSource from './FilterToolbar.tsx?raw';describe('FilterHeader', () => {afterEach(() => {@@ -159,6 +160,13 @@ describe('FilterHeader', () => {expect(toggleModelSource).toContain('ToggleChangeEvent');});+ it('keeps labelled filter selects on the shared FormSelect primitive', () => {+ expect(filterToolbarSource).toContain("import { FormSelect } from './FormSelect';");+ expect(filterToolbarSource).toContain('<FormSelect');+ expect(filterToolbarSource).not.toContain('<select');+ expect(filterToolbarSource).not.toContain('MutationObserver');+ });+it('keeps controlled select state when options materialize asynchronously', async () => {const [options, setOptions] = createSignal<{ value: string; label: string }[]>([]);diff --git a/frontend-modern/src/components/shared/FilterToolbar.tsx b/frontend-modern/src/components/shared/FilterToolbar.tsxindex 26b2e6c30a..7826e5e340 100644--- a/frontend-modern/src/components/shared/FilterToolbar.tsx+++ b/frontend-modern/src/components/shared/FilterToolbar.tsx@@ -1,6 +1,7 @@-import { Component, For, JSX, Show, createEffect, onCleanup, splitProps } from 'solid-js';+import { Component, For, JSX, Show, splitProps } from 'solid-js';import BarChartIcon from 'lucide-solid/icons/bar-chart';import ListFilterIcon from 'lucide-solid/icons/list-filter';+import { FormSelect } from './FormSelect';import { FilterButtonGroup, type FilterOption } from './FilterButtonGroup';export const filterToolbarShellClass = '';@@ -312,54 +313,21 @@ export const LabeledFilterSelect: Component<LabeledFilterSelectProps> = (props)'children','groupClass','selectClass',- 'value',+ 'aria-label',]);- let selectRef: HTMLSelectElement | undefined;- const selectId = () => (typeof selectProps.id === 'string' ? selectProps.id : undefined);-- createEffect(() => {- const nextValue = local.value;- if (!selectRef || typeof nextValue !== 'string') return;- const applyValue = () => {- if (!selectRef) return;- const resolvedValue = resolveFilterSelectDomValue(- nextValue,- Array.from(selectRef.options, (option) => option.value),- );- if (typeof resolvedValue !== 'string') return;- for (const option of Array.from(selectRef.options)) {- const shouldSelect = option.value === resolvedValue;- if (option.selected !== shouldSelect) {- option.selected = shouldSelect;- }- }- if (selectRef.value !== resolvedValue) {- selectRef.value = resolvedValue;- }- };-- applyValue();-- const observer = new MutationObserver(() => applyValue());- observer.observe(selectRef, { childList: true, subtree: true });- onCleanup(() => observer.disconnect());- });return (- <div class={`${filterGroupClass} ${local.groupClass ?? ''}`.trim()}>- <label for={selectId()} class={filterLabelClass}>- {local.label}- </label>- <select- {...selectProps}- ref={selectRef}- value={local.value}- aria-label={selectProps['aria-label'] ?? local.label}- class={`${filterSelectClass} ${local.selectClass ?? ''}`.trim()}- >- {local.children}- </select>- </div>+ <FormSelect+ {...selectProps}+ label={local.label}+ aria-label={local['aria-label'] ?? local.label}+ fieldBaseClass={`${filterGroupClass} ${local.groupClass ?? ''}`.trim()}+ labelClass={filterLabelClass}+ selectBaseClass={filterSelectClass}+ selectClass={local.selectClass}+ >+ {local.children}+ </FormSelect>);};diff --git a/frontend-modern/src/components/shared/FormSelect.test.tsx b/frontend-modern/src/components/shared/FormSelect.test.tsxindex cf15524aaf..9f5cc645fc 100644--- a/frontend-modern/src/components/shared/FormSelect.test.tsx+++ b/frontend-modern/src/components/shared/FormSelect.test.tsx@@ -1,4 +1,5 @@-import { cleanup, render, screen } from '@solidjs/testing-library';+import { For, createSignal } from 'solid-js';+import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';import { afterEach, describe, expect, it } from 'vitest';import { FormSelect } from './FormSelect';@@ -62,4 +63,39 @@ describe('FormSelect', () => {);expect(select).toHaveAttribute('aria-describedby', 'external-help provider-help');});++ it('reapplies controlled values when options materialize asynchronously', async () => {+ const [options, setOptions] = createSignal<{ value: string; label: string }[]>([]);++ render(() => (+ <>+ <button+ type="button"+ onClick={() =>+ setOptions([+ { value: 'all', label: 'All platforms' },+ { value: 'truenas', label: 'TrueNAS' },+ ])+ }+ >+ Load options+ </button>+ <FormSelect label="Platform" value="truenas" data-testid="platform-filter">+ <For each={options()}>+ {(option) => <option value={option.value}>{option.label}</option>}+ </For>+ </FormSelect>+ </>+ ));++ const select = screen.getByTestId('platform-filter') as HTMLSelectElement;+ expect(select.value).toBe('');++ screen.getByRole('button', { name: 'Load options' }).click();++ await waitFor(() => expect(select.value).toBe('truenas'));+ expect((screen.getByRole('option', { name: 'TrueNAS' }) as HTMLOptionElement).selected).toBe(+ true,+ );+ });});diff --git a/frontend-modern/src/components/shared/FormSelect.tsx b/frontend-modern/src/components/shared/FormSelect.tsxindex 4000bc8d45..120c14ad00 100644--- a/frontend-modern/src/components/shared/FormSelect.tsx+++ b/frontend-modern/src/components/shared/FormSelect.tsx@@ -1,4 +1,4 @@-import { Show, createEffect, createUniqueId, splitProps } from 'solid-js';+import { Show, createEffect, createUniqueId, onCleanup, splitProps } from 'solid-js';import type { Component, JSX } from 'solid-js';import { formField, formHelpText, formLabel, formSelect } from '@/components/shared/Form';@@ -26,6 +26,7 @@ export const FormSelect: Component<FormSelectProps> = (props) => {'id','label','labelClass',+ 'ref','aria-describedby','class','selectBaseClass',@@ -52,18 +53,32 @@ export const FormSelect: Component<FormSelectProps> = (props) => {const value = local.value;if (!selectElement || value === undefined || value === null) return;- if (Array.isArray(value)) {- const selectedValues = new Set(value.map(String));- for (const option of Array.from(selectElement.options)) {- option.selected = selectedValues.has(option.value);+ const applyValue = () => {+ if (!selectElement) return;++ if (Array.isArray(value)) {+ const selectedValues = new Set(value.map(String));+ for (const option of Array.from(selectElement.options)) {+ option.selected = selectedValues.has(option.value);+ }+ return;+ }++ const nextValue = String(value);+ const optionValues = Array.from(selectElement.options, (option) => option.value);+ const resolvedValue = optionValues.includes(nextValue) ? nextValue : '';+ if (selectElement.value !== resolvedValue) {+ selectElement.value = resolvedValue;}- return;- }+ };++ applyValue();++ if (typeof MutationObserver !== 'function') return;- const nextValue = String(value);- if (selectElement.value !== nextValue) {- selectElement.value = nextValue;- }+ const observer = new MutationObserver(() => applyValue());+ observer.observe(selectElement, { childList: true, subtree: true });+ onCleanup(() => observer.disconnect());});return (@@ -74,6 +89,9 @@ export const FormSelect: Component<FormSelectProps> = (props) => {<selectref={(element) => {selectElement = element;+ if (typeof local.ref === 'function') {+ local.ref(element);+ }}}{...selectProps}id={selectId()}diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 16784dfa48..ee0f240449 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -186,6 +186,8 @@ import filterBarIndexSource from '@/components/shared/FilterBar/index.ts?raw';import savedViewsMenuSource from '@/components/shared/FilterBar/SavedViewsMenu.tsx?raw';import useSavedViewsSource from '@/components/shared/FilterBar/useSavedViews.ts?raw';import storagePageControlsSource from '@/components/Storage/StoragePageControls.tsx?raw';+import orgSwitcherSource from '@/components/OrgSwitcher.tsx?raw';+import resourceDetailDrawerOverviewTabSource from '@/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx?raw';import proxmoxBackupsTableSharedSource from '@/features/proxmox/proxmoxBackupsTableShared.tsx?raw';import truenasSystemsTableSource from '@/features/truenas/TrueNASSystemsTable.tsx?raw';@@ -325,7 +327,7 @@ describe('shared primitive guardrails', () => {};const registeredRule = registry.rules?.find((rule) => rule.id === 'form-select-shell');const registeredGuard = registry.patternGuards?.find(- (guard) => guard.id === 'form-select-local-guest-history-range-select',+ (guard) => guard.id === 'form-select-local-native-select',);expect(registeredRule?.canonical?.path).toBe('src/components/shared/FormSelect.tsx');@@ -334,6 +336,9 @@ describe('shared primitive guardrails', () => {'src/components/AI/FindingsPanel.tsx','src/components/Alerts/EmailProviderSelect.tsx','src/components/Alerts/WebhookConfigForm.tsx',+ 'src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx',+ 'src/components/Kubernetes/K8sDeploymentsDrawer.tsx',+ 'src/components/OrgSwitcher.tsx','src/components/Settings/AIChatMaintenanceSection.tsx','src/components/Settings/AIModelSelectionSection.tsx','src/components/Settings/AIRuntimeControlsSection.tsx',@@ -351,8 +356,11 @@ describe('shared primitive guardrails', () => {'src/components/Settings/SystemLogsPanel.tsx','src/components/Settings/UpdatesSettingsPanel.tsx','src/components/Storage/DiskDetail.tsx',+ 'src/components/Storage/StoragePageControls.tsx','src/components/Storage/StoragePoolDetail.tsx','src/components/Workloads/GuestDrawerHistory.tsx',+ 'src/components/shared/FilterBar/AddFilterMenu.tsx',+ 'src/components/shared/FilterToolbar.tsx','src/features/alerts/AlertAppriseDestinationsSection.tsx','src/features/alerts/AlertEscalationSection.tsx','src/features/alerts/AlertQuietHoursSection.tsx',@@ -360,10 +368,13 @@ describe('shared primitive guardrails', () => {]);expect(registeredGuard?.canonical?.path).toBe('src/components/shared/FormSelect.tsx');expect(registeredGuard?.canonical?.export).toBe('FormSelect');- expect(registeredGuard?.allPatterns).toEqual(['<select', 'guest-history-range']);- expect(registeredGuard?.scopes).toEqual(['src/components/Workloads']);+ expect(registeredGuard?.allPatterns).toEqual(['<select']);+ expect(registeredGuard?.scopes).toEqual(['src/components', 'src/features']);expect(registeredGuard?.allowedPaths ?? []).toHaveLength(0);expect(registeredGuard?.ignoredPaths).toEqual([+ 'src/components/Infrastructure/__tests__/ResourceDetailDrawer.docker-container.test.tsx',+ 'src/components/Infrastructure/__tests__/ResourceDetailDrawer.machine-history.test.tsx',+ 'src/components/shared/FilterToolbar.test.tsx','src/components/shared/SharedPrimitives.guardrails.test.ts',]);@@ -377,15 +388,27 @@ describe('shared primitive guardrails', () => {expect(formSelectSource).toContain('id={selectId()}');expect(formSelectSource).toContain('aria-describedby={describedBy()}');expect(formSelectSource).toContain('createEffect');+ expect(formSelectSource).toContain('MutationObserver');expect(formSelectSource).toContain("'value'");- expect(formSelectSource).toContain('selectElement.value = nextValue');+ expect(formSelectSource).toContain('selectElement.value = resolvedValue');expect(formSelectSource).toContain('local.selectBaseClass ?? formSelect');expect(formSelectSource).toContain('local.fieldBaseClass ?? formField');- expect(guestDrawerHistorySource).toContain('FormSelect');+ for (const source of [+ addFilterMenuSource,+ filterToolbarSource,+ guestDrawerHistorySource,+ k8sDeploymentsDrawerSource,+ orgSwitcherSource,+ resourceDetailDrawerOverviewTabSource,+ storagePageControlsSource,+ ]) {+ expect(source).toContain('FormSelect');+ expect(source).not.toContain('<select');+ }+expect(guestDrawerHistorySource).toContain('id="guest-history-range"');expect(guestDrawerHistorySource).toContain('data-testid="guest-history-range-control"');- expect(guestDrawerHistorySource).not.toContain('<select');});it('keeps native form textareas on the shared labelled primitive', () => {