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.

Canonicalize labelled form selects

rcourtmanfc45d6a89dd0
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 801b712a0a..11e7104b47 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -13,6 +13,7 @@
import { Component, createSignal, createEffect, Show, For, createMemo } from 'solid-js';
import { A, useLocation } from '@solidjs/router';
import { Card } from '@/components/shared/Card';
+import { FormSelect } from '@/components/shared/FormSelect';
import { aiIntelligenceStore, type UnifiedFinding } from '@/stores/aiIntelligence';
import { notificationStore } from '@/stores/notifications';
import { aiChatStore } from '@/stores/aiChat';
@@ -1170,14 +1171,17 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
</For>
</div>
<Show when={patrolFindings().length > 1}>
- <select
+ <FormSelect
+ label="Sort findings"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={sortBy()}
onChange={(e) => setSortBy(e.currentTarget.value as 'severity' | 'time')}
- class="text-xs px-2 py-1 rounded border border-border bg-surface"
+ selectBaseClass="text-xs px-2 py-1 rounded border border-border bg-surface"
>
<option value="severity">By Severity</option>
<option value="time">By Time</option>
- </select>
+ </FormSelect>
</Show>
</div>
</Show>
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index cede1522b6..22d8afac6f 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -484,7 +484,10 @@ describe('aiFindingPresentation', () => {
it('only shows the sort control when there are multiple Patrol findings to sort', () => {
expect(findingsPanelSource).toContain('<Show when={patrolFindings().length > 1}>');
+ expect(findingsPanelSource).toContain('FormSelect');
+ expect(findingsPanelSource).toContain('label="Sort findings"');
expect(findingsPanelSource).toContain('<option value="severity">By Severity</option>');
+ expect(findingsPanelSource).not.toContain('<select');
});
it('hides the filter bar when there are no Patrol findings or special buckets to navigate', () => {
diff --git a/frontend-modern/src/components/Alerts/EmailProviderSelect.test.tsx b/frontend-modern/src/components/Alerts/EmailProviderSelect.test.tsx
index 86da9543c6..4106055fea 100644
--- a/frontend-modern/src/components/Alerts/EmailProviderSelect.test.tsx
+++ b/frontend-modern/src/components/Alerts/EmailProviderSelect.test.tsx
@@ -115,6 +115,24 @@ describe('EmailProviderSelect', () => {
expect(screen.getByText('Recipients (one per line)')).toBeInTheDocument();
});
+ it('exposes canonical labels for provider and security selects', () => {
+ render(() => (
+ <EmailProviderSelect config={makeConfig()} onChange={onChangeMock} onTest={onTestMock} />
+ ));
+
+ expect(screen.getByRole('combobox', { name: 'Email provider' })).toHaveAttribute(
+ 'id',
+ 'alert-email-provider-select',
+ );
+
+ fireEvent.click(screen.getByText('Show advanced options'));
+
+ expect(screen.getByRole('combobox', { name: 'Security' })).toHaveAttribute(
+ 'id',
+ 'alert-email-security-select',
+ );
+ });
+
it('loads providers from the API and populates the select', async () => {
render(() => (
<EmailProviderSelect config={makeConfig()} onChange={onChangeMock} onTest={onTestMock} />
diff --git a/frontend-modern/src/components/Alerts/EmailProviderSelect.tsx b/frontend-modern/src/components/Alerts/EmailProviderSelect.tsx
index a991c127b3..2ce4929ccd 100644
--- a/frontend-modern/src/components/Alerts/EmailProviderSelect.tsx
+++ b/frontend-modern/src/components/Alerts/EmailProviderSelect.tsx
@@ -36,6 +36,7 @@ import {
useEmailProviderSelectState,
type EmailProviderSelectStateProps,
} from './useEmailProviderSelectState';
+import { FormSelect } from '@/components/shared/FormSelect';
interface EmailProviderSelectProps extends EmailProviderSelectStateProps {
config: UIEmailConfig;
@@ -51,12 +52,14 @@ export function EmailProviderSelect(props: EmailProviderSelectProps) {
return (
<div class="space-y-4 text-sm overflow-hidden">
<div class={formField}>
- <label class={labelClass()}>{ALERT_EMAIL_PROVIDER_LABEL}</label>
- <div class="flex w-full flex-wrap items-center gap-2 sm:flex-nowrap">
- <select
+ <div class="flex w-full flex-wrap items-end gap-2 sm:flex-nowrap">
+ <FormSelect
+ id="alert-email-provider-select"
+ label={ALERT_EMAIL_PROVIDER_LABEL}
value={props.config.provider}
onChange={(e) => state.handleProviderChange(e.currentTarget.value)}
- class={`${controlClass('px-2 py-1.5')} sm:w-auto sm:min-w-[180px]`}
+ selectBaseClass={controlClass('px-2 py-1.5')}
+ selectClass="sm:w-auto sm:min-w-[180px]"
>
<option value="">{ALERT_EMAIL_MANUAL_CONFIGURATION_LABEL}</option>
<For each={state.providers()}>
@@ -64,7 +67,7 @@ export function EmailProviderSelect(props: EmailProviderSelectProps) {
<option value={provider.name}>{getAlertEmailProviderOptionLabel(provider)}</option>
)}
</For>
- </select>
+ </FormSelect>
<Show when={props.config.provider}>
<button
type="button"
@@ -212,27 +215,28 @@ export function EmailProviderSelect(props: EmailProviderSelectProps) {
<Show when={state.showAdvanced()}>
<div class="mt-3 space-y-3 text-xs text-base-content">
<div class="grid gap-3 sm:grid-cols-3">
- <div class="flex items-center gap-2">
- <label class={labelClass('text-xs uppercase tracking-[0.08em]')}>
- {ALERT_EMAIL_SECURITY_LABEL}
- </label>
- <select
- value={props.config.tls ? 'tls' : props.config.startTLS ? 'starttls' : 'none'}
- onChange={(e) => {
- const value = e.currentTarget.value;
- props.onChange({
- ...props.config,
- tls: value === 'tls',
- startTLS: value === 'starttls',
- });
- }}
- class={`${controlClass('px-2 py-1 text-sm')} min-w-[120px]`}
- >
- <option value="none">{ALERT_EMAIL_SECURITY_NONE_LABEL}</option>
- <option value="starttls">{ALERT_EMAIL_SECURITY_STARTTLS_LABEL}</option>
- <option value="tls">{ALERT_EMAIL_SECURITY_TLS_LABEL}</option>
- </select>
- </div>
+ <FormSelect
+ id="alert-email-security-select"
+ label={ALERT_EMAIL_SECURITY_LABEL}
+ value={props.config.tls ? 'tls' : props.config.startTLS ? 'starttls' : 'none'}
+ onChange={(e) => {
+ const value = e.currentTarget.value;
+ props.onChange({
+ ...props.config,
+ tls: value === 'tls',
+ startTLS: value === 'starttls',
+ });
+ }}
+ fieldBaseClass="flex"
+ fieldClass="flex-row items-center gap-2"
+ labelClass="text-xs uppercase tracking-[0.08em]"
+ selectBaseClass={controlClass('px-2 py-1 text-sm')}
+ selectClass="min-w-[120px]"
+ >
+ <option value="none">{ALERT_EMAIL_SECURITY_NONE_LABEL}</option>
+ <option value="starttls">{ALERT_EMAIL_SECURITY_STARTTLS_LABEL}</option>
+ <option value="tls">{ALERT_EMAIL_SECURITY_TLS_LABEL}</option>
+ </FormSelect>
<div class="flex w-full flex-wrap items-center gap-2 sm:flex-nowrap">
<label class={labelClass('text-xs uppercase tracking-[0.08em]')}>
{ALERT_EMAIL_RATE_LIMIT_LABEL}
diff --git a/frontend-modern/src/components/Alerts/WebhookConfigForm.tsx b/frontend-modern/src/components/Alerts/WebhookConfigForm.tsx
index d9a82ec385..92e5b77e84 100644
--- a/frontend-modern/src/components/Alerts/WebhookConfigForm.tsx
+++ b/frontend-modern/src/components/Alerts/WebhookConfigForm.tsx
@@ -43,12 +43,9 @@ import {
controlClass,
labelClass,
} from '@/components/shared/Form';
+import { FormSelect } from '@/components/shared/FormSelect';
-import type {
- CustomFieldInput,
- HeaderInput,
- WebhookConfigFormData,
-} from './useWebhookConfigState';
+import type { CustomFieldInput, HeaderInput, WebhookConfigFormData } from './useWebhookConfigState';
type SetterLike<T> = (value: T | ((prev: T) => T)) => T;
@@ -86,10 +83,7 @@ export function WebhookConfigForm(props: WebhookConfigFormProps) {
onClick={() => props.setShowServiceDropdown((open) => !open)}
class="text-sm text-blue-600 hover:text-blue-700 dark:text-blue-400"
>
- {getAlertWebhookServiceLabelFromTemplates(
- props.formData().service,
- props.templates(),
- )}{' '}
+ {getAlertWebhookServiceLabelFromTemplates(props.formData().service, props.templates())}{' '}
→
</button>
</div>
@@ -131,28 +125,25 @@ export function WebhookConfigForm(props: WebhookConfigFormProps) {
<input
type="text"
value={props.formData().name}
- onInput={(e) =>
- props.setFormData((prev) => ({ ...prev, name: e.currentTarget.value }))
- }
+ onInput={(e) => props.setFormData((prev) => ({ ...prev, name: e.currentTarget.value }))}
placeholder={getAlertWebhookNamePlaceholder(props.currentTemplate()?.name)}
class={controlClass('px-2 py-1.5')}
/>
</div>
- <div class={formField}>
- <label class={labelClass()}>HTTP method</label>
- <select
- value={props.formData().method}
- onChange={(e) =>
- props.setFormData((prev) => ({ ...prev, method: e.currentTarget.value }))
- }
- class={controlClass('px-2 py-1.5 pr-8 appearance-none')}
- >
- <option value="POST">POST</option>
- <option value="PUT">PUT</option>
- <option value="PATCH">PATCH</option>
- </select>
- </div>
+ <FormSelect
+ id="alert-webhook-http-method"
+ label="HTTP method"
+ value={props.formData().method}
+ onChange={(e) =>
+ props.setFormData((prev) => ({ ...prev, method: e.currentTarget.value }))
+ }
+ selectBaseClass={controlClass('px-2 py-1.5 pr-8 appearance-none')}
+ >
+ <option value="POST">POST</option>
+ <option value="PUT">PUT</option>
+ <option value="PATCH">PATCH</option>
+ </FormSelect>
</div>
<div class={formField}>
@@ -160,9 +151,7 @@ export function WebhookConfigForm(props: WebhookConfigFormProps) {
<input
type="url"
value={props.formData().url}
- onInput={(e) =>
- props.setFormData((prev) => ({ ...prev, url: e.currentTarget.value }))
- }
+ onInput={(e) => props.setFormData((prev) => ({ ...prev, url: e.currentTarget.value }))}
placeholder={getAlertWebhookUrlPlaceholder(props.currentTemplate()?.urlPattern)}
class={controlClass('px-2 py-1.5 font-mono')}
/>
@@ -171,14 +160,18 @@ export function WebhookConfigForm(props: WebhookConfigFormProps) {
<code class="font-mono text-[11px] text-muted">
{ALERT_WEBHOOK_URL_HELP_TEMPLATE_VARIABLE}
</code>
- . Use{' '}
- <code class="font-mono text-[11px] text-muted">{ALERT_WEBHOOK_URL_HELP_PATH}</code> or{' '}
- <code class="font-mono text-[11px] text-muted">{ALERT_WEBHOOK_URL_HELP_QUERY}</code> to
+ . Use <code class="font-mono text-[11px] text-muted">{ALERT_WEBHOOK_URL_HELP_PATH}</code>{' '}
+ or <code class="font-mono text-[11px] text-muted">{ALERT_WEBHOOK_URL_HELP_QUERY}</code> to
keep dynamic values URL-safe.
</p>
</div>
- <Show when={hasAlertWebhookMentionSupportFromTemplates(props.formData().service, props.templates())}>
+ <Show
+ when={hasAlertWebhookMentionSupportFromTemplates(
+ props.formData().service,
+ props.templates(),
+ )}
+ >
<div class={formField}>
<label class={labelClass('flex items-center gap-2')}>
Mention
@@ -203,10 +196,7 @@ export function WebhookConfigForm(props: WebhookConfigFormProps) {
)}
>
<p class={formHelpText + ' mt-1'}>
- {getAlertWebhookMentionHelpFromTemplates(
- props.formData().service,
- props.templates(),
- )}
+ {getAlertWebhookMentionHelpFromTemplates(props.formData().service, props.templates())}
</p>
</Show>
</div>
@@ -321,9 +311,7 @@ export function WebhookConfigForm(props: WebhookConfigFormProps) {
<input
type="text"
value={header().value}
- onInput={(e) =>
- props.updateHeaderInput(index, { value: e.currentTarget.value })
- }
+ onInput={(e) => props.updateHeaderInput(index, { value: e.currentTarget.value })}
placeholder={ALERT_WEBHOOK_HEADER_VALUE_PLACEHOLDER}
class={controlClass('flex-1 px-2 py-1.5 text-xs font-mono')}
/>
diff --git a/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx b/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx
index ec1746434e..c5218a539e 100644
--- a/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx
+++ b/frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx
@@ -1,4 +1,5 @@
import { Component, For, Show } from 'solid-js';
+import { FormSelect } from '@/components/shared/FormSelect';
import type { AISettingsState } from '@/components/Settings/useAISettingsState';
import {
AI_SETTINGS_ASSISTANT_SESSIONS_TITLE,
@@ -45,7 +46,12 @@ export const AIChatMaintenanceSection: Component<AIChatMaintenanceSectionProps>
stroke="currentColor"
viewBox="0 0 24 24"
>
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M19 9l-7 7-7-7"
+ />
</svg>
</button>
<Show when={state.showChatMaintenance()}>
@@ -76,21 +82,29 @@ export const AIChatMaintenanceSection: Component<AIChatMaintenanceSectionProps>
<Show when={!state.chatSessionsError()}>
<Show
when={state.chatSessions().length > 0}
- fallback={<div class="text-xs text-muted">{getAIChatSessionsEmptyState().text}</div>}
+ fallback={
+ <div class="text-xs text-muted">{getAIChatSessionsEmptyState().text}</div>
+ }
>
- <select
+ <FormSelect
+ label="Pulse Assistant session"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={state.selectedSessionId()}
onChange={(e) => state.setSelectedSessionId(e.currentTarget.value)}
- class="w-full min-h-10 sm:min-h-9 px-2 py-2 text-sm border border-border rounded"
+ selectBaseClass="w-full min-h-10 sm:min-h-9 px-2 py-2 text-sm border border-border rounded"
disabled={state.saving()}
>
<For each={state.chatSessions()}>
- {(session) => <option value={session.id}>{state.formatSessionLabel(session)}</option>}
+ {(session) => (
+ <option value={session.id}>{state.formatSessionLabel(session)}</option>
+ )}
</For>
- </select>
+ </FormSelect>
<Show when={state.selectedChatSession()}>
<p class="text-[10px] text-muted mt-1">
- Last updated {new Date(state.selectedChatSession()!.updated_at).toLocaleString()}
+ Last updated{' '}
+ {new Date(state.selectedChatSession()!.updated_at).toLocaleString()}
</p>
</Show>
</Show>
@@ -104,7 +118,9 @@ export const AIChatMaintenanceSection: Component<AIChatMaintenanceSectionProps>
disabled={!state.selectedSessionId() || state.sessionActionLoading() !== null}
class="w-full sm:w-auto min-h-10 sm:min-h-9 px-3 py-2 text-sm font-medium rounded border border-border bg-surface text-base-content hover:bg-surface-hover disabled:opacity-50"
>
- {state.sessionActionLoading() === 'summarize' ? 'Summarizing...' : 'Summarize session'}
+ {state.sessionActionLoading() === 'summarize'
+ ? 'Summarizing...'
+ : 'Summarize session'}
</button>
<button
type="button"
@@ -123,7 +139,9 @@ export const AIChatMaintenanceSection: Component<AIChatMaintenanceSectionProps>
{state.sessionActionLoading() === 'revert' ? 'Reverting...' : 'Revert changes'}
</button>
</div>
- <p class="text-[10px] text-muted">These actions apply to the selected chat session only.</p>
+ <p class="text-[10px] text-muted">
+ These actions apply to the selected chat session only.
+ </p>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/AIRuntimeControlsSection.tsx b/frontend-modern/src/components/Settings/AIRuntimeControlsSection.tsx
index 7761372745..6801820e36 100644
--- a/frontend-modern/src/components/Settings/AIRuntimeControlsSection.tsx
+++ b/frontend-modern/src/components/Settings/AIRuntimeControlsSection.tsx
@@ -2,6 +2,7 @@ import { Component, Show } from 'solid-js';
import type { AIControlLevel } from '@/utils/aiControlLevelPresentation';
import type { AISettingsState } from '@/components/Settings/useAISettingsState';
import { HelpIcon } from '@/components/shared/HelpIcon';
+import { FormSelect } from '@/components/shared/FormSelect';
import { UpgradeLink } from '@/components/shared/UpgradeLink';
import { Toggle } from '@/components/shared/Toggle';
import { TERMS_DOC_URL } from '@/utils/docsLinks';
@@ -25,7 +26,9 @@ interface AIRuntimeControlsSectionProps {
export const AIRuntimeControlsSection: Component<AIRuntimeControlsSectionProps> = (props) => {
const { state } = props;
const showAutonomousControlOption = () =>
- !state.autoFixLocked() || state.showUpgradePrompts() || state.form.controlLevel === 'autonomous';
+ !state.autoFixLocked() ||
+ state.showUpgradePrompts() ||
+ state.form.controlLevel === 'autonomous';
return (
<>
@@ -93,26 +96,26 @@ export const AIRuntimeControlsSection: Component<AIRuntimeControlsSectionProps>
<Show when={state.form.discoveryEnabled}>
<div class="flex flex-col gap-1">
- <div class="flex items-center gap-3">
- <label class="text-xs font-medium text-muted w-32 flex-shrink-0">
- Scan Interval
- </label>
- <select
- class="flex-1 px-2 py-1 text-sm border border-border rounded bg-surface"
- value={state.form.discoveryIntervalHours}
- onChange={(e) =>
- state.setForm('discoveryIntervalHours', parseInt(e.currentTarget.value, 10))
- }
- disabled={state.saving()}
- >
- <option value={0}>Manual only</option>
- <option value={6}>Every 6 hours</option>
- <option value={12}>Every 12 hours</option>
- <option value={24}>Every 24 hours</option>
- <option value={48}>Every 2 days</option>
- <option value={168}>Every 7 days</option>
- </select>
- </div>
+ <FormSelect
+ id="ai-workload-discovery-scan-interval"
+ label="Scan Interval"
+ value={state.form.discoveryIntervalHours}
+ onChange={(e) =>
+ state.setForm('discoveryIntervalHours', parseInt(e.currentTarget.value, 10))
+ }
+ disabled={state.saving()}
+ fieldBaseClass="flex"
+ fieldClass="items-center gap-3"
+ labelClass="text-xs font-medium text-muted w-32 flex-shrink-0"
+ selectBaseClass="flex-1 px-2 py-1 text-sm border border-border rounded bg-surface"
+ >
+ <option value={0}>Manual only</option>
+ <option value={6}>Every 6 hours</option>
+ <option value={12}>Every 12 hours</option>
+ <option value={24}>Every 24 hours</option>
+ <option value={48}>Every 2 days</option>
+ <option value={168}>Every 7 days</option>
+ </FormSelect>
<p class="text-[10px] text-muted ml-32 pl-3">
{state.form.discoveryIntervalHours === 0
? 'Workload discovery runs only when you click "Update Discovery" on a resource'
@@ -235,26 +238,28 @@ export const AIRuntimeControlsSection: Component<AIRuntimeControlsSectionProps>
</Show>
</div>
- <div class="flex items-center gap-3">
- <label class="text-xs font-medium text-muted w-28 flex-shrink-0">Control mode</label>
- <select
- value={state.form.controlLevel}
- onChange={(e) => state.setForm('controlLevel', e.currentTarget.value as AIControlLevel)}
- class="flex-1 min-h-10 sm:min-h-9 px-2 py-2 text-sm border border-border rounded bg-surface"
- disabled={state.saving()}
- >
- <option value="read_only">Read Only - Pulse Assistant can only observe</option>
- <option value="controlled">
- Controlled - Pulse Assistant executes with your approval
+ <FormSelect
+ id="ai-control-mode-select"
+ label="Control mode"
+ value={state.form.controlLevel}
+ onChange={(e) => state.setForm('controlLevel', e.currentTarget.value as AIControlLevel)}
+ disabled={state.saving()}
+ fieldBaseClass="flex"
+ fieldClass="items-center gap-3"
+ labelClass="text-xs font-medium text-muted w-28 flex-shrink-0"
+ selectBaseClass="flex-1 min-h-10 sm:min-h-9 px-2 py-2 text-sm border border-border rounded bg-surface"
+ >
+ <option value="read_only">Read Only - Pulse Assistant can only observe</option>
+ <option value="controlled">
+ Controlled - Pulse Assistant executes with your approval
+ </option>
+ <Show when={showAutonomousControlOption()}>
+ <option value="autonomous">
+ Autonomous - Pulse Assistant executes without approval
+ {state.autoFixLocked() && state.showUpgradePrompts() ? ' (Pro)' : ''}
</option>
- <Show when={showAutonomousControlOption()}>
- <option value="autonomous">
- Autonomous - Pulse Assistant executes without approval
- {state.autoFixLocked() && state.showUpgradePrompts() ? ' (Pro)' : ''}
- </option>
- </Show>
- </select>
- </div>
+ </Show>
+ </FormSelect>
<p class="text-[10px] text-muted ml-[7.5rem]">
{getAIControlLevelDescription(state.form.controlLevel)}
</p>
diff --git a/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx b/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx
index 9e1e3c53ed..c394b50c01 100644
--- a/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx
+++ b/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx
@@ -2,6 +2,7 @@ import { Component, For, Show } from 'solid-js';
import { Card } from '@/components/shared/Card';
import SettingsPanel from '@/components/shared/SettingsPanel';
import { Dialog } from '@/components/shared/Dialog';
+import { FormSelect } from '@/components/shared/FormSelect';
import { UpgradeLink } from '@/components/shared/UpgradeLink';
import { SuggestProfileModal } from './SuggestProfileModal';
import { KNOWN_SETTINGS, type SelectSetting, type StringSetting } from './agentProfileSettings';
@@ -258,12 +259,15 @@ export const AgentProfilesPanel: Component = () => {
render: (agent) => {
const assignment = () => getAgentAssignment(agent.assignmentId);
return (
- <select
+ <FormSelect
+ label={`Profile for ${agent.displayName || agent.hostname}`}
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={assignment()?.profile_id || ''}
onChange={(e) =>
handleAssign(agent.assignmentId, e.currentTarget.value)
}
- class="min-h-10 sm:min-h-9 w-full sm:max-w-xs rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
+ selectBaseClass="min-h-10 sm:min-h-9 w-full sm:max-w-xs rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
>
<option value="">No profile</option>
<Show
@@ -283,7 +287,7 @@ export const AgentProfilesPanel: Component = () => {
</option>
)}
</For>
- </select>
+ </FormSelect>
);
},
},
@@ -422,18 +426,21 @@ export const AgentProfilesPanel: Component = () => {
</button>
</Show>
<Show when={setting.type === 'select'}>
- <select
+ <FormSelect
+ label={`${setting.label} value`}
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={(formSettings()[setting.key] as string) || ''}
onChange={(e) =>
updateSetting(setting.key, e.currentTarget.value || undefined)
}
- class="min-h-10 sm:min-h-9 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
+ selectBaseClass="min-h-10 sm:min-h-9 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
>
<option value="">Default</option>
<For each={(setting as SelectSetting).options}>
{(opt) => <option value={opt}>{opt}</option>}
</For>
- </select>
+ </FormSelect>
</Show>
<Show when={setting.type === 'duration'}>
<input
diff --git a/frontend-modern/src/components/Settings/AuditLogPanel.tsx b/frontend-modern/src/components/Settings/AuditLogPanel.tsx
index e86758d71b..8899d8dc1c 100644
--- a/frontend-modern/src/components/Settings/AuditLogPanel.tsx
+++ b/frontend-modern/src/components/Settings/AuditLogPanel.tsx
@@ -8,6 +8,7 @@ import X from 'lucide-solid/icons/x';
import ShieldAlert from 'lucide-solid/icons/shield-alert';
import { showTooltip, hideTooltip } from '@/components/shared/Tooltip';
import { UpgradeLink } from '@/components/shared/UpgradeLink';
+import { FormSelect } from '@/components/shared/FormSelect';
import Toggle from '@/components/shared/Toggle';
import SettingsPanel from '@/components/shared/SettingsPanel';
import { PulseDataGrid } from '@/components/shared/PulseDataGrid';
@@ -185,17 +186,20 @@ export default function AuditLogPanel() {
<Filter class="w-4 h-4 text-slate-400" />
<span class="text-sm font-medium text-base-content">Filters:</span>
</div>
- <select
+ <FormSelect
+ label="Audit event type"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={eventFilter()}
onChange={(e) => setEventFilter(e.currentTarget.value)}
- class="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
+ selectBaseClass="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
>
<option value="">{AUDIT_EVENT_FILTER_ALL_LABEL}</option>
<option value="login">Login</option>
<option value="logout">Logout</option>
<option value="config_change">{AUDIT_EVENT_CONFIG_CHANGE_LABEL}</option>
<option value="startup">Startup</option>
- </select>
+ </FormSelect>
<input
type="text"
placeholder="Filter by user..."
@@ -203,35 +207,44 @@ export default function AuditLogPanel() {
onInput={(e) => setUserFilter(e.currentTarget.value)}
class="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content placeholder-gray-400"
/>
- <select
+ <FormSelect
+ label="Audit outcome"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={successFilter()}
onChange={(e) => setSuccessFilter(e.currentTarget.value)}
- class="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
+ selectBaseClass="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
>
<option value="all">All</option>
<option value="success">{AUDIT_SUCCESS_FILTER_SUCCESS_ONLY_LABEL}</option>
<option value="failed">{AUDIT_SUCCESS_FILTER_FAILED_ONLY_LABEL}</option>
- </select>
- <select
+ </FormSelect>
+ <FormSelect
+ label="Audit verification status"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={verificationFilter()}
onChange={(e) => setVerificationFilter(e.currentTarget.value)}
- class="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
+ selectBaseClass="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
>
<option value="all">{AUDIT_VERIFICATION_FILTER_ALL_LABEL}</option>
<option value="needs">{AUDIT_VERIFICATION_FILTER_NEEDS_LABEL}</option>
<option value="verified">Verified</option>
<option value="failed">Failed/Error</option>
- </select>
- <select
+ </FormSelect>
+ <FormSelect
+ label="Audit page size"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={String(pageSize())}
onChange={(e) => setPageSize(Number(e.currentTarget.value))}
- class="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
+ selectBaseClass="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border border-border rounded-md bg-surface text-base-content"
>
<option value="25">25 / page</option>
<option value="50">50 / page</option>
<option value="100">100 / page</option>
<option value="200">200 / page</option>
- </select>
+ </FormSelect>
<button
onClick={applyFilters}
class="w-full sm:w-auto min-h-10 sm:min-h-10 px-3 py-2.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md"
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx
index 865e7d7cc3..2c2e7311ad 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx
@@ -5,8 +5,8 @@ import {
formField,
formHelpText,
formLabel,
- formSelect,
} from '@/components/shared/Form';
+import { FormSelect } from '@/components/shared/FormSelect';
import { TlsVerificationWarningBanner } from '@/components/shared/TlsVerificationWarningBanner';
import { MonitoredSystemAdmissionPreview } from '../../MonitoredSystemAdmissionPreview';
import type { TrueNASConnection } from '@/api/truenas';
@@ -113,23 +113,20 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
How often Pulse should refresh this TrueNAS connection.
</span>
</label>
- <label class={formField}>
- <span class={formLabel}>Authentication</span>
- <select
- class={formSelect}
- value={props.state.form().authMode}
- onChange={(event) =>
- props.state.updateForm({
- authMode: event.currentTarget.value as 'apiKey' | 'userpass',
- apiKey: '',
- password: '',
- })
- }
- >
- <option value="apiKey">API key</option>
- <option value="userpass">Username and password</option>
- </select>
- </label>
+ <FormSelect
+ label="Authentication"
+ value={props.state.form().authMode}
+ onChange={(event) =>
+ props.state.updateForm({
+ authMode: event.currentTarget.value as 'apiKey' | 'userpass',
+ apiKey: '',
+ password: '',
+ })
+ }
+ >
+ <option value="apiKey">API key</option>
+ <option value="userpass">Username and password</option>
+ </FormSelect>
</div>
<Show when={props.state.form().authMode === 'apiKey'}>
@@ -141,9 +138,7 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
value={props.state.form().apiKey}
onInput={(event) => props.state.updateForm({ apiKey: event.currentTarget.value })}
placeholder={
- props.state.form().hasStoredApiKey
- ? 'Saved API key retained unless replaced'
- : ''
+ props.state.form().hasStoredApiKey ? 'Saved API key retained unless replaced' : ''
}
/>
<Show when={props.state.form().hasStoredApiKey}>
@@ -159,9 +154,7 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
<input
class={formControl}
value={props.state.form().username}
- onInput={(event) =>
- props.state.updateForm({ username: event.currentTarget.value })
- }
+ onInput={(event) => props.state.updateForm({ username: event.currentTarget.value })}
placeholder="admin"
/>
</label>
@@ -171,9 +164,7 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
class={formControl}
type="password"
value={props.state.form().password}
- onInput={(event) =>
- props.state.updateForm({ password: event.currentTarget.value })
- }
+ onInput={(event) => props.state.updateForm({ password: event.currentTarget.value })}
placeholder={
props.state.form().hasStoredPassword
? 'Saved password retained unless replaced'
@@ -396,9 +387,7 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
type="button"
class={buttonClass}
onClick={() => void props.state.previewCurrentForm()}
- disabled={
- props.state.saving() || props.state.testing() || props.state.previewing()
- }
+ disabled={props.state.saving() || props.state.testing() || props.state.previewing()}
>
{props.state.previewing() ? 'Previewing…' : 'Preview impact'}
</button>
diff --git a/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx b/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx
index a01b006814..3ad5988288 100644
--- a/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx
@@ -1,5 +1,6 @@
import type { Component } from 'solid-js';
import { For, Show, createSignal } from 'solid-js';
+import { FormSelect } from '@/components/shared/FormSelect';
import SettingsPanel from '@/components/shared/SettingsPanel';
import { copyToClipboard } from '@/utils/clipboard';
import { formatAbsoluteTime, formatRelativeTime } from '@/utils/format';
@@ -434,26 +435,22 @@ export const InfrastructureInstallerSection: Component = () => {
</div>
<div class="rounded-md border border-border bg-surface-hover px-4 py-3">
- <label
- for="install-profile-select"
- class="mb-1.5 block text-xs font-medium text-base-content"
- >
- Target profile (optional)
- </label>
- <select
+ <FormSelect
id="install-profile-select"
+ label="Target profile (optional)"
+ labelClass="mb-1.5 block text-xs font-medium text-base-content"
value={state.installProfile()}
onChange={(event) =>
state.handleInstallProfileChange(
event.currentTarget.value as InstallProfile,
)
}
- class="w-full rounded-md border bg-surface px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:focus:border-blue-400 dark:focus:ring-blue-800"
+ selectBaseClass="w-full rounded-md border bg-surface px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:focus:border-blue-400 dark:focus:ring-blue-800"
>
<For each={INSTALL_PROFILE_OPTIONS}>
{(option) => <option value={option.value}>{option.label}</option>}
</For>
- </select>
+ </FormSelect>
<p class="mt-1.5 text-xs text-muted">
{state.getSelectedInstallProfile().description}
</p>
diff --git a/frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx b/frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx
index e2dde8bbc0..1a4d721a07 100644
--- a/frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx
+++ b/frontend-modern/src/components/Settings/NodeModalMonitoringSection.tsx
@@ -1,8 +1,15 @@
import { Component, Show } from 'solid-js';
import type { NodeModalProps } from '@/components/Settings/nodeModalModel';
import type { NodeModalState } from '@/components/Settings/useNodeModalState';
+import { FormSelect } from '@/components/shared/FormSelect';
import { SectionHeader } from '@/components/shared/SectionHeader';
-import { controlClass, formCheckbox, formField, formHelpText, labelClass } from '@/components/shared/Form';
+import {
+ controlClass,
+ formCheckbox,
+ formField,
+ formHelpText,
+ labelClass,
+} from '@/components/shared/Form';
import { TogglePrimitive } from '@/components/shared/Toggle';
import {
getNodeMonitoringCoverageCopy,
@@ -97,9 +104,7 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
/>
<div>
<div>Containers</div>
- <p class="text-xs text-muted mt-1">
- LXC container state and resource usage.
- </p>
+ <p class="text-xs text-muted mt-1">LXC container state and resource usage.</p>
</div>
</label>
@@ -127,9 +132,7 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
/>
<div>
<div>Backups</div>
- <p class="text-xs text-muted mt-1">
- vzdump schedules and recent backup activity.
- </p>
+ <p class="text-xs text-muted mt-1">vzdump schedules and recent backup activity.</p>
</div>
</label>
</div>
@@ -164,8 +167,11 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
<Show when={state.formData().monitorPhysicalDisks}>
<div class="mt-3 flex items-center gap-2 border-t border-border pt-3">
<label class="text-xs text-muted">Poll every</label>
- <select
- class="rounded border bg-surface px-2 py-1 text-xs text-base-content"
+ <FormSelect
+ label="Physical disk health polling interval"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
+ selectBaseClass="rounded border bg-surface px-2 py-1 text-xs text-base-content"
value={state.formData().physicalDiskPollingMinutes}
onChange={(event) =>
state.updateField(
@@ -178,7 +184,7 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
<option value={15}>15 minutes</option>
<option value={30}>30 minutes</option>
<option value={60}>1 hour</option>
- </select>
+ </FormSelect>
</div>
</Show>
</div>
@@ -189,9 +195,8 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
<div>
<p class="font-medium text-base-content">Temperature monitoring</p>
<p class="mt-1 text-xs text-muted">
- Uses the Pulse sensors key or proxy to read CPU/NVMe temperatures for this
- node. Disable if you don't need temperature data or haven't deployed the proxy
- yet.
+ Uses the Pulse sensors key or proxy to read CPU/NVMe temperatures for this node.
+ Disable if you don't need temperature data or haven't deployed the proxy yet.
</p>
</div>
<TogglePrimitive
@@ -211,8 +216,8 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
</div>
<Show when={!state.temperatureMonitoringEnabledValue()}>
<p class="mt-3 rounded border border-blue-200 bg-blue-50 p-2 text-xs text-blue-700 dark:border-blue-700 dark:bg-blue-900 dark:text-blue-200">
- Pulse will skip SSH temperature polling for this node. Existing dashboard
- readings will stop refreshing.
+ Pulse will skip SSH temperature polling for this node. Existing dashboard readings
+ will stop refreshing.
</p>
</Show>
<Show when={modalProps.temperatureMonitoringLocked}>
@@ -234,8 +239,8 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
titleClass="text-base-content"
/>
<p class="text-xs text-muted">
- Control which Proxmox Backup Server surfaces Pulse ingests. Disable collectors you
- don't need.
+ Control which Proxmox Backup Server surfaces Pulse ingests. Disable collectors you don't
+ need.
</p>
<label class="flex items-start gap-2 text-sm text-base-content">
@@ -266,9 +271,7 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
/>
<div>
<div>Sync jobs</div>
- <p class="text-xs text-muted mt-1">
- Remote sync schedules and their last-run state.
- </p>
+ <p class="text-xs text-muted mt-1">Remote sync schedules and their last-run state.</p>
</div>
</label>
@@ -283,9 +286,7 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
/>
<div>
<div>Verify jobs</div>
- <p class="text-xs text-muted mt-1">
- Backup verification schedules and outcomes.
- </p>
+ <p class="text-xs text-muted mt-1">Backup verification schedules and outcomes.</p>
</div>
</label>
@@ -334,15 +335,17 @@ export const NodeModalMonitoringSection: Component<NodeModalMonitoringSectionPro
titleClass="text-base-content"
/>
<p class="text-xs text-muted">
- Control which PMG data sets Pulse ingests. Disable individual collectors if you want
- to limit API usage.
+ Control which PMG data sets Pulse ingests. Disable individual collectors if you want to
+ limit API usage.
</p>
<label class="flex items-start gap-2 text-sm text-base-content">
<input
type="checkbox"
checked={state.formData().monitorMailStats}
- onChange={(event) => state.updateField('monitorMailStats', event.currentTarget.checked)}
+ onChange={(event) =>
+ state.updateField('monitorMailStats', event.currentTarget.checked)
+ }
class={formCheckbox + ' mt-0.5'}
/>
<div>
diff --git a/frontend-modern/src/components/Settings/OrganizationAccessManagementSection.tsx b/frontend-modern/src/components/Settings/OrganizationAccessManagementSection.tsx
index b72f3fe050..cdef9deadf 100644
--- a/frontend-modern/src/components/Settings/OrganizationAccessManagementSection.tsx
+++ b/frontend-modern/src/components/Settings/OrganizationAccessManagementSection.tsx
@@ -1,5 +1,6 @@
import type { OrganizationRole } from '@/api/orgs';
import { Component, For, Show } from 'solid-js';
+import { FormSelect } from '@/components/shared/FormSelect';
import { ORGANIZATION_MEMBER_ROLE_OPTIONS } from '@/utils/organizationRolePresentation';
import { getOrganizationAccessManageRequiredMessage } from '@/utils/organizationSettingsPresentation';
import type { useOrganizationAccessPanelState } from './useOrganizationAccessPanelState';
@@ -26,12 +27,15 @@ export const OrganizationAccessManagementSection: Component<
placeholder="username"
class="w-full rounded-md border px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
- <select
+ <FormSelect
+ label="Invite role"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={props.state.inviteRole()}
onChange={(event) =>
props.state.setInviteRole(event.currentTarget.value as OrganizationRole)
}
- class="rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
+ selectBaseClass="rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
>
<For
each={ORGANIZATION_MEMBER_ROLE_OPTIONS.filter(
@@ -41,7 +45,7 @@ export const OrganizationAccessManagementSection: Component<
>
{(option) => <option value={option.value}>{option.label}</option>}
</For>
- </select>
+ </FormSelect>
<button
type="button"
onClick={props.state.inviteMember}
diff --git a/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx b/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx
index 346d2e4469..c1fba8fbcb 100644
--- a/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx
+++ b/frontend-modern/src/components/Settings/OrganizationAccessMembersSection.tsx
@@ -1,4 +1,5 @@
import { Component, For, Show } from 'solid-js';
+import { FormSelect } from '@/components/shared/FormSelect';
import { PulseDataGrid } from '@/components/shared/PulseDataGrid';
import { ORGANIZATION_MEMBER_ROLE_OPTIONS } from '@/utils/organizationRolePresentation';
import { formatOrgDate, normalizeRole, roleBadgeClass } from '@/utils/orgUtils';
@@ -12,9 +13,9 @@ interface OrganizationAccessMembersSectionProps {
state: ReturnType<typeof useOrganizationAccessPanelState>;
}
-export const OrganizationAccessMembersSection: Component<
- OrganizationAccessMembersSectionProps
-> = (props) => (
+export const OrganizationAccessMembersSection: Component<OrganizationAccessMembersSectionProps> = (
+ props,
+) => (
<Show when={props.state.org()}>
{(currentOrg) => (
<div class="mt-4">
@@ -43,7 +44,10 @@ export const OrganizationAccessMembersSection: Component<
</span>
}
>
- <select
+ <FormSelect
+ label={`Role for ${member.userId}`}
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={role}
onChange={(event) => {
void props.state.updateRole(
@@ -55,7 +59,7 @@ export const OrganizationAccessMembersSection: Component<
props.state.saving() ||
(isOwner() && props.currentUser !== currentOrg().ownerUserId)
}
- class="rounded-md border border-border bg-surface px-2 py-1 text-xs text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60"
+ selectBaseClass="rounded-md border border-border bg-surface px-2 py-1 text-xs text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60"
>
<For
each={ORGANIZATION_MEMBER_ROLE_OPTIONS.filter(
@@ -66,7 +70,7 @@ export const OrganizationAccessMembersSection: Component<
>
{(option) => <option value={option.value}>{option.label}</option>}
</For>
- </select>
+ </FormSelect>
</Show>
);
},
@@ -74,9 +78,7 @@ export const OrganizationAccessMembersSection: Component<
{
key: 'addedAt',
label: 'Added',
- render: (member) => (
- <span class="text-muted">{formatOrgDate(member.addedAt)}</span>
- ),
+ render: (member) => <span class="text-muted">{formatOrgDate(member.addedAt)}</span>,
},
{
key: 'actions',
diff --git a/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx b/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx
index 695b01df34..1391714769 100644
--- a/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx
+++ b/frontend-modern/src/components/Settings/OrganizationSharingCreateSection.tsx
@@ -1,4 +1,5 @@
import { Component, For, Show } from 'solid-js';
+import { FormSelect } from '@/components/shared/FormSelect';
import { CANONICAL_RESOURCE_TYPES } from '@/utils/canonicalResourceTypes';
import {
ORGANIZATION_SHARE_ROLE_OPTIONS,
@@ -20,66 +21,59 @@ export const OrganizationSharingCreateSection: Component<OrganizationSharingCrea
<h4 class="text-sm font-semibold text-base-content">Create Share</h4>
<div class="grid gap-3 lg:grid-cols-2">
- <label class="space-y-1">
- <span class="text-xs font-medium uppercase tracking-wide text-muted">
- Target Organization
- </span>
- <select
+ <div class="space-y-1">
+ <FormSelect
+ label="Target Organization"
+ labelClass="text-xs font-medium uppercase tracking-wide text-muted"
value={props.state.targetOrgId()}
onChange={(event) => props.state.updateTargetOrg(event.currentTarget.value)}
- class={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${props.state.targetOrgError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}
+ selectBaseClass={`w-full rounded-md border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 ${props.state.targetOrgError() ? 'border-red-400 dark:border-red-500' : 'border-border'}`}
>
<option value="">Select organization</option>
<For each={props.state.targetOrgOptions()}>
{(target) => <option value={target.id}>{target.displayName || target.id}</option>}
</For>
- </select>
+ </FormSelect>
<Show when={props.state.targetOrgError() !== ''}>
- <p class="text-xs text-red-600 dark:text-red-400">
- {props.state.targetOrgError()}
- </p>
+ <p class="text-xs text-red-600 dark:text-red-400">{props.state.targetOrgError()}</p>
</Show>
- </label>
+ </div>
- <label class="space-y-1">
- <span class="text-xs font-medium uppercase tracking-wide text-muted">
- Access Role
- </span>
- <select
- value={props.state.accessRole()}
- onChange={(event) =>
- props.state.setAccessRole(event.currentTarget.value as ShareAccessRole)
- }
- class="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
- >
- <For each={ORGANIZATION_SHARE_ROLE_OPTIONS}>
- {(option) => <option value={option.value}>{option.label}</option>}
- </For>
- </select>
- </label>
+ <FormSelect
+ label="Access Role"
+ labelClass="text-xs font-medium uppercase tracking-wide text-muted"
+ fieldBaseClass="space-y-1"
+ value={props.state.accessRole()}
+ onChange={(event) =>
+ props.state.setAccessRole(event.currentTarget.value as ShareAccessRole)
+ }
+ selectBaseClass="w-full rounded-md border border-border bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
+ >
+ <For each={ORGANIZATION_SHARE_ROLE_OPTIONS}>
+ {(option) => <option value={option.value}>{option.label}</option>}
+ </For>
+ </FormSelect>
</div>
<Show when={props.state.unifiedResourceOptions().length > 0}>
<div class="rounded-md border border-blue-200 bg-blue-50 p-3 space-y-2 dark:border-blue-900 dark:bg-blue-900">
- <label class="space-y-1 block">
- <span class="text-xs font-medium uppercase tracking-wide text-blue-700 dark:text-blue-300">
- Quick Pick Resource
- </span>
- <select
- value={props.state.selectedQuickPick()}
- onChange={(event) => props.state.applyResourceQuickPick(event.currentTarget.value)}
- class="w-full rounded-md border border-blue-300 bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:border-blue-700"
- >
- <option value="">Select resource</option>
- <For each={props.state.unifiedResourceOptions()}>
- {(resource) => (
- <option value={`${resource.type}::${resource.id}`}>
- {resource.name} ({resource.type})
- </option>
- )}
- </For>
- </select>
- </label>
+ <FormSelect
+ label="Quick Pick Resource"
+ labelClass="text-xs font-medium uppercase tracking-wide text-blue-700 dark:text-blue-300"
+ fieldBaseClass="space-y-1 block"
+ value={props.state.selectedQuickPick()}
+ onChange={(event) => props.state.applyResourceQuickPick(event.currentTarget.value)}
+ selectBaseClass="w-full rounded-md border border-blue-300 bg-surface px-3 py-2 text-sm text-base-content shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:border-blue-700"
+ >
+ <option value="">Select resource</option>
+ <For each={props.state.unifiedResourceOptions()}>
+ {(resource) => (
+ <option value={`${resource.type}::${resource.id}`}>
+ {resource.name} ({resource.type})
+ </option>
+ )}
+ </For>
+ </FormSelect>
<div class="flex flex-col items-start gap-2 sm:flex-row sm:items-center sm:justify-between">
<p class="text-xs text-blue-700 dark:text-blue-300">
Choose a discovered resource, or switch to manual entry.
diff --git a/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx b/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx
index 6540f94f8d..2790bc295e 100644
--- a/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx
+++ b/frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx
@@ -1,5 +1,6 @@
import { Component, Show, For, Accessor, Setter } from 'solid-js';
import SettingsPanel from '@/components/shared/SettingsPanel';
+import { FormSelect } from '@/components/shared/FormSelect';
import { SectionHeader } from '@/components/shared/SectionHeader';
import {
BACKUP_INTERVAL_MAX_MINUTES,
@@ -37,365 +38,187 @@ export const RecoverySettingsPanel: Component<RecoverySettingsPanelProps> = (pro
noPadding
bodyClass="divide-y divide-border"
>
- {/* Backup Polling Section */}
- <div class="p-4 sm:p-6">
- <section class="space-y-3">
- <h4 class="flex items-center gap-2 text-sm font-medium text-base-content">
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor">
- <circle cx="12" cy="12" r="9" stroke-width="2" />
- <path
- d="M12 7v5l3 3"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- />
- </svg>
- Backup polling
- </h4>
- <p class="text-xs text-muted">
- Control how often Pulse queries Proxmox backup tasks, datastore contents, and guest
- snapshots. Longer intervals reduce disk activity and API load.
- </p>
+ {/* Backup Polling Section */}
+ <div class="p-4 sm:p-6">
+ <section class="space-y-3">
+ <h4 class="flex items-center gap-2 text-sm font-medium text-base-content">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor">
+ <circle cx="12" cy="12" r="9" stroke-width="2" />
+ <path
+ d="M12 7v5l3 3"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ </svg>
+ Backup polling
+ </h4>
+ <p class="text-xs text-muted">
+ Control how often Pulse queries Proxmox backup tasks, datastore contents, and guest
+ snapshots. Longer intervals reduce disk activity and API load.
+ </p>
- <div class="space-y-3">
- {/* Enable toggle */}
- <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
- <div>
- <p class="text-sm font-medium text-base-content">Enable backup polling</p>
- <p class="text-xs text-muted">
- Required for dashboard backup status, storage snapshots, and alerting.
- </p>
- </div>
- <label class="relative inline-flex items-center cursor-pointer">
- <input
- type="checkbox"
- class="sr-only peer"
- checked={props.backupPollingEnabled()}
- disabled={props.backupPollingEnvLocked()}
- onChange={(e) => {
- props.setBackupPollingEnabled(e.currentTarget.checked);
- if (!props.backupPollingEnvLocked()) {
- props.setHasUnsavedChanges(true);
- }
- }}
- />
- <div class="w-11 h-6 bg-surface-alt peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 peer-disabled:opacity-50"></div>
- </label>
+ <div class="space-y-3">
+ {/* Enable toggle */}
+ <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <div>
+ <p class="text-sm font-medium text-base-content">Enable backup polling</p>
+ <p class="text-xs text-muted">
+ Required for dashboard backup status, storage snapshots, and alerting.
+ </p>
</div>
+ <label class="relative inline-flex items-center cursor-pointer">
+ <input
+ type="checkbox"
+ class="sr-only peer"
+ checked={props.backupPollingEnabled()}
+ disabled={props.backupPollingEnvLocked()}
+ onChange={(e) => {
+ props.setBackupPollingEnabled(e.currentTarget.checked);
+ if (!props.backupPollingEnvLocked()) {
+ props.setHasUnsavedChanges(true);
+ }
+ }}
+ />
+ <div class="w-11 h-6 bg-surface-alt peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 peer-disabled:opacity-50"></div>
+ </label>
+ </div>
- {/* Polling interval options */}
- <Show when={props.backupPollingEnabled()}>
- <div class="space-y-3 rounded-md border border-border p-3">
- <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
- <div>
- <label class="text-sm font-medium text-base-content">Polling interval</label>
- <p class="text-xs text-muted">{props.backupIntervalSummary()}</p>
- </div>
- <select
- value={props.backupIntervalSelectValue()}
- disabled={props.backupPollingEnvLocked()}
- onChange={(e) => {
- const value = e.currentTarget.value;
- if (value === 'custom') {
- props.setBackupPollingUseCustom(true);
- const minutes = Math.max(1, props.backupPollingCustomMinutes());
- props.setBackupPollingInterval(minutes * 60);
- } else {
- props.setBackupPollingUseCustom(false);
- const seconds = parseInt(value, 10);
- if (!Number.isNaN(seconds)) {
- props.setBackupPollingInterval(seconds);
- if (seconds > 0) {
- props.setBackupPollingCustomMinutes(
- Math.max(1, Math.round(seconds / 60)),
- );
- }
- }
- }
- if (!props.backupPollingEnvLocked()) {
- props.setHasUnsavedChanges(true);
+ {/* Polling interval options */}
+ <Show when={props.backupPollingEnabled()}>
+ <div class="space-y-3 rounded-md border border-border p-3">
+ <FormSelect
+ id="recovery-backup-polling-interval"
+ label={
+ <span>
+ <span class="block text-sm font-medium text-base-content">
+ Polling interval
+ </span>
+ <span aria-hidden="true" class="block text-xs font-normal text-muted">
+ {props.backupIntervalSummary()}
+ </span>
+ </span>
+ }
+ value={props.backupIntervalSelectValue()}
+ disabled={props.backupPollingEnvLocked()}
+ onChange={(e) => {
+ const value = e.currentTarget.value;
+ if (value === 'custom') {
+ props.setBackupPollingUseCustom(true);
+ const minutes = Math.max(1, props.backupPollingCustomMinutes());
+ props.setBackupPollingInterval(minutes * 60);
+ } else {
+ props.setBackupPollingUseCustom(false);
+ const seconds = parseInt(value, 10);
+ if (!Number.isNaN(seconds)) {
+ props.setBackupPollingInterval(seconds);
+ if (seconds > 0) {
+ props.setBackupPollingCustomMinutes(
+ Math.max(1, Math.round(seconds / 60)),
+ );
}
- }}
- class="w-full sm:w-auto min-h-10 sm:min-h-9 px-3 py-2.5 text-sm border border-border rounded-md bg-surface disabled:opacity-50"
- >
- <For each={BACKUP_INTERVAL_OPTIONS}>
- {(option) => <option value={String(option.value)}>{option.label}</option>}
- </For>
- <option value="custom">Custom interval...</option>
- </select>
- </div>
+ }
+ }
+ if (!props.backupPollingEnvLocked()) {
+ props.setHasUnsavedChanges(true);
+ }
+ }}
+ fieldBaseClass="flex"
+ fieldClass="flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"
+ selectBaseClass="w-full sm:w-auto min-h-10 sm:min-h-9 px-3 py-2.5 text-sm border border-border rounded-md bg-surface disabled:opacity-50"
+ >
+ <For each={BACKUP_INTERVAL_OPTIONS}>
+ {(option) => <option value={String(option.value)}>{option.label}</option>}
+ </For>
+ <option value="custom">Custom interval...</option>
+ </FormSelect>
- {/* Custom interval input */}
- <Show when={props.backupIntervalSelectValue() === 'custom'}>
- <div class="space-y-2">
- <label class="text-xs font-medium text-base-content">
- Custom interval (minutes)
- </label>
- <div class="flex flex-col sm:flex-row sm:items-center gap-3">
- <input
- type="number"
- min="1"
- max={BACKUP_INTERVAL_MAX_MINUTES}
- value={props.backupPollingCustomMinutes()}
- disabled={props.backupPollingEnvLocked()}
- onInput={(e) => {
- const value = Number(e.currentTarget.value);
- if (Number.isNaN(value)) {
- return;
- }
- const clamped = Math.max(
- 1,
- Math.min(BACKUP_INTERVAL_MAX_MINUTES, Math.floor(value)),
- );
- props.setBackupPollingCustomMinutes(clamped);
- props.setBackupPollingInterval(clamped * 60);
- if (!props.backupPollingEnvLocked()) {
- props.setHasUnsavedChanges(true);
- }
- }}
- class="w-full sm:w-24 min-h-10 sm:min-h-9 px-3 py-2.5 text-sm border border-border rounded-md bg-surface disabled:opacity-50"
- />
- <span class="text-xs text-muted">
- 1 - {BACKUP_INTERVAL_MAX_MINUTES} minutes (~7 days max)
- </span>
- </div>
+ {/* Custom interval input */}
+ <Show when={props.backupIntervalSelectValue() === 'custom'}>
+ <div class="space-y-2">
+ <label class="text-xs font-medium text-base-content">
+ Custom interval (minutes)
+ </label>
+ <div class="flex flex-col sm:flex-row sm:items-center gap-3">
+ <input
+ type="number"
+ min="1"
+ max={BACKUP_INTERVAL_MAX_MINUTES}
+ value={props.backupPollingCustomMinutes()}
+ disabled={props.backupPollingEnvLocked()}
+ onInput={(e) => {
+ const value = Number(e.currentTarget.value);
+ if (Number.isNaN(value)) {
+ return;
+ }
+ const clamped = Math.max(
+ 1,
+ Math.min(BACKUP_INTERVAL_MAX_MINUTES, Math.floor(value)),
+ );
+ props.setBackupPollingCustomMinutes(clamped);
+ props.setBackupPollingInterval(clamped * 60);
+ if (!props.backupPollingEnvLocked()) {
+ props.setHasUnsavedChanges(true);
+ }
+ }}
+ class="w-full sm:w-24 min-h-10 sm:min-h-9 px-3 py-2.5 text-sm border border-border rounded-md bg-surface disabled:opacity-50"
+ />
+ <span class="text-xs text-muted">
+ 1 - {BACKUP_INTERVAL_MAX_MINUTES} minutes (~7 days max)
+ </span>
</div>
- </Show>
- </div>
- </Show>
-
- {/* Env override warning */}
- <Show when={props.backupPollingEnvLocked()}>
- <div class="flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 dark:border-amber-700 dark:bg-amber-900 p-3 text-xs text-amber-700 dark:text-amber-200">
- <svg
- class="w-4 h-4 flex-shrink-0 mt-0.5"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
- />
- </svg>
- <div>
- <p class="font-medium">Environment override detected</p>
- <p class="mt-1">
- The <code class="font-mono">ENABLE_BACKUP_POLLING</code> or{' '}
- <code class="font-mono">BACKUP_POLLING_INTERVAL</code> environment variables
- are set. Remove them and restart Pulse to manage backup polling here.
- </p>
</div>
- </div>
- </Show>
- </div>
- </section>
- </div>
-
- {/* Backup & Restore Section */}
- <div class="p-4 sm:p-6">
- <SectionHeader
- title="Backup & restore"
- description="Backup your node configurations and credentials or restore from a previous backup."
- size="md"
- class="mb-4"
- />
-
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
- {/* Export Section */}
- <div class="group border border-border rounded-md p-5 bg-blue-50 dark:bg-blue-900 hover:border-blue-300 dark:hover:border-blue-700 transition-all duration-200">
- <div class="flex items-start gap-4">
- <div class="flex-shrink-0 w-12 h-12 bg-blue-500 rounded-md flex items-center justify-center shadow-sm shadow-blue-500">
- {/* Archive/Download Box Icon */}
- <svg
- class="w-6 h-6 text-white"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- stroke-width="2"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"
- />
- </svg>
- </div>
- <div class="flex-1 min-w-0">
- <h4 class="text-base font-semibold text-base-content mb-1">
- Export Configuration
- </h4>
- <p class="text-sm text-muted mb-3">Create an encrypted backup package</p>
-
- {/* Feature list */}
- <ul class="space-y-1 mb-4">
- <li class="flex items-center gap-2 text-xs text-muted">
- <svg
- class="w-3.5 h-3.5 text-emerald-400"
- fill="currentColor"
- viewBox="0 0 20 20"
- >
- <path
- fill-rule="evenodd"
- d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
- clip-rule="evenodd"
- />
- </svg>
- <span>All node connections & credentials</span>
- </li>
- <li class="flex items-center gap-2 text-xs text-muted">
- <svg
- class="w-3.5 h-3.5 text-emerald-400"
- fill="currentColor"
- viewBox="0 0 20 20"
- >
- <path
- fill-rule="evenodd"
- d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
- clip-rule="evenodd"
- />
- </svg>
- <span>Alert thresholds & overrides</span>
- </li>
- <li class="flex items-center gap-2 text-xs text-muted">
- <svg
- class="w-3.5 h-3.5 text-emerald-400"
- fill="currentColor"
- viewBox="0 0 20 20"
- >
- <path
- fill-rule="evenodd"
- d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
- clip-rule="evenodd"
- />
- </svg>
- <span>AES-256 encryption</span>
- </li>
- </ul>
-
- <button
- type="button"
- onClick={() => {
- // Default to custom passphrase if no auth is configured
- props.setUseCustomPassphrase(!props.securityStatus()?.hasAuthentication);
- props.setShowExportDialog(true);
- }}
- class="w-full sm:w-auto min-h-10 sm:min-h-9 px-4 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 transition-all duration-200 inline-flex items-center justify-center gap-2 shadow-sm hover:shadow-sm"
- >
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
- />
- </svg>
- Create Backup
- </button>
- </div>
+ </Show>
</div>
- </div>
+ </Show>
- {/* Import Section */}
- <div class="group border border-border rounded-md p-5 bg-surface-alt hover:border-border transition-all duration-200">
- <div class="flex items-start gap-4">
- <div class="flex-shrink-0 w-12 h-12 bg-slate-500 rounded-md flex items-center justify-center shadow-sm shadow-gray-500">
- {/* Upload/Restore Icon */}
- <svg
- class="w-6 h-6 text-white"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
+ {/* Env override warning */}
+ <Show when={props.backupPollingEnvLocked()}>
+ <div class="flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 dark:border-amber-700 dark:bg-amber-900 p-3 text-xs text-amber-700 dark:text-amber-200">
+ <svg
+ class="w-4 h-4 flex-shrink-0 mt-0.5"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
stroke-width="2"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"
- />
- </svg>
- </div>
- <div class="flex-1 min-w-0">
- <h4 class="text-base font-semibold text-base-content mb-1">
- Restore Configuration
- </h4>
- <p class="text-sm text-muted mb-3">Import from an encrypted backup file</p>
-
- {/* Feature list */}
- <ul class="space-y-1 mb-4">
- <li class="flex items-center gap-2 text-xs text-muted">
- <svg
- class="w-3.5 h-3.5 text-blue-500"
- fill="currentColor"
- viewBox="0 0 20 20"
- >
- <path
- fill-rule="evenodd"
- d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
- clip-rule="evenodd"
- />
- </svg>
- <span>Merge or replace existing config</span>
- </li>
- <li class="flex items-center gap-2 text-xs text-muted">
- <svg
- class="w-3.5 h-3.5 text-blue-500"
- fill="currentColor"
- viewBox="0 0 20 20"
- >
- <path
- fill-rule="evenodd"
- d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
- clip-rule="evenodd"
- />
- </svg>
- <span>Validates backup before applying</span>
- </li>
- <li class="flex items-center gap-2 text-xs text-muted">
- <svg
- class="w-3.5 h-3.5 text-blue-500"
- fill="currentColor"
- viewBox="0 0 20 20"
- >
- <path
- fill-rule="evenodd"
- d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
- clip-rule="evenodd"
- />
- </svg>
- <span>Requires original passphrase</span>
- </li>
- </ul>
-
- <button
- type="button"
- onClick={() => props.setShowImportDialog(true)}
- class="w-full sm:w-auto min-h-10 sm:min-h-9 px-4 py-2.5 bg-slate-600 text-white text-sm font-medium rounded-md hover:bg-slate-700 transition-all duration-200 inline-flex items-center justify-center gap-2 shadow-sm hover:shadow-sm"
- >
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"
- />
- </svg>
- Restore Backup
- </button>
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
+ />
+ </svg>
+ <div>
+ <p class="font-medium">Environment override detected</p>
+ <p class="mt-1">
+ The <code class="font-mono">ENABLE_BACKUP_POLLING</code> or{' '}
+ <code class="font-mono">BACKUP_POLLING_INTERVAL</code> environment variables are
+ set. Remove them and restart Pulse to manage backup polling here.
+ </p>
</div>
</div>
- </div>
+ </Show>
</div>
+ </section>
+ </div>
- {/* Security Tips */}
- <div class="mt-6 p-4 bg-amber-50 dark:bg-amber-900 rounded-md border border-amber-200 dark:border-amber-800">
- <div class="flex gap-3">
- {/* Shield Icon */}
- <div class="flex-shrink-0 w-10 h-10 bg-amber-100 dark:bg-amber-900 rounded-md flex items-center justify-center">
+ {/* Backup & Restore Section */}
+ <div class="p-4 sm:p-6">
+ <SectionHeader
+ title="Backup & restore"
+ description="Backup your node configurations and credentials or restore from a previous backup."
+ size="md"
+ class="mb-4"
+ />
+
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
+ {/* Export Section */}
+ <div class="group border border-border rounded-md p-5 bg-blue-50 dark:bg-blue-900 hover:border-blue-300 dark:hover:border-blue-700 transition-all duration-200">
+ <div class="flex items-start gap-4">
+ <div class="flex-shrink-0 w-12 h-12 bg-blue-500 rounded-md flex items-center justify-center shadow-sm shadow-blue-500">
+ {/* Archive/Download Box Icon */}
<svg
- class="w-5 h-5 text-amber-600 dark:text-amber-400"
+ class="w-6 h-6 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@@ -404,60 +227,231 @@ export const RecoverySettingsPanel: Component<RecoverySettingsPanelProps> = (pro
<path
stroke-linecap="round"
stroke-linejoin="round"
- d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"
+ d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"
/>
</svg>
</div>
- <div class="flex-1">
- <p class="text-sm font-medium text-amber-800 dark:text-amber-200 mb-2">
- Security Tips
- </p>
- <ul class="space-y-2">
- <li class="flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300">
+ <div class="flex-1 min-w-0">
+ <h4 class="text-base font-semibold text-base-content mb-1">Export Configuration</h4>
+ <p class="text-sm text-muted mb-3">Create an encrypted backup package</p>
+
+ {/* Feature list */}
+ <ul class="space-y-1 mb-4">
+ <li class="flex items-center gap-2 text-xs text-muted">
<svg
- class="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
+ class="w-3.5 h-3.5 text-emerald-400"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
fill-rule="evenodd"
- d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd"
/>
</svg>
- <span>Recovery exports contain encrypted credentials and sensitive data</span>
+ <span>All node connections & credentials</span>
</li>
- <li class="flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300">
+ <li class="flex items-center gap-2 text-xs text-muted">
<svg
- class="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
+ class="w-3.5 h-3.5 text-emerald-400"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
fill-rule="evenodd"
- d="M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z"
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd"
/>
</svg>
- <span>
- Use a strong passphrase (12+ characters, mix of letters, numbers, symbols)
- </span>
+ <span>Alert thresholds & overrides</span>
</li>
- <li class="flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300">
+ <li class="flex items-center gap-2 text-xs text-muted">
<svg
- class="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
+ class="w-3.5 h-3.5 text-emerald-400"
fill="currentColor"
viewBox="0 0 20 20"
>
- <path d="M10 2a5 5 0 00-5 5v2a2 2 0 00-2 2v5a2 2 0 002 2h10a2 2 0 002-2v-5a2 2 0 00-2-2V7a5 5 0 00-5-5zm3 7V7a3 3 0 10-6 0v2h6z" />
+ <path
+ fill-rule="evenodd"
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
+ clip-rule="evenodd"
+ />
</svg>
- <span>Store backup files securely and never share the passphrase</span>
+ <span>AES-256 encryption</span>
</li>
</ul>
+
+ <button
+ type="button"
+ onClick={() => {
+ // Default to custom passphrase if no auth is configured
+ props.setUseCustomPassphrase(!props.securityStatus()?.hasAuthentication);
+ props.setShowExportDialog(true);
+ }}
+ class="w-full sm:w-auto min-h-10 sm:min-h-9 px-4 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 transition-all duration-200 inline-flex items-center justify-center gap-2 shadow-sm hover:shadow-sm"
+ >
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
+ />
+ </svg>
+ Create Backup
+ </button>
</div>
</div>
</div>
+
+ {/* Import Section */}
+ <div class="group border border-border rounded-md p-5 bg-surface-alt hover:border-border transition-all duration-200">
+ <div class="flex items-start gap-4">
+ <div class="flex-shrink-0 w-12 h-12 bg-slate-500 rounded-md flex items-center justify-center shadow-sm shadow-gray-500">
+ {/* Upload/Restore Icon */}
+ <svg
+ class="w-6 h-6 text-white"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ stroke-width="2"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"
+ />
+ </svg>
+ </div>
+ <div class="flex-1 min-w-0">
+ <h4 class="text-base font-semibold text-base-content mb-1">
+ Restore Configuration
+ </h4>
+ <p class="text-sm text-muted mb-3">Import from an encrypted backup file</p>
+
+ {/* Feature list */}
+ <ul class="space-y-1 mb-4">
+ <li class="flex items-center gap-2 text-xs text-muted">
+ <svg class="w-3.5 h-3.5 text-blue-500" fill="currentColor" viewBox="0 0 20 20">
+ <path
+ fill-rule="evenodd"
+ d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ <span>Merge or replace existing config</span>
+ </li>
+ <li class="flex items-center gap-2 text-xs text-muted">
+ <svg class="w-3.5 h-3.5 text-blue-500" fill="currentColor" viewBox="0 0 20 20">
+ <path
+ fill-rule="evenodd"
+ d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ <span>Validates backup before applying</span>
+ </li>
+ <li class="flex items-center gap-2 text-xs text-muted">
+ <svg class="w-3.5 h-3.5 text-blue-500" fill="currentColor" viewBox="0 0 20 20">
+ <path
+ fill-rule="evenodd"
+ d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ <span>Requires original passphrase</span>
+ </li>
+ </ul>
+
+ <button
+ type="button"
+ onClick={() => props.setShowImportDialog(true)}
+ class="w-full sm:w-auto min-h-10 sm:min-h-9 px-4 py-2.5 bg-slate-600 text-white text-sm font-medium rounded-md hover:bg-slate-700 transition-all duration-200 inline-flex items-center justify-center gap-2 shadow-sm hover:shadow-sm"
+ >
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"
+ />
+ </svg>
+ Restore Backup
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ {/* Security Tips */}
+ <div class="mt-6 p-4 bg-amber-50 dark:bg-amber-900 rounded-md border border-amber-200 dark:border-amber-800">
+ <div class="flex gap-3">
+ {/* Shield Icon */}
+ <div class="flex-shrink-0 w-10 h-10 bg-amber-100 dark:bg-amber-900 rounded-md flex items-center justify-center">
+ <svg
+ class="w-5 h-5 text-amber-600 dark:text-amber-400"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ stroke-width="2"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"
+ />
+ </svg>
+ </div>
+ <div class="flex-1">
+ <p class="text-sm font-medium text-amber-800 dark:text-amber-200 mb-2">
+ Security Tips
+ </p>
+ <ul class="space-y-2">
+ <li class="flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300">
+ <svg
+ class="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ <span>Recovery exports contain encrypted credentials and sensitive data</span>
+ </li>
+ <li class="flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300">
+ <svg
+ class="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ >
+ <path
+ fill-rule="evenodd"
+ d="M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z"
+ clip-rule="evenodd"
+ />
+ </svg>
+ <span>
+ Use a strong passphrase (12+ characters, mix of letters, numbers, symbols)
+ </span>
+ </li>
+ <li class="flex items-start gap-2 text-xs text-amber-700 dark:text-amber-300">
+ <svg
+ class="w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ >
+ <path d="M10 2a5 5 0 00-5 5v2a2 2 0 00-2 2v5a2 2 0 002 2h10a2 2 0 002-2v-5a2 2 0 00-2-2V7a5 5 0 00-5-5zm3 7V7a3 3 0 10-6 0v2h6z" />
+ </svg>
+ <span>Store backup files securely and never share the passphrase</span>
+ </li>
+ </ul>
+ </div>
+ </div>
</div>
+ </div>
</SettingsPanel>
);
};
diff --git a/frontend-modern/src/components/Settings/RolesEditorDialog.tsx b/frontend-modern/src/components/Settings/RolesEditorDialog.tsx
index 39344d3f08..92a5514169 100644
--- a/frontend-modern/src/components/Settings/RolesEditorDialog.tsx
+++ b/frontend-modern/src/components/Settings/RolesEditorDialog.tsx
@@ -1,5 +1,6 @@
import { Component, For, Show } from 'solid-js';
import { Dialog } from '@/components/shared/Dialog';
+import { FormSelect } from '@/components/shared/FormSelect';
import type { Permission, Role } from '@/types/rbac';
import { RBAC_PERMISSION_ACTIONS, RBAC_PERMISSION_RESOURCES } from '@/utils/rbacPermissions';
import Plus from 'lucide-solid/icons/plus';
@@ -98,29 +99,35 @@ export const RolesEditorDialog: Component<RolesEditorDialogProps> = (props) => (
<For each={props.formPermissions}>
{(permission, index) => (
<div class="flex flex-col sm:flex-row sm:items-center gap-2">
- <select
+ <FormSelect
+ label={`Permission ${index() + 1} action`}
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={permission.action}
onChange={(event) =>
props.onUpdatePermission(index(), 'action', event.currentTarget.value)
}
- class="w-full sm:flex-1 rounded-md border border-border bg-surface px-2 py-1.5 text-sm text-base-content"
+ selectBaseClass="w-full sm:flex-1 rounded-md border border-border bg-surface px-2 py-1.5 text-sm text-base-content"
>
<For each={RBAC_PERMISSION_ACTIONS}>
{(action) => <option value={action}>{action}</option>}
</For>
- </select>
+ </FormSelect>
<span class="hidden sm:inline text-slate-400 text-sm">:</span>
- <select
+ <FormSelect
+ label={`Permission ${index() + 1} resource`}
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={permission.resource}
onChange={(event) =>
props.onUpdatePermission(index(), 'resource', event.currentTarget.value)
}
- class="w-full sm:flex-1 rounded-md border bg-surface px-2 py-1.5 text-sm text-base-content"
+ selectBaseClass="w-full sm:flex-1 rounded-md border bg-surface px-2 py-1.5 text-sm text-base-content"
>
<For each={RBAC_PERMISSION_RESOURCES}>
{(resource) => <option value={resource}>{resource}</option>}
</For>
- </select>
+ </FormSelect>
<button
type="button"
onClick={() => props.onRemovePermission(index())}
diff --git a/frontend-modern/src/components/Settings/SystemLogsPanel.tsx b/frontend-modern/src/components/Settings/SystemLogsPanel.tsx
index e46a4df5f2..fc72867f6b 100644
--- a/frontend-modern/src/components/Settings/SystemLogsPanel.tsx
+++ b/frontend-modern/src/components/Settings/SystemLogsPanel.tsx
@@ -12,6 +12,7 @@ import Pause from 'lucide-solid/icons/pause';
import Play from 'lucide-solid/icons/play';
import Trash2 from 'lucide-solid/icons/trash-2';
import Terminal from 'lucide-solid/icons/terminal';
+import { FormSelect } from '@/components/shared/FormSelect';
import { useSystemLogsPanelState } from './useSystemLogsPanelState';
export const SystemLogsPanel: Component = () => {
@@ -28,20 +29,20 @@ export const SystemLogsPanel: Component = () => {
{/* Controls */}
<div class="p-4 sm:p-6">
<div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
- <div class="flex items-center space-x-3">
- <label class="text-sm font-medium text-base-content">
- {SYSTEM_LOGS_PANEL_COPY.levelLabel}
- </label>
- <select
- value={state.level()}
- onChange={(e) => void state.handleLevelChange(e.currentTarget.value)}
- class="form-select min-h-10 sm:min-h-9 text-sm py-2.5 px-3 rounded-md border-border bg-surface text-muted focus:ring-primary-500 focus:border-primary-500"
- >
- <For each={SYSTEM_LOG_LEVEL_OPTIONS}>
- {(option) => <option value={option.value}>{option.label}</option>}
- </For>
- </select>
- </div>
+ <FormSelect
+ id="system-log-level-select"
+ label={SYSTEM_LOGS_PANEL_COPY.levelLabel}
+ value={state.level()}
+ onChange={(e) => void state.handleLevelChange(e.currentTarget.value)}
+ fieldBaseClass="flex"
+ fieldClass="items-center space-x-3"
+ labelClass="text-sm font-medium text-base-content"
+ selectBaseClass="form-select min-h-10 sm:min-h-9 text-sm py-2.5 px-3 rounded-md border-border bg-surface text-muted focus:ring-primary-500 focus:border-primary-500"
+ >
+ <For each={SYSTEM_LOG_LEVEL_OPTIONS}>
+ {(option) => <option value={option.value}>{option.label}</option>}
+ </For>
+ </FormSelect>
<div class="flex items-center space-x-2">
<button
diff --git a/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx b/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx
index caf640a7aa..5f42480f1f 100644
--- a/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx
+++ b/frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx
@@ -1,5 +1,6 @@
import { Component, Show, For, Accessor, Setter } from 'solid-js';
import SettingsPanel from '@/components/shared/SettingsPanel';
+import { FormSelect } from '@/components/shared/FormSelect';
import { HelpIcon } from '@/components/shared/HelpIcon';
import {
SelectionCardGroup,
@@ -93,282 +94,276 @@ export const UpdatesSettingsPanel: Component<UpdatesSettingsPanelProps> = (props
noPadding
bodyClass="divide-y divide-border"
>
- <div class="p-4 sm:p-6">
- <div class="space-y-4">
- {/* Version Status Section */}
- <div class="rounded-md border border-border overflow-hidden">
- {/* Version Grid */}
- <div
- class={`grid gap-px ${props.updateInfo()?.available ? 'sm:grid-cols-3' : 'sm:grid-cols-2'}`}
- >
- {/* Current Version */}
- <div class="bg-surface-alt p-4">
- <div class="flex items-start gap-3">
- <div class="p-2 bg-blue-100 dark:bg-blue-900 rounded-md">
- <Package class="w-5 h-5 text-blue-600 dark:text-blue-400" />
- </div>
- <div class="flex-1 min-w-0">
- <p class="text-xs font-medium uppercase tracking-wide text-muted">
- {UPDATES_PANEL_COPY.currentVersionLabel}
- </p>
- <p class="mt-1 text-lg font-bold text-base-content truncate">
- {props.versionInfo()?.version || 'Loading...'}
- </p>
- <div class="mt-1.5 flex flex-wrap items-center gap-1.5">
- <For each={getUpdateBuildBadges(props.versionInfo())}>
- {(badge) => <span class={badge.className}>{badge.label}</span>}
- </For>
- </div>
+ <div class="p-4 sm:p-6">
+ <div class="space-y-4">
+ {/* Version Status Section */}
+ <div class="rounded-md border border-border overflow-hidden">
+ {/* Version Grid */}
+ <div
+ class={`grid gap-px ${props.updateInfo()?.available ? 'sm:grid-cols-3' : 'sm:grid-cols-2'}`}
+ >
+ {/* Current Version */}
+ <div class="bg-surface-alt p-4">
+ <div class="flex items-start gap-3">
+ <div class="p-2 bg-blue-100 dark:bg-blue-900 rounded-md">
+ <Package class="w-5 h-5 text-blue-600 dark:text-blue-400" />
+ </div>
+ <div class="flex-1 min-w-0">
+ <p class="text-xs font-medium uppercase tracking-wide text-muted">
+ {UPDATES_PANEL_COPY.currentVersionLabel}
+ </p>
+ <p class="mt-1 text-lg font-bold text-base-content truncate">
+ {props.versionInfo()?.version || 'Loading...'}
+ </p>
+ <div class="mt-1.5 flex flex-wrap items-center gap-1.5">
+ <For each={getUpdateBuildBadges(props.versionInfo())}>
+ {(badge) => <span class={badge.className}>{badge.label}</span>}
+ </For>
</div>
</div>
</div>
+ </div>
- {/* Update Status / Arrow */}
- <Show when={props.updateInfo()?.available}>
- <div class="bg-green-50 dark:bg-green-900 p-4 flex items-center justify-center">
- <div class="flex flex-col items-center gap-1.5">
- <div class="flex items-center gap-2 text-green-600 dark:text-green-400">
- <ArrowRight class="w-5 h-5" />
- </div>
- <span class="text-xs font-semibold text-green-700 dark:text-green-300 uppercase tracking-wide">
- {getUpdatePrimaryStatusLabel(true)}
- </span>
+ {/* Update Status / Arrow */}
+ <Show when={props.updateInfo()?.available}>
+ <div class="bg-green-50 dark:bg-green-900 p-4 flex items-center justify-center">
+ <div class="flex flex-col items-center gap-1.5">
+ <div class="flex items-center gap-2 text-green-600 dark:text-green-400">
+ <ArrowRight class="w-5 h-5" />
</div>
+ <span class="text-xs font-semibold text-green-700 dark:text-green-300 uppercase tracking-wide">
+ {getUpdatePrimaryStatusLabel(true)}
+ </span>
</div>
- </Show>
+ </div>
+ </Show>
- {/* Latest Version / Status */}
- <div
- class={`p-4 ${
- props.updateInfo()?.available
- ? 'bg-green-50 dark:bg-green-900'
- : 'bg-surface-alt'
- }`}
- >
- <div class="flex items-start gap-3">
- <div
- class={`p-2 rounded-md ${
- props.updateInfo()?.available
- ? 'bg-green-100 dark:bg-green-800'
- : 'bg-surface-hover'
- }`}
+ {/* Latest Version / Status */}
+ <div
+ class={`p-4 ${
+ props.updateInfo()?.available ? 'bg-green-50 dark:bg-green-900' : 'bg-surface-alt'
+ }`}
+ >
+ <div class="flex items-start gap-3">
+ <div
+ class={`p-2 rounded-md ${
+ props.updateInfo()?.available
+ ? 'bg-green-100 dark:bg-green-800'
+ : 'bg-surface-hover'
+ }`}
+ >
+ <Show
+ when={props.updateInfo()?.available}
+ fallback={<CheckCircle class="w-5 h-5 text-muted" />}
>
- <Show
- when={props.updateInfo()?.available}
- fallback={<CheckCircle class="w-5 h-5 text-muted" />}
- >
- <CheckCircle class="w-5 h-5 text-green-600 dark:text-green-400" />
- </Show>
- </div>
- <div class="flex-1 min-w-0">
- <p class="text-xs font-medium uppercase tracking-wide text-muted">
- {getUpdateAvailabilityHeading(Boolean(props.updateInfo()?.available))}
+ <CheckCircle class="w-5 h-5 text-green-600 dark:text-green-400" />
+ </Show>
+ </div>
+ <div class="flex-1 min-w-0">
+ <p class="text-xs font-medium uppercase tracking-wide text-muted">
+ {getUpdateAvailabilityHeading(Boolean(props.updateInfo()?.available))}
+ </p>
+ <Show
+ when={props.updateInfo()?.available}
+ fallback={
+ <p class="mt-1 text-lg font-bold text-base-content">
+ {getUpdatePrimaryStatusLabel(false)}
+ </p>
+ }
+ >
+ <p class="mt-1 text-lg font-bold text-green-700 dark:text-green-300">
+ {props.updateInfo()?.latestVersion}
</p>
- <Show
- when={props.updateInfo()?.available}
- fallback={
- <p class="mt-1 text-lg font-bold text-base-content">
- {getUpdatePrimaryStatusLabel(false)}
- </p>
- }
- >
- <p class="mt-1 text-lg font-bold text-green-700 dark:text-green-300">
- {props.updateInfo()?.latestVersion}
+ <Show when={props.updateInfo()?.releaseDate}>
+ <p class="mt-0.5 text-xs text-green-600 dark:text-green-400">
+ Released {new Date(props.updateInfo()!.releaseDate).toLocaleDateString()}
</p>
- <Show when={props.updateInfo()?.releaseDate}>
- <p class="mt-0.5 text-xs text-green-600 dark:text-green-400">
- Released{' '}
- {new Date(props.updateInfo()!.releaseDate).toLocaleDateString()}
- </p>
- </Show>
</Show>
- </div>
+ </Show>
</div>
</div>
</div>
-
- {/* Check for updates button */}
- <div class="bg-surface border-t border-border px-4 py-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
- <p class="text-xs text-muted">{getUpdateCheckModeLabel(props.autoUpdateEnabled())}</p>
- <button
- type="button"
- onClick={props.checkForUpdates}
- disabled={props.checkingForUpdates() || props.versionInfo()?.isSourceBuild}
- class={`self-end sm:self-auto min-h-10 sm:min-h-9 px-4 py-2.5 text-sm rounded-md transition-colors flex items-center gap-2 ${
- props.versionInfo()?.isSourceBuild
- ? 'bg-surface-hover text-muted cursor-not-allowed'
- : 'bg-blue-600 text-white hover:bg-blue-700'
- }`}
- >
- {props.checkingForUpdates() ? (
- <>
- <div class="animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full"></div>
- {getUpdateCheckActionLabel(true)}
- </>
- ) : (
- <>
- <RefreshCw class="w-4 h-4" />
- {getUpdateCheckActionLabel(false)}
- </>
- )}
- </button>
- </div>
</div>
- <UpdateInstallGuide
- versionInfo={props.versionInfo()}
- updateInfo={props.updateInfo()}
- updatePlan={props.updatePlan()}
- isInstalling={props.isInstalling()}
- dockerImageTag={dockerImageTag()}
- systemdDownloadCommand={systemdDownloadCommand()}
- onInstallUpdate={props.onInstallUpdate}
- />
+ {/* Check for updates button */}
+ <div class="bg-surface border-t border-border px-4 py-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
+ <p class="text-xs text-muted">{getUpdateCheckModeLabel(props.autoUpdateEnabled())}</p>
+ <button
+ type="button"
+ onClick={props.checkForUpdates}
+ disabled={props.checkingForUpdates() || props.versionInfo()?.isSourceBuild}
+ class={`self-end sm:self-auto min-h-10 sm:min-h-9 px-4 py-2.5 text-sm rounded-md transition-colors flex items-center gap-2 ${
+ props.versionInfo()?.isSourceBuild
+ ? 'bg-surface-hover text-muted cursor-not-allowed'
+ : 'bg-blue-600 text-white hover:bg-blue-700'
+ }`}
+ >
+ {props.checkingForUpdates() ? (
+ <>
+ <div class="animate-spin h-4 w-4 border-2 border-white border-t-transparent rounded-full"></div>
+ {getUpdateCheckActionLabel(true)}
+ </>
+ ) : (
+ <>
+ <RefreshCw class="w-4 h-4" />
+ {getUpdateCheckActionLabel(false)}
+ </>
+ )}
+ </button>
+ </div>
</div>
+
+ <UpdateInstallGuide
+ versionInfo={props.versionInfo()}
+ updateInfo={props.updateInfo()}
+ updatePlan={props.updatePlan()}
+ isInstalling={props.isInstalling()}
+ dockerImageTag={dockerImageTag()}
+ systemdDownloadCommand={systemdDownloadCommand()}
+ onInstallUpdate={props.onInstallUpdate}
+ />
</div>
+ </div>
- <div class="p-4 sm:p-6">
- <div class="space-y-5">
- <h4 class="flex items-center gap-2 text-sm font-medium text-base-content">
- <svg
- class="w-4 h-4"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- stroke-width="2"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
- />
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
- />
- </svg>
- {UPDATES_PANEL_COPY.updatePreferencesTitle}
- <HelpIcon contentId="updates.pulse.channel" size="xs" />
- </h4>
+ <div class="p-4 sm:p-6">
+ <div class="space-y-5">
+ <h4 class="flex items-center gap-2 text-sm font-medium text-base-content">
+ <svg
+ class="w-4 h-4"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ stroke-width="2"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
+ />
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
+ />
+ </svg>
+ {UPDATES_PANEL_COPY.updatePreferencesTitle}
+ <HelpIcon contentId="updates.pulse.channel" size="xs" />
+ </h4>
- {/* Update Channel */}
- <SelectionCardGroup
- class="sm:grid-cols-2"
- options={updateChannelOptions()}
- value={props.updateChannel()}
- onChange={(value) => {
- if (value === 'rc') {
- props.setAutoUpdateEnabled(false);
- }
- props.setUpdateChannel(value);
- props.setHasUnsavedChanges(true);
- }}
- variant="detail"
- />
+ {/* Update Channel */}
+ <SelectionCardGroup
+ class="sm:grid-cols-2"
+ options={updateChannelOptions()}
+ value={props.updateChannel()}
+ onChange={(value) => {
+ if (value === 'rc') {
+ props.setAutoUpdateEnabled(false);
+ }
+ props.setUpdateChannel(value);
+ props.setHasUnsavedChanges(true);
+ }}
+ variant="detail"
+ />
- <Show when={isPreviewChannel()}>
- <div class="rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100">
- <p class="font-medium">{UPDATES_PANEL_COPY.previewChannelTitle}</p>
- <p class="mt-1 text-xs text-amber-800 dark:text-amber-200">
- {UPDATES_PANEL_COPY.previewChannelDescription}
- </p>
+ <Show when={isPreviewChannel()}>
+ <div class="rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100">
+ <p class="font-medium">{UPDATES_PANEL_COPY.previewChannelTitle}</p>
+ <p class="mt-1 text-xs text-amber-800 dark:text-amber-200">
+ {UPDATES_PANEL_COPY.previewChannelDescription}
+ </p>
+ </div>
+ </Show>
+
+ {/* Auto Update Toggle */}
+ <div class="p-4 rounded-md border border-border bg-surface-alt">
+ <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
+ <div class="flex items-center gap-3">
+ <div class="p-2 bg-blue-100 dark:bg-blue-900 rounded-md">
+ <svg
+ class="w-5 h-5 text-blue-600 dark:text-blue-400"
+ fill="none"
+ viewBox="0 0 24 24"
+ stroke="currentColor"
+ stroke-width="2"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
+ />
+ </svg>
+ </div>
+ <div>
+ <label class="text-sm font-medium text-base-content">
+ {UPDATES_PANEL_COPY.autoUpdateTitle}
+ </label>
+ <p class="text-xs text-muted">{UPDATES_PANEL_COPY.autoUpdateDescription}</p>
+ </div>
</div>
+ <label class="relative inline-flex items-center cursor-pointer">
+ <input
+ type="checkbox"
+ data-testid="updates-auto-check-toggle"
+ checked={props.autoUpdateEnabled()}
+ onChange={(e) => {
+ props.setAutoUpdateEnabled(e.currentTarget.checked);
+ props.setHasUnsavedChanges(true);
+ }}
+ disabled={autoUpdateLocked()}
+ class="sr-only peer"
+ />
+ <div class="w-11 h-6 bg-surface-alt peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 peer-disabled:opacity-50"></div>
+ </label>
+ </div>
+
+ <Show when={isPreviewChannel()}>
+ <p class="mt-3 text-xs text-amber-700 dark:text-amber-300">
+ {UPDATES_PANEL_COPY.previewChannelAutoUpdateNotice}
+ </p>
</Show>
- {/* Auto Update Toggle */}
- <div class="p-4 rounded-md border border-border bg-surface-alt">
- <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <div class="flex items-center gap-3">
- <div class="p-2 bg-blue-100 dark:bg-blue-900 rounded-md">
- <svg
- class="w-5 h-5 text-blue-600 dark:text-blue-400"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- stroke-width="2"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
- />
- </svg>
- </div>
- <div>
- <label class="text-sm font-medium text-base-content">
- {UPDATES_PANEL_COPY.autoUpdateTitle}
- </label>
- <p class="text-xs text-muted">
- {UPDATES_PANEL_COPY.autoUpdateDescription}
- </p>
- </div>
- </div>
- <label class="relative inline-flex items-center cursor-pointer">
+ {/* Auto update options (shown when enabled) */}
+ <Show when={props.autoUpdateEnabled() && !isPreviewChannel()}>
+ <div class="mt-4 pt-4 border-t border-border grid grid-cols-1 sm:grid-cols-2 gap-4">
+ {/* Check Interval */}
+ <FormSelect
+ id="updates-auto-check-interval"
+ label={UPDATES_PANEL_COPY.checkIntervalLabel}
+ value={props.autoUpdateCheckInterval()}
+ onChange={(e) => {
+ props.setAutoUpdateCheckInterval(parseInt(e.currentTarget.value));
+ props.setHasUnsavedChanges(true);
+ }}
+ fieldClass="space-y-2"
+ labelClass="text-xs font-medium text-base-content"
+ selectBaseClass="w-full px-3 py-2 text-sm border border-border rounded-md bg-surface"
+ >
+ <option value="6">Every 6 hours</option>
+ <option value="12">Every 12 hours</option>
+ <option value="24">Daily</option>
+ <option value="168">Weekly</option>
+ </FormSelect>
+
+ {/* Check Time */}
+ <div class="space-y-2">
+ <label class="text-xs font-medium text-base-content">
+ {UPDATES_PANEL_COPY.preferredTimeLabel}
+ </label>
<input
- type="checkbox"
- data-testid="updates-auto-check-toggle"
- checked={props.autoUpdateEnabled()}
+ type="time"
+ value={props.autoUpdateTime()}
onChange={(e) => {
- props.setAutoUpdateEnabled(e.currentTarget.checked);
+ props.setAutoUpdateTime(e.currentTarget.value);
props.setHasUnsavedChanges(true);
}}
- disabled={autoUpdateLocked()}
- class="sr-only peer"
+ class="w-full px-3 py-2 text-sm border border-border rounded-md bg-surface"
/>
- <div class="w-11 h-6 bg-surface-alt peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600 peer-disabled:opacity-50"></div>
- </label>
- </div>
-
- <Show when={isPreviewChannel()}>
- <p class="mt-3 text-xs text-amber-700 dark:text-amber-300">
- {UPDATES_PANEL_COPY.previewChannelAutoUpdateNotice}
- </p>
- </Show>
-
- {/* Auto update options (shown when enabled) */}
- <Show when={props.autoUpdateEnabled() && !isPreviewChannel()}>
- <div class="mt-4 pt-4 border-t border-border grid grid-cols-1 sm:grid-cols-2 gap-4">
- {/* Check Interval */}
- <div class="space-y-2">
- <label class="text-xs font-medium text-base-content">
- {UPDATES_PANEL_COPY.checkIntervalLabel}
- </label>
- <select
- value={props.autoUpdateCheckInterval()}
- onChange={(e) => {
- props.setAutoUpdateCheckInterval(parseInt(e.currentTarget.value));
- props.setHasUnsavedChanges(true);
- }}
- class="w-full px-3 py-2 text-sm border border-border rounded-md bg-surface"
- >
- <option value="6">Every 6 hours</option>
- <option value="12">Every 12 hours</option>
- <option value="24">Daily</option>
- <option value="168">Weekly</option>
- </select>
- </div>
-
- {/* Check Time */}
- <div class="space-y-2">
- <label class="text-xs font-medium text-base-content">
- {UPDATES_PANEL_COPY.preferredTimeLabel}
- </label>
- <input
- type="time"
- value={props.autoUpdateTime()}
- onChange={(e) => {
- props.setAutoUpdateTime(e.currentTarget.value);
- props.setHasUnsavedChanges(true);
- }}
- class="w-full px-3 py-2 text-sm border border-border rounded-md bg-surface"
- />
- </div>
</div>
- </Show>
- </div>
+ </div>
+ </Show>
</div>
</div>
+ </div>
</SettingsPanel>
);
};
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index fd36b1568f..5f264d1327 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -3,6 +3,7 @@ import settingsSource from '../Settings.tsx?raw';
import settingsDialogsSource from '../SettingsDialogs.tsx?raw';
import settingsPageShellSource from '../SettingsPageShell.tsx?raw';
import aiSettingsDialogsSource from '../AISettingsDialogs.tsx?raw';
+import aiChatMaintenanceSectionSource from '../AIChatMaintenanceSection.tsx?raw';
import aiModelSelectionSectionSource from '../AIModelSelectionSection.tsx?raw';
import aiRuntimeControlsSectionSource from '../AIRuntimeControlsSection.tsx?raw';
import aiSettingsModelSource from '../aiSettingsModel.ts?raw';
@@ -16,7 +17,12 @@ import dataHandlingPanelSource from '../DataHandlingPanel.tsx?raw';
import auditLogPanelSource from '../AuditLogPanel.tsx?raw';
import auditWebhookPanelSource from '../AuditWebhookPanel.tsx?raw';
import reportingPanelSource from '../ReportingPanel.tsx?raw';
+import recoverySettingsPanelSource from '../RecoverySettingsPanel.tsx?raw';
+import systemLogsPanelSource from '../SystemLogsPanel.tsx?raw';
+import updatesSettingsPanelSource from '../UpdatesSettingsPanel.tsx?raw';
+import agentProfilesPanelSource from '../AgentProfilesPanel.tsx?raw';
import infrastructureWorkspaceSource from '../InfrastructureWorkspace.tsx?raw';
+import infrastructureInstallerSectionSource from '../InfrastructureInstallerSection.tsx?raw';
import infrastructureSourceManagerSource from '../InfrastructureSourceManager.tsx?raw';
import infrastructureSourcePickerSource from '../InfrastructureSourcePicker.tsx?raw';
import infrastructureWorkspaceModelSource from '../infrastructureWorkspaceModel.ts?raw';
@@ -27,11 +33,16 @@ import addressProbeStepSource from '../ConnectionEditor/AddressProbeStep.tsx?raw
import connectionEditorStateSource from '../ConnectionEditor/useConnectionEditor.ts?raw';
import nodeCredentialSlotSource from '../ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx?raw';
import nodeModalAuthenticationSectionSource from '../NodeModalAuthenticationSection.tsx?raw';
+import nodeModalMonitoringSectionSource from '../NodeModalMonitoringSection.tsx?raw';
import nodeModalSetupGuideSectionSource from '../NodeModalSetupGuideSection.tsx?raw';
import nodeModalStatusFooterSource from '../NodeModalStatusFooter.tsx?raw';
import nodeModalStateSource from '../useNodeModalState.ts?raw';
import trueNASCredentialSlotSource from '../ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx?raw';
import vmwareCredentialSlotSource from '../ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx?raw';
+import organizationAccessManagementSectionSource from '../OrganizationAccessManagementSection.tsx?raw';
+import organizationAccessMembersSectionSource from '../OrganizationAccessMembersSection.tsx?raw';
+import organizationSharingCreateSectionSource from '../OrganizationSharingCreateSection.tsx?raw';
+import rolesEditorDialogSource from '../RolesEditorDialog.tsx?raw';
import diagnosticsResultsPanelSource from '../DiagnosticsResultsPanel.tsx?raw';
import diagnosticsModelSource from '../diagnosticsModel.ts?raw';
import infrastructureOnboardingPresentationSource from '../../../utils/infrastructureOnboardingPresentation.ts?raw';
@@ -39,6 +50,12 @@ import selfHostedBillingPresentationSource from '../selfHostedBillingPresentatio
import systemSettingsPresentationSource from '../../../utils/systemSettingsPresentation.ts?raw';
import auditLogPresentationSource from '../../../utils/auditLogPresentation.ts?raw';
+const settingsRuntimeSources = import.meta.glob(['../*.tsx', '../ConnectionEditor/**/*.tsx'], {
+ query: '?raw',
+ eager: true,
+ import: 'default',
+}) as Record<string, string>;
+
describe('settings architecture guardrails', () => {
it('keeps Settings on the canonical page shell boundary', () => {
expect(settingsSource).toContain("import { SettingsDialogs } from './SettingsDialogs';");
@@ -185,6 +202,35 @@ describe('settings architecture guardrails', () => {
);
});
+ it('keeps settings native select controls on the shared labelled primitive', () => {
+ const rawSelectUsers = Object.entries(settingsRuntimeSources)
+ .filter(([, source]) => source.includes('<select'))
+ .map(([path]) => path)
+ .sort();
+
+ expect(rawSelectUsers).toEqual([]);
+
+ for (const source of [
+ aiChatMaintenanceSectionSource,
+ aiRuntimeControlsSectionSource,
+ auditLogPanelSource,
+ recoverySettingsPanelSource,
+ systemLogsPanelSource,
+ updatesSettingsPanelSource,
+ agentProfilesPanelSource,
+ infrastructureInstallerSectionSource,
+ nodeModalMonitoringSectionSource,
+ trueNASCredentialSlotSource,
+ organizationAccessManagementSectionSource,
+ organizationAccessMembersSectionSource,
+ organizationSharingCreateSectionSource,
+ rolesEditorDialogSource,
+ ]) {
+ expect(source).toContain("import { FormSelect } from '@/components/shared/FormSelect';");
+ expect(source).toContain('<FormSelect');
+ }
+ });
+
it('keeps system AI model catalogs on the shared searchable picker boundary', () => {
expect(aiModelSelectionSectionSource).toContain(
"import { AIModelPicker } from '@/components/shared/AIModelPicker';",
diff --git a/frontend-modern/src/components/Storage/DiskDetail.tsx b/frontend-modern/src/components/Storage/DiskDetail.tsx
index 80c1d802ef..d93dadb572 100644
--- a/frontend-modern/src/components/Storage/DiskDetail.tsx
+++ b/frontend-modern/src/components/Storage/DiskDetail.tsx
@@ -1,5 +1,6 @@
import { Component, For, Show } from 'solid-js';
import type { Resource } from '@/types/resource';
+import { FormSelect } from '@/components/shared/FormSelect';
import { HistoryChart } from '@/components/shared/HistoryChart';
import type { HistoryTimeRange } from '@/api/charts';
import {
@@ -59,12 +60,8 @@ export const DiskDetail: Component<DiskDetailProps> = (props) => {
{/* Header: Info & Selector */}
<div class={STORAGE_DISK_DETAIL_HEADER_CLASS}>
<div class={STORAGE_DETAIL_META_ROW_CLASS}>
- <span class={STORAGE_DISK_DETAIL_MODEL_CLASS}>
- {diskData().model || 'Unknown Disk'}
- </span>
- <span class={STORAGE_DETAIL_MONO_CHIP_CLASS}>
- {diskData().devPath}
- </span>
+ <span class={STORAGE_DISK_DETAIL_MODEL_CLASS}>{diskData().model || 'Unknown Disk'}</span>
+ <span class={STORAGE_DETAIL_MONO_CHIP_CLASS}>{diskData().devPath}</span>
<span class={STORAGE_DISK_DETAIL_NODE_CLASS}>{diskData().node}</span>
<Show when={diskData().serial}>
<span class={STORAGE_DISK_DETAIL_SERIAL_CLASS}>S/N: {diskData().serial}</span>
@@ -75,16 +72,19 @@ export const DiskDetail: Component<DiskDetailProps> = (props) => {
<div class={STORAGE_DISK_DETAIL_HISTORY_CONTROL_CLASS}>
<span class={STORAGE_DETAIL_INLINE_LABEL_CLASS}>History:</span>
<div class={STORAGE_DISK_DETAIL_HISTORY_SELECT_WRAP_CLASS}>
- <select
+ <FormSelect
+ label="Disk history range"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={chartRange()}
onChange={(e) => setChartRange(e.currentTarget.value as HistoryTimeRange)}
- class={STORAGE_DETAIL_HEADER_SELECT_CLASS}
+ selectBaseClass={STORAGE_DETAIL_HEADER_SELECT_CLASS}
style={STORAGE_DETAIL_HEADER_SELECT_STYLE}
>
<For each={DISK_DETAIL_HISTORY_RANGE_OPTIONS}>
{(option) => <option value={option.value}>{option.label}</option>}
</For>
- </select>
+ </FormSelect>
</div>
</div>
</div>
@@ -107,11 +107,11 @@ export const DiskDetail: Component<DiskDetailProps> = (props) => {
{/* Live Performance Sparklines */}
<Show when={metricResourceId()}>
<div class={STORAGE_DISK_DETAIL_SECTION_CLASS}>
- <h4 class={`${STORAGE_DETAIL_SECTION_TITLE_CLASS} ${STORAGE_DISK_DETAIL_SECTION_HEADING_CLASS}`}>
+ <h4
+ class={`${STORAGE_DETAIL_SECTION_TITLE_CLASS} ${STORAGE_DISK_DETAIL_SECTION_HEADING_CLASS}`}
+ >
Live I/O (30m)
- <span class={STORAGE_DETAIL_BADGE_CLASS}>
- {getDiskDetailLiveBadgeLabel()}
- </span>
+ <span class={STORAGE_DETAIL_BADGE_CLASS}>{getDiskDetailLiveBadgeLabel()}</span>
</h4>
<div class={STORAGE_DISK_DETAIL_LIVE_GRID_CLASS}>
<For each={DISK_DETAIL_LIVE_CHARTS}>
@@ -146,9 +146,7 @@ export const DiskDetail: Component<DiskDetailProps> = (props) => {
<Show
when={historyResourceId()}
fallback={
- <div class={STORAGE_DETAIL_EMPTY_CLASS}>
- {getDiskDetailHistoryFallbackMessage()}
- </div>
+ <div class={STORAGE_DETAIL_EMPTY_CLASS}>{getDiskDetailHistoryFallbackMessage()}</div>
}
>
<div class={STORAGE_DISK_DETAIL_SECTION_CLASS}>
diff --git a/frontend-modern/src/components/Storage/StoragePoolDetail.tsx b/frontend-modern/src/components/Storage/StoragePoolDetail.tsx
index 0243342292..6cf4908e14 100644
--- a/frontend-modern/src/components/Storage/StoragePoolDetail.tsx
+++ b/frontend-modern/src/components/Storage/StoragePoolDetail.tsx
@@ -1,4 +1,5 @@
import { Component, For, Show } from 'solid-js';
+import { FormSelect } from '@/components/shared/FormSelect';
import { HistoryChart } from '@/components/shared/HistoryChart';
import type { HistoryTimeRange } from '@/api/charts';
import {
@@ -56,16 +57,19 @@ export const StoragePoolDetail: Component<StoragePoolDetailProps> = (props) => {
<div class={STORAGE_DETAIL_CARD_CLASS}>
<div class={STORAGE_DETAIL_HEADER_ROW_CLASS}>
<h4 class={STORAGE_DETAIL_SECTION_TITLE_CLASS}>Capacity Trend</h4>
- <select
+ <FormSelect
+ label="Capacity trend range"
+ labelClass="sr-only"
+ fieldBaseClass="contents"
value={chartRange()}
onChange={(e) => setChartRange(e.currentTarget.value as HistoryTimeRange)}
- class={STORAGE_DETAIL_SELECT_CLASS}
+ selectBaseClass={STORAGE_DETAIL_SELECT_CLASS}
style={STORAGE_DETAIL_SELECT_STYLE}
>
<For each={STORAGE_POOL_DETAIL_HISTORY_RANGE_OPTIONS}>
{(option) => <option value={option.value}>{option.label}</option>}
</For>
- </select>
+ </FormSelect>
</div>
<HistoryChart
resourceType={chartTarget().resourceType}
diff --git a/frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx b/frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx
index 7af14a4af8..2c4447f04f 100644
--- a/frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/StoragePoolDetail.test.tsx
@@ -7,7 +7,12 @@ import type { Resource } from '@/types/resource';
const historyChartSpy = vi.fn();
vi.mock('@/components/shared/HistoryChart', () => ({
- HistoryChart: (props: { resourceType: string; resourceId: string; metric: string; range?: string }) => {
+ HistoryChart: (props: {
+ resourceType: string;
+ resourceId: string;
+ metric: string;
+ range?: string;
+ }) => {
historyChartSpy(props);
return (
<div data-testid="history-chart">
@@ -82,7 +87,9 @@ describe('StoragePoolDetail', () => {
</table>
));
- const rangeSelector = screen.getByRole('combobox') as HTMLSelectElement;
+ const rangeSelector = screen.getByRole('combobox', {
+ name: 'Capacity trend range',
+ }) as HTMLSelectElement;
expect(Array.from(rangeSelector.options).map((option) => option.value)).toEqual([
'24h',
'7d',
diff --git a/frontend-modern/src/components/shared/FormSelect.test.tsx b/frontend-modern/src/components/shared/FormSelect.test.tsx
new file mode 100644
index 0000000000..02412113f9
--- /dev/null
+++ b/frontend-modern/src/components/shared/FormSelect.test.tsx
@@ -0,0 +1,63 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it } from 'vitest';
+import { FormSelect } from './FormSelect';
+
+describe('FormSelect', () => {
+ afterEach(() => {
+ cleanup();
+ });
+
+ it('owns the label relationship for native selects', () => {
+ render(() => (
+ <FormSelect label="Delivery mode" value="cli" data-testid="delivery-mode">
+ <option value="cli">Local CLI</option>
+ <option value="http">Remote API</option>
+ </FormSelect>
+ ));
+
+ expect(screen.getByLabelText('Delivery mode')).toBe(screen.getByTestId('delivery-mode'));
+ });
+
+ it('preserves explicit ids and compact styling hooks', () => {
+ render(() => (
+ <FormSelect
+ id="log-level"
+ label="Log level"
+ value="debug"
+ fieldBaseClass="flex"
+ fieldClass="flex-row"
+ labelClass="text-xs"
+ selectClass="w-auto"
+ >
+ <option value="debug">Debug</option>
+ </FormSelect>
+ ));
+
+ const select = screen.getByLabelText('Log level');
+ expect(select).toHaveAttribute('id', 'log-level');
+ expect(select).toHaveClass('w-auto');
+ });
+
+ it('connects helper text without dropping an existing description', () => {
+ render(() => (
+ <>
+ <p id="external-help">External help</p>
+ <FormSelect
+ id="provider"
+ label="Provider"
+ value="local"
+ aria-describedby="external-help"
+ help="Choose the provider this feature should use."
+ >
+ <option value="local">Local</option>
+ </FormSelect>
+ </>
+ ));
+
+ const select = screen.getByLabelText('Provider');
+ expect(select).toHaveAccessibleDescription(
+ 'External help Choose the provider this feature should use.',
+ );
+ expect(select).toHaveAttribute('aria-describedby', 'external-help provider-help');
+ });
+});
diff --git a/frontend-modern/src/components/shared/FormSelect.tsx b/frontend-modern/src/components/shared/FormSelect.tsx
new file mode 100644
index 0000000000..9befba9a6b
--- /dev/null
+++ b/frontend-modern/src/components/shared/FormSelect.tsx
@@ -0,0 +1,71 @@
+import { Show, createUniqueId, splitProps } from 'solid-js';
+import type { Component, JSX } from 'solid-js';
+import { formField, formHelpText, formLabel, formSelect } from '@/components/shared/Form';
+
+interface FormSelectProps extends JSX.SelectHTMLAttributes<HTMLSelectElement> {
+ label: JSX.Element;
+ children: JSX.Element;
+ fieldBaseClass?: string;
+ fieldClass?: string;
+ labelClass?: string;
+ selectBaseClass?: string;
+ selectClass?: string;
+ help?: JSX.Element;
+ helpClass?: string;
+}
+
+const joinClass = (...parts: Array<string | undefined>) => parts.filter(Boolean).join(' ');
+
+export const FormSelect: Component<FormSelectProps> = (props) => {
+ const [local, selectProps] = splitProps(props, [
+ 'children',
+ 'fieldBaseClass',
+ 'fieldClass',
+ 'help',
+ 'helpClass',
+ 'id',
+ 'label',
+ 'labelClass',
+ 'aria-describedby',
+ 'class',
+ 'selectBaseClass',
+ 'selectClass',
+ ]);
+ const generatedId = `form-select-${createUniqueId()}`;
+ const selectId = () => (typeof local.id === 'string' && local.id ? local.id : generatedId);
+ const helpId = () => `${selectId()}-help`;
+ const describedBy = () => {
+ const existing = local['aria-describedby'];
+ const ids = [
+ typeof existing === 'string' ? existing : undefined,
+ local.help ? helpId() : undefined,
+ ]
+ .filter(Boolean)
+ .join(' ');
+
+ return ids || undefined;
+ };
+
+ return (
+ <div class={joinClass(local.fieldBaseClass ?? formField, local.fieldClass)}>
+ <label for={selectId()} class={joinClass(formLabel, local.labelClass)}>
+ {local.label}
+ </label>
+ <select
+ {...selectProps}
+ id={selectId()}
+ aria-describedby={describedBy()}
+ class={joinClass(local.selectBaseClass ?? formSelect, local.class, local.selectClass)}
+ >
+ {local.children}
+ </select>
+ <Show when={local.help}>
+ {(help) => (
+ <p id={helpId()} class={joinClass(formHelpText, local.helpClass)}>
+ {help()}
+ </p>
+ )}
+ </Show>
+ </div>
+ );
+};
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 1d150aa0b6..a90f60a6e8 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -20,6 +20,7 @@ import dialogModelSource from '@/components/shared/dialogModel.ts?raw';
import filterButtonGroupSource from '@/components/shared/FilterButtonGroup.tsx?raw';
import filterButtonGroupModelSource from '@/components/shared/filterButtonGroupModel.ts?raw';
import filterOptionPresentationSource from '@/components/shared/filterOptionPresentation.ts?raw';
+import formSelectSource from '@/components/shared/FormSelect.tsx?raw';
import helpIconSource from '@/components/shared/HelpIcon.tsx?raw';
import helpIconModelSource from '@/components/shared/helpIconModel.ts?raw';
import historyChartHeaderSource from '@/components/shared/HistoryChartHeader.tsx?raw';
@@ -204,6 +205,20 @@ describe('shared primitive guardrails', () => {
expect(reportingPanelSource).not.toContain('<For each={REPORTING_RANGE_OPTIONS}>');
});
+ it('keeps native form selects on the shared labelled primitive', () => {
+ expect(formSelectSource).toContain("from '@/components/shared/Form'");
+ expect(formSelectSource).toContain('createUniqueId');
+ expect(formSelectSource).toContain('splitProps');
+ expect(formSelectSource).toContain('interface FormSelectProps');
+ expect(formSelectSource).toContain('label: JSX.Element');
+ expect(formSelectSource).toContain('<label for={selectId()}');
+ expect(formSelectSource).toContain('<select');
+ expect(formSelectSource).toContain('id={selectId()}');
+ expect(formSelectSource).toContain('aria-describedby={describedBy()}');
+ expect(formSelectSource).toContain('local.selectBaseClass ?? formSelect');
+ expect(formSelectSource).toContain('local.fieldBaseClass ?? formField');
+ });
+
it('routes selectable settings cards through SelectionCardGroup', () => {
expect(selectionCardGroupSource).toContain('useSelectionCardGroupState');
expect(selectionCardGroupSource).toContain('getSelectionCardGroupClass');
diff --git a/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx b/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx
index 4f3b94df71..d73952fcfd 100644
--- a/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx
@@ -3,12 +3,8 @@ import { Show } from 'solid-js';
import { SettingsPanel } from '@/components/shared/SettingsPanel';
import { TlsVerificationWarningBanner } from '@/components/shared/TlsVerificationWarningBanner';
import { Toggle } from '@/components/shared/Toggle';
-import {
- formControl,
- formField,
- formHelpText,
- labelClass,
-} from '@/components/shared/Form';
+import { formControl, formField, formHelpText, labelClass } from '@/components/shared/Form';
+import { FormSelect } from '@/components/shared/FormSelect';
import type { UIAppriseConfig } from './types';
import {
ALERT_DESTINATIONS_APPRISE_API_KEY_HEADER_HELP,
@@ -84,23 +80,21 @@ export function AlertAppriseDestinationsSection(props: AlertAppriseDestinationsS
bodyClass="space-y-4"
>
<div class="space-y-4">
- <div class={formField}>
- <label class={labelClass('text-xs uppercase tracking-[0.08em]')}>
- {ALERT_DESTINATIONS_APPRISE_MODE_LABEL}
- </label>
- <select
- class={formControl}
- value={props.config.mode}
- onInput={(event) => {
- props.updateApprise({ mode: event.currentTarget.value as 'cli' | 'http' });
- props.setHasUnsavedChanges(true);
- }}
- >
- <option value="cli">{ALERT_DESTINATIONS_APPRISE_MODE_CLI_LABEL}</option>
- <option value="http">{ALERT_DESTINATIONS_APPRISE_MODE_HTTP_LABEL}</option>
- </select>
- <p class={formHelpText}>{ALERT_DESTINATIONS_APPRISE_MODE_HELP}</p>
- </div>
+ <FormSelect
+ id="alert-apprise-delivery-mode"
+ label={ALERT_DESTINATIONS_APPRISE_MODE_LABEL}
+ labelClass="text-xs uppercase tracking-[0.08em]"
+ value={props.config.mode}
+ onInput={(event) => {
+ props.updateApprise({ mode: event.currentTarget.value as 'cli' | 'http' });
+ props.setHasUnsavedChanges(true);
+ }}
+ selectBaseClass={formControl}
+ help={ALERT_DESTINATIONS_APPRISE_MODE_HELP}
+ >
+ <option value="cli">{ALERT_DESTINATIONS_APPRISE_MODE_CLI_LABEL}</option>
+ <option value="http">{ALERT_DESTINATIONS_APPRISE_MODE_HTTP_LABEL}</option>
+ </FormSelect>
<div class={formField}>
<label class={labelClass('text-xs uppercase tracking-[0.08em]')}>
diff --git a/frontend-modern/src/features/alerts/AlertEscalationSection.tsx b/frontend-modern/src/features/alerts/AlertEscalationSection.tsx
index 0a7aa4e930..83bd7fc189 100644
--- a/frontend-modern/src/features/alerts/AlertEscalationSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertEscalationSection.tsx
@@ -1,6 +1,7 @@
import { For, Show } from 'solid-js';
import { controlClass, formHelpText } from '@/components/shared/Form';
+import { FormSelect } from '@/components/shared/FormSelect';
import { SettingsPanel } from '@/components/shared/SettingsPanel';
import { Toggle } from '@/components/shared/Toggle';
import {
@@ -62,34 +63,34 @@ export function AlertEscalationSection(props: AlertEscalationSectionProps) {
min="5"
max="180"
value={level.after}
- onChange={(event) => props.setEscalationAfter(index(), event.currentTarget.value)}
- class={`${controlClass('px-2 py-1 text-sm')} w-20`}
- />
- <span class="text-xs text-muted">
- {ALERT_CONFIG_ESCALATION_MINUTES_SUFFIX}
- </span>
- </div>
- <div class="flex items-center gap-2">
- <span class="text-xs font-medium text-muted">
- {ALERT_CONFIG_ESCALATION_NOTIFY_LABEL}
- </span>
- <select
- value={level.notify}
onChange={(event) =>
- props.setEscalationNotify(
- index(),
- event.currentTarget.value as EscalationNotifyTarget,
- )
+ props.setEscalationAfter(index(), event.currentTarget.value)
}
- class={`${controlClass('px-2 py-1 text-sm')} flex-1`}
- >
- <option value="email">{getAlertConfigEscalationNotifyLabel('email')}</option>
- <option value="webhook">
- {getAlertConfigEscalationNotifyLabel('webhook')}
- </option>
- <option value="all">{getAlertConfigEscalationNotifyLabel('all')}</option>
- </select>
+ class={`${controlClass('px-2 py-1 text-sm')} w-20`}
+ />
+ <span class="text-xs text-muted">{ALERT_CONFIG_ESCALATION_MINUTES_SUFFIX}</span>
</div>
+ <FormSelect
+ id={`alert-escalation-notify-${index()}`}
+ label={ALERT_CONFIG_ESCALATION_NOTIFY_LABEL}
+ value={level.notify}
+ onChange={(event) =>
+ props.setEscalationNotify(
+ index(),
+ event.currentTarget.value as EscalationNotifyTarget,
+ )
+ }
+ fieldBaseClass="flex"
+ fieldClass="items-center gap-2"
+ labelClass="text-xs font-medium text-muted"
+ selectBaseClass={`${controlClass('px-2 py-1 text-sm')} flex-1`}
+ >
+ <option value="email">{getAlertConfigEscalationNotifyLabel('email')}</option>
+ <option value="webhook">
+ {getAlertConfigEscalationNotifyLabel('webhook')}
+ </option>
+ <option value="all">{getAlertConfigEscalationNotifyLabel('all')}</option>
+ </FormSelect>
</div>
<button
type="button"
diff --git a/frontend-modern/src/features/alerts/AlertQuietHoursSection.tsx b/frontend-modern/src/features/alerts/AlertQuietHoursSection.tsx
index 3930ae4c29..2aeedf9135 100644
--- a/frontend-modern/src/features/alerts/AlertQuietHoursSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertQuietHoursSection.tsx
@@ -1,6 +1,7 @@
import { For, Show } from 'solid-js';
import { controlClass, formField, labelClass } from '@/components/shared/Form';
+import { FormSelect } from '@/components/shared/FormSelect';
import { SettingsPanel } from '@/components/shared/SettingsPanel';
import { Toggle } from '@/components/shared/Toggle';
import {
@@ -82,20 +83,18 @@ export function AlertQuietHoursSection(props: AlertQuietHoursSectionProps) {
class={controlClass('font-mono')}
/>
</div>
- <div class={formField}>
- <label class={labelClass('text-xs uppercase tracking-[0.08em]')}>
- {ALERT_CONFIG_QUIET_HOURS_TIMEZONE_LABEL}
- </label>
- <select
- value={props.quietHours.timezone}
- onChange={(event) => props.setQuietHoursTimezone(event.currentTarget.value)}
- class={controlClass('pr-8')}
- >
- <For each={ALERT_SCHEDULE_TIMEZONES}>
- {(timezone) => <option value={timezone}>{timezone}</option>}
- </For>
- </select>
- </div>
+ <FormSelect
+ id="alert-quiet-hours-timezone"
+ label={ALERT_CONFIG_QUIET_HOURS_TIMEZONE_LABEL}
+ labelClass="text-xs uppercase tracking-[0.08em]"
+ value={props.quietHours.timezone}
+ onChange={(event) => props.setQuietHoursTimezone(event.currentTarget.value)}
+ selectBaseClass={controlClass('pr-8')}
+ >
+ <For each={ALERT_SCHEDULE_TIMEZONES}>
+ {(timezone) => <option value={timezone}>{timezone}</option>}
+ </For>
+ </FormSelect>
</div>
<div>
@@ -133,9 +132,7 @@ export function AlertQuietHoursSection(props: AlertQuietHoursSectionProps) {
<For each={props.quietHourSuppressOptions}>
{(option) => (
<label
- class={getAlertQuietSuppressCardClass(
- props.quietHours.suppress[option.key],
- )}
+ class={getAlertQuietSuppressCardClass(props.quietHours.suppress[option.key])}
>
<input
type="checkbox"
@@ -158,11 +155,7 @@ export function AlertQuietHoursSection(props: AlertQuietHoursSectionProps) {
stroke="currentColor"
stroke-width="3"
>
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- d="M5 13l4 4L19 7"
- />
+ <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
</svg>
</Show>
</div>
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
index 439f983179..9ad783c336 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
@@ -8,6 +8,7 @@ import { PulsePatrolLogo } from '@/components/Brand/PulsePatrolLogo';
import { PageHeader } from '@/components/shared/PageHeader';
import { Toggle, TogglePrimitive } from '@/components/shared/Toggle';
import { CountdownTimer } from '@/components/patrol';
+import { FormSelect } from '@/components/shared/FormSelect';
import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
import { formatRelativeTime } from '@/utils/format';
import { groupModelsByProvider } from '@/utils/patrolFormat';
@@ -57,7 +58,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
<span>{headerMeta.title}</span>
</span>
}
- class="mb-3"
+ class="relative z-[200] mb-3"
actions={
<div class="flex flex-wrap items-center justify-end gap-3">
<Show when={recency().timestamp}>
@@ -126,7 +127,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
<span class="text-sm font-medium text-base-content">{runtimePresentation().label}</span>
</div>
- <div class="relative ml-auto" ref={state.setAdvancedSettingsRef}>
+ <div class="relative z-[120] ml-auto" ref={state.setAdvancedSettingsRef}>
<button
onClick={() => state.setShowAdvancedSettings(!state.showAdvancedSettings())}
disabled={!state.patrolEnabledLocal()}
@@ -137,7 +138,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
</button>
<Show when={state.showAdvancedSettings()}>
- <div class="absolute right-0 top-10 z-50 w-[340px] p-5 bg-surface rounded-md shadow-sm border border-border animate-slide-up transform origin-top-right">
+ <div class="fixed right-4 top-32 z-[9999] isolate w-[calc(100vw-2rem)] p-5 bg-surface rounded-md shadow-sm border border-border animate-slide-up transform origin-top-right sm:right-8 sm:top-[17.5rem] sm:w-[340px]">
<div class="flex items-center justify-between mb-5 pb-3 border-b border-border-subtle">
<h4 class="text-base font-semibold tracking-tight text-base-content">
Patrol Configuration
@@ -152,56 +153,52 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
<div class="space-y-6">
<div class="grid grid-cols-2 gap-4">
- <div class="space-y-1.5">
- <label class="text-xs font-semibold uppercase tracking-wider text-muted">
- Provider model
- </label>
- <select
- ref={state.setPatrolModelSelectRef}
- value={state.patrolModel()}
- onChange={(e) => state.handleModelChange(e.currentTarget.value)}
- disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}
- class="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"
- >
- <option value="">
- Default ({state.defaultModel().split(':').pop() || 'not set'})
+ <FormSelect
+ label="Provider model"
+ labelClass="text-xs font-semibold uppercase tracking-wider text-muted"
+ fieldClass="space-y-1.5"
+ ref={state.setPatrolModelSelectRef}
+ value={state.patrolModel()}
+ onChange={(e) => state.handleModelChange(e.currentTarget.value)}
+ disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}
+ selectBaseClass="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"
+ >
+ <option value="">
+ Default ({state.defaultModel().split(':').pop() || 'not set'})
+ </option>
+ <Show when={patrolModelStale()}>
+ <option value={state.patrolModel()} disabled>
+ {state.patrolModel().split(':').pop()} (unavailable)
</option>
- <Show when={patrolModelStale()}>
- <option value={state.patrolModel()} disabled>
- {state.patrolModel().split(':').pop()} (unavailable)
- </option>
- </Show>
- {Array.from(groupModelsByProvider(state.availableModels()).entries()).map(
- ([provider, models]) => (
- <optgroup label={provider.charAt(0).toUpperCase() + provider.slice(1)}>
- {models.map((model) => (
- <option value={model.id}>
- {model.name || model.id.split(':').pop()}
- </option>
- ))}
- </optgroup>
- ),
- )}
- </select>
- </div>
+ </Show>
+ {Array.from(groupModelsByProvider(state.availableModels()).entries()).map(
+ ([provider, models]) => (
+ <optgroup label={provider.charAt(0).toUpperCase() + provider.slice(1)}>
+ {models.map((model) => (
+ <option value={model.id}>
+ {model.name || model.id.split(':').pop()}
+ </option>
+ ))}
+ </optgroup>
+ ),
+ )}
+ </FormSelect>
- <div class="space-y-1.5">
- <label class="text-xs font-semibold uppercase tracking-wider text-muted">
- Run Every
- </label>
- <select
- value={state.patrolInterval()}
- onChange={(e) =>
- state.handleIntervalChange(parseInt(e.currentTarget.value, 10))
- }
- disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}
- class="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"
- >
- <For each={scheduleOptions()}>
- {(preset) => <option value={preset.value}>{preset.label}</option>}
- </For>
- </select>
- </div>
+ <FormSelect
+ label="Run Every"
+ labelClass="text-xs font-semibold uppercase tracking-wider text-muted"
+ fieldClass="space-y-1.5"
+ value={state.patrolInterval()}
+ onChange={(e) =>
+ state.handleIntervalChange(parseInt(e.currentTarget.value, 10))
+ }
+ disabled={state.isUpdatingSettings() || !state.patrolEnabledLocal()}
+ selectBaseClass="w-full text-sm bg-base border border-border rounded-md py-2 pl-3 pr-8 text-base-content focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:opacity-50"
+ >
+ <For each={scheduleOptions()}>
+ {(preset) => <option value={preset.value}>{preset.label}</option>}
+ </For>
+ </FormSelect>
</div>
<div class="space-y-2">
@@ -365,7 +362,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
<button
onClick={state.saveAdvancedSettings}
disabled={state.isSavingAdvanced()}
- class="w-full py-2.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md shadow-sm transition-all focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-70 flex items-center justify-center gap-2"
+ class="w-full py-2.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md shadow-sm transition-all focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-blue-300 disabled:hover:bg-blue-300 dark:disabled:bg-blue-900 flex items-center justify-center gap-2"
>
<Show when={state.isSavingAdvanced()}>
<div class="animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"></div>
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts
index 596ae5974e..e5a249b3ae 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts
@@ -5,9 +5,9 @@ import patrolIntelligenceHeaderSource from '../PatrolIntelligenceHeader.tsx?raw'
describe('patrol commercial boundary', () => {
it('suppresses patrol upgrade surfaces when upgrade prompts are hidden', () => {
expect(patrolIntelligenceBannersSource).toContain('presentationPolicyHidesUpgradePrompts');
- expect(patrolIntelligenceBannersSource).toContain(
- '!presentationPolicyHidesUpgradePrompts() && state.licenseRequired()',
- );
+ expect(patrolIntelligenceBannersSource).toContain('!presentationPolicyHidesUpgradePrompts()');
+ expect(patrolIntelligenceBannersSource).toContain('state.licenseRequired()');
+ expect(patrolIntelligenceBannersSource).toContain('!state.showBlockedBanner()');
expect(patrolIntelligenceHeaderSource).toContain('presentationPolicyHidesUpgradePrompts');
expect(patrolIntelligenceHeaderSource).toContain(
'!presentationPolicyHidesUpgradePrompts() && state.autoFixLocked()',
@@ -19,4 +19,13 @@ describe('patrol commercial boundary', () => {
'!presentationPolicyHidesUpgradePrompts() && isProLocked()',
);
});
+
+ it('keeps patrol configuration selects on the shared labelled primitive', () => {
+ expect(patrolIntelligenceHeaderSource).toContain(
+ "import { FormSelect } from '@/components/shared/FormSelect';",
+ );
+ expect(patrolIntelligenceHeaderSource).toContain('label="Provider model"');
+ expect(patrolIntelligenceHeaderSource).toContain('label="Run Every"');
+ expect(patrolIntelligenceHeaderSource).not.toContain('<select');
+ });
});
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 2e22c5e297..242b8e911d 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -806,9 +806,7 @@ describe('frontend resource type boundaries', () => {
'export const buildDashboardHostFilterConfig',
);
expect(dashboardWorkloadFilterConfigModelSource).toContain('getAllFilterOptionLabel');
- expect(dashboardWorkloadFilterConfigModelSource).toContain(
- 'DASHBOARD_WORKLOAD_TYPE_OPTIONS',
- );
+ expect(dashboardWorkloadFilterConfigModelSource).toContain('DASHBOARD_WORKLOAD_TYPE_OPTIONS');
expect(dashboardWorkloadFilterConfigModelSource).toContain(
'export const buildDashboardNamespaceFilterConfig',
);
@@ -1764,6 +1762,9 @@ describe('frontend resource type boundaries', () => {
expect(storagePoolDetailSource).toContain('STORAGE_DETAIL_CARD_CLASS');
expect(storagePoolDetailSource).toContain('useStoragePoolDetailModel');
expect(storagePoolDetailSource).toContain('STORAGE_POOL_DETAIL_HISTORY_RANGE_OPTIONS');
+ expect(storagePoolDetailSource).toContain('FormSelect');
+ expect(storagePoolDetailSource).toContain('label="Capacity trend range"');
+ expect(storagePoolDetailSource).not.toContain('<select');
expect(storagePoolDetailSource).not.toContain('const ConfigRow: Component');
expect(storagePoolDetailSource).not.toContain('const chartResourceType = createMemo');
expect(storagePoolDetailSource).not.toContain('const chartResourceId = createMemo');
@@ -1785,6 +1786,9 @@ describe('frontend resource type boundaries', () => {
expect(diskDetailSource).toContain('STORAGE_DETAIL_CARD_CLASS');
expect(diskDetailSource).toContain('STORAGE_DISK_DETAIL_HEADER_CLASS');
expect(diskDetailSource).toContain('useDiskDetailModel');
+ expect(diskDetailSource).toContain('FormSelect');
+ expect(diskDetailSource).toContain('label="Disk history range"');
+ expect(diskDetailSource).not.toContain('<select');
expect(diskDetailSource).not.toContain('const AttrCard: Component');
expect(diskDetailSource).not.toContain('function extractDiskData(');
expect(diskDetailSource).not.toContain('const getMetricResourceId = () => {');