Skip to content

Modern Docker Management, Designed for Everyone

fix: onboarding flow not using correct values

Kyle Mendellc75839c7d991
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 5d9804f5c..f830b62d5 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1046,5 +1046,9 @@
"max_retry_description": "Maximum number of restart attempts",
"containers_labels_description": "Enter metadata labels as key=value pairs, one per line",
"containers_creating": "Creating...",
- "containers_remove_files_label": "Remove project files from storage"
+ "containers_remove_files_label": "Remove project files from storage",
+ "general_settings_save_failed": "Failed to Save General Settings",
+ "common_continue": "Continue",
+ "security_settings_save_failed": "Failed to save security settings",
+ "common_skip": "Skip"
}
diff --git a/frontend/src/routes/onboarding/docker/+page.svelte b/frontend/src/routes/onboarding/docker/+page.svelte
index e1fe8ccf5..868d317c9 100644
--- a/frontend/src/routes/onboarding/docker/+page.svelte
+++ b/frontend/src/routes/onboarding/docker/+page.svelte
@@ -1,42 +1,63 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button';
import * as Card from '$lib/components/ui/card';
- import { Input } from '$lib/components/ui/input';
- import { Label } from '$lib/components/ui/label';
- import * as Select from '$lib/components/ui/select';
- import { Switch } from '$lib/components/ui/switch';
- import { settingsAPI } from '$lib/services/api';
+ import * as Alert from '$lib/components/ui/alert';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import ZapIcon from '@lucide/svelte/icons/zap';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
+ import { createForm } from '$lib/utils/form.utils';
+ import { z } from 'zod/v4';
+ import { m } from '$lib/paraglide/messages';
+ import { settingsAPI } from '$lib/services/api';
+ import settingsStore from '$lib/stores/config-store';
+ import type { Settings } from '$lib/types/settings.type';
let { data } = $props();
- let currentSettings = $state(data.settings);
+ let currentSettings = $state<Settings>(data.settings);
let isLoading = $state(false);
+ let pruneMode = $derived(currentSettings.dockerPruneMode);
+
+ const pruneModeOptions = [
+ { value: 'all', label: m.docker_prune_all(), description: m.docker_prune_all_description() },
+ { value: 'dangling', label: m.docker_prune_dangling(), description: m.docker_prune_dangling_description() }
+ ];
+
+ const pruneModeDescription = $derived(
+ pruneModeOptions.find((o) => o.value === pruneMode)?.description ?? m.docker_prune_mode_description()
+ );
- let dockerSettings = $state({
- stacksDirectory: 'data/projects',
- pollingEnabled: true,
- pollingInterval: '5'
+ const formSchema = z.object({
+ pollingEnabled: z.boolean(),
+ pollingInterval: z.number().int(),
+ autoUpdate: z.boolean(),
+ autoUpdateInterval: z.number().int(),
+ dockerPruneMode: z.enum(['all', 'dangling'])
});
+ let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
+
async function handleNext() {
+ const data = form.validate();
+ if (!data) return;
isLoading = true;
try {
- const currentSettings = await settingsAPI.getSettings();
- await settingsAPI.updateSettings({
+ const updated = {
...currentSettings,
- stacksDirectory: dockerSettings.stacksDirectory,
- pollingEnabled: dockerSettings.pollingEnabled,
- pollingInterval: parseInt(dockerSettings.pollingInterval),
+ ...data,
onboardingCompleted: false,
- onboardingSteps: {
- ...currentSettings.onboardingSteps,
- docker: true
- }
- });
+ onboardingSteps: { ...currentSettings.onboardingSteps, docker: true }
+ } as Partial<Settings>;
+
+ await settingsAPI.updateSettings(updated as any);
+ currentSettings = { ...(currentSettings as Settings), ...(updated as Settings) };
+ settingsStore.set(currentSettings);
+ settingsStore.reload();
goto('/onboarding/security');
} catch (error) {
@@ -54,54 +75,89 @@
<div class="space-y-6">
<div class="text-center">
<h2 class="text-2xl font-bold">Docker Configuration</h2>
- <p class="text-muted-foreground mt-2">Configure how Arcane connects to your Docker environment</p>
+ <p class="text-muted-foreground mt-2">Configure how Arcane checks Docker and auto-updates</p>
</div>
+ {#if $formInputs.autoUpdate.value && $formInputs.pollingEnabled.value}
+ <Alert.Root variant="warning">
+ <ZapIcon class="size-4" />
+ <Alert.Title>{m.docker_auto_update_alert_title()}</Alert.Title>
+ <Alert.Description>{m.docker_auto_update_alert_description()}</Alert.Description>
+ </Alert.Root>
+ {/if}
+
<div class="grid gap-6 md:grid-cols-2">
<Card.Root>
<Card.Header>
- <Card.Title>Basic Settings</Card.Title>
- <Card.Description>Configure the basic Docker connection settings</Card.Description>
+ <Card.Title>{m.docker_title()}</Card.Title>
+ <Card.Description>{m.docker_description()}</Card.Description>
</Card.Header>
- <Card.Content class="space-y-4">
- <div class="space-y-2">
- <Label for="project-directory">Project Directory</Label>
- <Input id="project-directory" bind:value={dockerSettings.stacksDirectory} placeholder="data/projects" />
- <p class="text-muted-foreground text-xs">Directory where Docker Compose files will be stored</p>
- </div>
+ <Card.Content class="space-y-6">
+ <SwitchWithLabel
+ id="pollingEnabled"
+ label={m.docker_enable_polling_label()}
+ description={m.docker_enable_polling_description()}
+ bind:checked={$formInputs.pollingEnabled.value}
+ />
+
+ {#if $formInputs.pollingEnabled.value}
+ <div class="space-y-4">
+ <FormInput
+ bind:input={$formInputs.pollingInterval}
+ type="number"
+ id="pollingInterval"
+ label={m.docker_polling_interval_label()}
+ placeholder={m.docker_polling_interval_placeholder()}
+ description={m.docker_polling_interval_description()}
+ />
+
+ {#if $formInputs.pollingInterval.value < 30}
+ <Alert.Root variant="warning">
+ <ZapIcon class="size-4" />
+ <Alert.Title>{m.docker_rate_limit_warning_title()}</Alert.Title>
+ <Alert.Description>{m.docker_rate_limit_warning_description()}</Alert.Description>
+ </Alert.Root>
+ {/if}
+
+ <SwitchWithLabel
+ id="autoUpdateSwitch"
+ label={m.docker_auto_update_label()}
+ description={m.docker_auto_update_description()}
+ bind:checked={$formInputs.autoUpdate.value}
+ />
+
+ {#if $formInputs.autoUpdate.value}
+ <FormInput
+ bind:input={$formInputs.autoUpdateInterval}
+ type="number"
+ id="autoUpdateInterval"
+ label={m.docker_auto_update_interval_label()}
+ placeholder={m.docker_auto_update_interval_placeholder()}
+ description={m.docker_auto_update_interval_description()}
+ />
+ {/if}
+ </div>
+ {/if}
</Card.Content>
</Card.Root>
<Card.Root>
<Card.Header>
- <Card.Title>Polling Settings</Card.Title>
- <Card.Description>Configure how often Arcane checks Docker for updates</Card.Description>
+ <Card.Title>{m.docker_prune_action_label()}</Card.Title>
+ <Card.Description>{pruneModeDescription}</Card.Description>
</Card.Header>
- <Card.Content class="space-y-4">
- <div class="flex items-center justify-between">
- <div class="space-y-0.5">
- <Label>Enable Polling</Label>
- <p class="text-muted-foreground text-xs">Automatically refresh container states</p>
- </div>
- <Switch bind:checked={dockerSettings.pollingEnabled} />
- </div>
-
- {#if dockerSettings.pollingEnabled}
- <div class="space-y-2">
- <Label for="polling-interval">Polling Interval (seconds)</Label>
- <Select.Root type="single" bind:value={dockerSettings.pollingInterval}>
- <Select.Trigger>
- {dockerSettings.pollingInterval}
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="5">5 seconds</Select.Item>
- <Select.Item value="10">10 seconds</Select.Item>
- <Select.Item value="30">30 seconds</Select.Item>
- <Select.Item value="60">1 minute</Select.Item>
- </Select.Content>
- </Select.Root>
- </div>
- {/if}
+ <Card.Content>
+ <SelectWithLabel
+ id="dockerPruneMode"
+ name="pruneMode"
+ bind:value={$formInputs.dockerPruneMode.value}
+ label={m.docker_prune_action_label()}
+ description={pruneModeDescription}
+ placeholder={m.docker_prune_placeholder()}
+ options={pruneModeOptions}
+ groupLabel={m.docker_prune_group_label()}
+ onValueChange={(v) => (pruneMode = v as 'all' | 'dangling')}
+ />
</Card.Content>
</Card.Root>
</div>
diff --git a/frontend/src/routes/onboarding/security/+page.svelte b/frontend/src/routes/onboarding/security/+page.svelte
index 6852cf8cf..6e8a70446 100644
--- a/frontend/src/routes/onboarding/security/+page.svelte
+++ b/frontend/src/routes/onboarding/security/+page.svelte
@@ -1,29 +1,24 @@
<script lang="ts">
import type { PageData } from './$types';
- import * as Card from '$lib/components/ui/card';
import { Button } from '$lib/components/ui/button';
- import { Input } from '$lib/components/ui/input';
- import { Switch } from '$lib/components/ui/switch';
- import { Label } from '$lib/components/ui/label';
- import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
- import LockIcon from '@lucide/svelte/icons/lock';
- import KeyIcon from '@lucide/svelte/icons/key';
- import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
- import InfoIcon from '@lucide/svelte/icons/info';
+ import * as FieldSet from '$lib/components/ui/field-set';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import * as Tooltip from '$lib/components/ui/tooltip';
import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
- import { invalidateAll } from '$app/navigation';
import { settingsAPI } from '$lib/services/api';
- import settingsStore from '$lib/stores/config-store';
- import type { Settings } from '$lib/types/settings.type';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import { z } from 'zod/v4';
+ import { m } from '$lib/paraglide/messages';
let { data }: { data: PageData } = $props();
-
let currentSettings = $state(data.settings);
-
- // OIDC dialog state and form
+ let isLoading = $state({ saving: false });
let showOidcConfigDialog = $state(false);
+
let oidcConfigForm = $state({
clientId: '',
clientSecret: '',
@@ -33,21 +28,34 @@
adminValue: ''
});
- let localAuthEnabled = $state(true);
- let oidcEnabled = $state(false);
- let sessionTimeout = $state(60);
- let passwordPolicy = $state<'strong' | 'standard' | 'basic'>('strong');
-
- let isLoading = $state({ saving: false });
+ // Match the settings form schema and logic
+ const formSchema = z
+ .object({
+ authLocalEnabled: z.boolean(),
+ authOidcEnabled: z.boolean(),
+ authSessionTimeout: z
+ .number(m.security_session_timeout_required())
+ .int(m.security_session_timeout_integer())
+ .min(15, m.security_session_timeout_min())
+ .max(1440, m.security_session_timeout_max()),
+ authPasswordPolicy: z.enum(['basic', 'standard', 'strong'])
+ })
+ .superRefine((val, ctx) => {
+ if (data.oidcStatus.envForced) return;
+ if (!val.authLocalEnabled && !val.authOidcEnabled) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: m.security_enable_one_provider(),
+ path: ['authLocalEnabled']
+ });
+ }
+ });
- let isOidcViewMode = $derived(data.oidcStatus?.envForced && data.oidcStatus?.envConfigured);
+ let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
- $effect(() => {
- localAuthEnabled = currentSettings.authLocalEnabled ?? true;
- oidcEnabled = currentSettings.authOidcEnabled ?? false;
- sessionTimeout = currentSettings.authSessionTimeout ?? 60;
- passwordPolicy = currentSettings.authPasswordPolicy ?? 'strong';
+ const isOidcActive = () => $formInputs.authOidcEnabled.value || data.oidcStatus.envForced;
+ function openOidcDialog() {
if (currentSettings.authOidcConfig) {
try {
const cfg = JSON.parse(currentSettings.authOidcConfig);
@@ -56,60 +64,46 @@
oidcConfigForm.scopes = cfg.scopes || 'openid email profile';
oidcConfigForm.adminClaim = cfg.adminClaim || '';
oidcConfigForm.adminValue = cfg.adminValue || '';
- } catch (e) {
- console.warn('Failed to parse OIDC config:', e);
- }
+ } catch {}
}
oidcConfigForm.clientSecret = '';
- });
-
- async function updateSettingsConfig(updated: Partial<Settings>) {
- try {
- currentSettings = await settingsAPI.updateSettings({
- ...currentSettings,
- ...updated
- });
- settingsStore.set(currentSettings);
- settingsStore.reload();
- } catch (error) {
- console.error('Error updating settings:', error);
- throw error;
- }
+ showOidcConfigDialog = true;
}
function handleOidcSwitchChange(checked: boolean) {
- oidcEnabled = checked;
- // If enabling and not forced by env, open the config dialog
- if (checked && !data.oidcStatus?.envForced) {
- showOidcConfigDialog = true;
+ $formInputs.authOidcEnabled.value = checked;
+
+ if (!checked && !$formInputs.authLocalEnabled.value && !data.oidcStatus.envForced) {
+ $formInputs.authLocalEnabled.value = true;
+ toast.info(m.security_local_enabled_info());
+ }
+
+ if (checked && !data.oidcStatus.envForced) {
+ openOidcDialog();
}
}
- function openOidcDialog() {
- if (!isOidcViewMode) {
- if (currentSettings.authOidcConfig) {
- try {
- const cfg = JSON.parse(currentSettings.authOidcConfig);
- oidcConfigForm.clientId = cfg.clientId || '';
- oidcConfigForm.issuerUrl = cfg.issuerUrl || '';
- oidcConfigForm.scopes = cfg.scopes || 'openid email profile';
- oidcConfigForm.adminClaim = cfg.adminClaim || '';
- oidcConfigForm.adminValue = cfg.adminValue || '';
- } catch (e) {
- console.warn('Failed to parse OIDC config:', e);
- }
- }
- oidcConfigForm.clientSecret = '';
+ function handleLocalSwitchChange(checked: boolean) {
+ if (!checked && !isOidcActive()) {
+ $formInputs.authLocalEnabled.value = true;
+ toast.error(m.security_enable_one_provider_error());
+ return;
}
- showOidcConfigDialog = true;
+ $formInputs.authLocalEnabled.value = checked;
}
async function handleSaveOidcConfig() {
try {
isLoading.saving = true;
- oidcEnabled = true;
+ $formInputs.authOidcEnabled.value = true;
- const oidcConfigString = JSON.stringify({
+ const validated = form.validate();
+ if (!validated) {
+ isLoading.saving = false;
+ return;
+ }
+
+ const authOidcConfig = JSON.stringify({
clientId: oidcConfigForm.clientId,
clientSecret: oidcConfigForm.clientSecret || '',
issuerUrl: oidcConfigForm.issuerUrl,
@@ -118,58 +112,40 @@
adminValue: oidcConfigForm.adminValue || ''
});
- // Save security changes (no onboarding step change here; Next handles that)
- await updateSettingsConfig({
- authLocalEnabled: localAuthEnabled,
+ const payload = {
+ ...currentSettings,
authOidcEnabled: true,
- authSessionTimeout: sessionTimeout,
- authPasswordPolicy: passwordPolicy,
- authOidcConfig: oidcConfigString
- });
+ authOidcConfig
+ };
- toast.success('OIDC configuration saved.');
+ await settingsAPI.updateSettings(payload);
+ toast.success(m.security_oidc_saved());
showOidcConfigDialog = false;
- await invalidateAll();
- } catch (error) {
- console.error('Failed to save OIDC configuration:', error);
- toast.error('Failed to save OIDC configuration.');
} finally {
isLoading.saving = false;
}
}
async function handleNext() {
+ const validated = form.validate();
+ if (!validated) return;
+
isLoading.saving = true;
try {
- let oidcConfigString = currentSettings.authOidcConfig;
- if (oidcEnabled && !data.oidcStatus?.envForced) {
- oidcConfigString = JSON.stringify({
- clientId: oidcConfigForm.clientId,
- clientSecret: oidcConfigForm.clientSecret || '',
- issuerUrl: oidcConfigForm.issuerUrl,
- scopes: oidcConfigForm.scopes,
- adminClaim: oidcConfigForm.adminClaim || '',
- adminValue: oidcConfigForm.adminValue || ''
- });
- }
-
- // Save security settings similar to the main page AND mark onboarding step
- await updateSettingsConfig({
- authLocalEnabled: localAuthEnabled,
- authOidcEnabled: oidcEnabled,
- authSessionTimeout: sessionTimeout,
- authPasswordPolicy: passwordPolicy,
- authOidcConfig: oidcConfigString,
+ const payload = {
+ ...currentSettings,
+ ...validated,
onboardingCompleted: false,
onboardingSteps: {
...currentSettings.onboardingSteps,
security: true
}
- });
+ };
+ await settingsAPI.updateSettings(payload);
goto('/onboarding/settings');
- } catch (error) {
- toast.error('Failed to save security settings');
+ } catch {
+ toast.error(m.security_settings_save_failed());
} finally {
isLoading.saving = false;
}
@@ -184,157 +160,149 @@
}
</script>
-<div class="space-y-8">
- <div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
- <div class="space-y-1">
- <h2 class="text-2xl font-bold">Security Configuration</h2>
- <p class="text-muted-foreground max-w-2xl text-sm">
- Configure authentication methods, session policies, and security settings.
- </p>
- </div>
- <div class="flex gap-2">
- <Button variant="outline" onclick={handleBack}>Back</Button>
- <Button variant="ghost" onclick={handleSkip}>Skip</Button>
- <Button onclick={handleNext} disabled={isLoading.saving}>
- {#if isLoading.saving}
- <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
- {/if}
- Next
- </Button>
- </div>
+<div class="space-y-6">
+ <div class="text-center">
+ <h2 class="text-2xl font-bold">{m.security_title()}</h2>
+ <p class="text-muted-foreground mt-2">{m.security_description()}</p>
</div>
- <div class="grid gap-6 md:grid-cols-2">
- <!-- Authentication Methods (mirrors settings page) -->
- <Card.Root class="rounded-lg border shadow-sm">
- <Card.Header class="pb-2">
- <div class="flex items-center gap-3">
- <div class="rounded-md bg-indigo-500/10 p-2">
- <LockIcon class="size-5 text-indigo-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Authentication Methods</Card.Title>
- <Card.Description class="text-sm">Configure how users sign in to Arcane</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="pt-0">
- <div class="space-y-4">
- <div class="bg-muted/30 flex items-start justify-between rounded-lg border p-4">
- <div class="space-y-1 pr-4">
- <label for="localAuthSwitch" class="text-sm font-medium">Local Authentication</label>
- <p class="text-muted-foreground text-xs">
- Username and password stored in the system. Recommended as a fallback if OIDC is unavailable.
- </p>
- </div>
- <Switch id="localAuthSwitch" checked={localAuthEnabled} onCheckedChange={(checked) => (localAuthEnabled = checked)} />
- </div>
+ <form onsubmit={preventDefault(handleNext)} class="space-y-6">
+ <FieldSet.Root>
+ <FieldSet.Content class="flex flex-col gap-8">
+ <div class="min-w-0 space-y-4">
+ <h2 class="text-muted-foreground text-sm font-semibold">{m.security_authentication_heading()}</h2>
- <div class="bg-muted/30 flex items-start justify-between rounded-lg border p-4">
- <div class="space-y-1 pr-4">
- <label for="oidcAuthSwitch" class="text-sm font-medium">OIDC Authentication</label>
- <p class="text-muted-foreground text-xs">
- Use an external OIDC provider
- {#if data.oidcStatus?.envForced}
- <span class="text-muted-foreground text-[11px]">(Forced ON by server environment)</span>
- {/if}
- </p>
+ <SwitchWithLabel
+ id="localAuthSwitch"
+ label={m.security_local_auth_label()}
+ description={m.security_local_auth_description()}
+ bind:checked={$formInputs.authLocalEnabled.value}
+ onCheckedChange={handleLocalSwitchChange}
+ />
- {#if data.oidcStatus?.envForced}
- <div class="mt-1">
+ <div class="space-y-2">
+ <SwitchWithLabel
+ id="oidcAuthSwitch"
+ label={m.security_oidc_auth_label()}
+ description={data.oidcStatus.envForced
+ ? m.security_oidc_auth_description_forced()
+ : m.security_oidc_auth_description()}
+ disabled={data.oidcStatus.envForced}
+ checked={$formInputs.authOidcEnabled.value}
+ onCheckedChange={handleOidcSwitchChange}
+ />
+
+ {#if isOidcActive()}
+ <div class="pl-11">
+ {#if data.oidcStatus.envForced}
{#if !data.oidcStatus.envConfigured}
<Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
- <TriangleAlertIcon class="mr-1 size-3" />
- Server forces OIDC, but env vars are missing. Configure app settings or fix server env.
+ {m.security_server_forces_oidc_missing_env()}
</Button>
{:else}
<Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
- <InfoIcon class="mr-1 size-3" />
- OIDC configured & forced by server. View status.
+ {m.security_oidc_configured_forced_view()}
</Button>
{/if}
- </div>
- {/if}
- </div>
-
- <Switch
- id="oidcAuthSwitch"
- checked={oidcEnabled}
- disabled={data.oidcStatus?.envForced}
- onCheckedChange={handleOidcSwitchChange}
- />
- </div>
- </div>
- </Card.Content>
- </Card.Root>
-
- <OidcConfigDialog
- bind:open={showOidcConfigDialog}
- {currentSettings}
- oidcStatus={data.oidcStatus}
- bind:oidcForm={oidcConfigForm}
- onSave={handleSaveOidcConfig}
- />
-
- <!-- Session Settings (mirrors settings page) -->
- <Card.Root class="rounded-lg border shadow-sm">
- <Card.Header class="pb-2">
- <div class="flex items-center gap-3">
- <div class="rounded-md bg-cyan-500/10 p-2">
- <KeyIcon class="size-5 text-cyan-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Session Settings</Card.Title>
- <Card.Description class="text-sm">Configure session behavior and password policies</Card.Description>
+ {:else}
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ {m.security_manage_oidc_config()}
+ </Button>
+ {/if}
+ </div>
+ {/if}
</div>
</div>
- </Card.Header>
- <Card.Content class="pt-0">
- <div class="space-y-5">
+
+ <div class="min-w-0 space-y-4">
+ <h2 class="text-muted-foreground text-sm font-semibold">{m.security_session_heading()}</h2>
+
+ <FormInput
+ type="number"
+ id="sessionTimeout"
+ label={m.security_session_timeout_label()}
+ placeholder={m.security_session_timeout_placeholder()}
+ bind:input={$formInputs.authSessionTimeout}
+ description={m.security_session_timeout_description()}
+ />
+
<div class="space-y-2">
- <Label for="sessionTimeout">Session Timeout (minutes)</Label>
- <Input type="number" id="sessionTimeout" name="sessionTimeout" bind:value={sessionTimeout} min="15" max="1440" />
- <p class="text-muted-foreground text-xs">Inactive sessions will be logged out automatically (15–1440 minutes).</p>
+ <span class="text-sm font-medium" id="passwordPolicyLabel">{m.security_password_policy_label()}</span>
+ <Tooltip.Provider>
+ <div class="mt-2 grid grid-cols-3 gap-2" role="group" aria-labelledby="passwordPolicyLabel">
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <Button
+ variant={$formInputs.authPasswordPolicy.value === 'basic' ? 'default' : 'outline'}
+ class={$formInputs.authPasswordPolicy.value === 'basic'
+ ? 'arcane-button-create w-full'
+ : 'arcane-button-restart w-full'}
+ onclick={() => ($formInputs.authPasswordPolicy.value = 'basic')}
+ type="button"
+ >{m.security_password_policy_basic()}
+ </Button>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">{m.security_password_policy_basic_tooltip()}</Tooltip.Content>
+ </Tooltip.Root>
+
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <Button
+ variant={$formInputs.authPasswordPolicy.value === 'standard' ? 'default' : 'outline'}
+ class={$formInputs.authPasswordPolicy.value === 'standard'
+ ? 'arcane-button-create w-full'
+ : 'arcane-button-restart w-full'}
+ onclick={() => ($formInputs.authPasswordPolicy.value = 'standard')}
+ type="button"
+ >{m.security_password_policy_standard()}
+ </Button>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">{m.security_password_policy_standard_tooltip()}</Tooltip.Content>
+ </Tooltip.Root>
+
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <Button
+ variant={$formInputs.authPasswordPolicy.value === 'strong' ? 'default' : 'outline'}
+ class={$formInputs.authPasswordPolicy.value === 'strong'
+ ? 'arcane-button-create w-full'
+ : 'arcane-button-restart w-full'}
+ onclick={() => ($formInputs.authPasswordPolicy.value = 'strong')}
+ type="button"
+ >{m.security_password_policy_strong()}
+ </Button>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">{m.security_password_policy_strong_tooltip()}</Tooltip.Content>
+ </Tooltip.Root>
+ </div>
+ </Tooltip.Provider>
</div>
+ </div>
+ </FieldSet.Content>
- <div class="space-y-2">
- <Label for="passwordPolicy">Password Policy</Label>
- <div class="grid grid-cols-3 gap-2">
- <Button
- variant={passwordPolicy === 'basic' ? 'default' : 'outline'}
- class={passwordPolicy === 'basic' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
- onclick={() => (passwordPolicy = 'basic')}
- >
- Basic
- </Button>
- <Button
- variant={passwordPolicy === 'standard' ? 'default' : 'outline'}
- class={passwordPolicy === 'standard' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
- onclick={() => (passwordPolicy = 'standard')}
- >
- Standard
- </Button>
- <Button
- variant={passwordPolicy === 'strong' ? 'default' : 'outline'}
- class={passwordPolicy === 'strong' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
- onclick={() => (passwordPolicy = 'strong')}
- >
- Strong
- </Button>
- </div>
- <input type="hidden" id="passwordPolicy" name="passwordPolicy" value={passwordPolicy} />
- <p class="text-muted-foreground mt-1 text-xs">
- {#if passwordPolicy === 'basic'}
- Basic: Minimum 8 characters
- {:else if passwordPolicy === 'standard'}
- Standard: Minimum 10 characters, requires mixed case and numbers
- {:else}
- Strong: Minimum 12 characters, requires mixed case, numbers and special characters
+ <FieldSet.Footer>
+ <div class="flex w-full place-items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.security_save_instructions()}</span>
+ <div class="flex gap-2">
+ <Button type="button" variant="outline" onclick={handleBack}>{m.common_back()}</Button>
+ <Button type="button" variant="ghost" onclick={handleSkip}>{m.common_skip()}</Button>
+ <Button type="submit" disabled={isLoading.saving}>
+ {#if isLoading.saving}
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
{/if}
- </p>
+ {m.common_continue?.() ?? 'Continue'}
+ </Button>
</div>
</div>
- </Card.Content>
- </Card.Root>
- </div>
+ </FieldSet.Footer>
+ </FieldSet.Root>
+ </form>
+
+ <OidcConfigDialog
+ bind:open={showOidcConfigDialog}
+ {currentSettings}
+ oidcStatus={data.oidcStatus}
+ bind:oidcForm={oidcConfigForm}
+ onSave={handleSaveOidcConfig}
+ />
</div>
diff --git a/frontend/src/routes/onboarding/settings/+page.svelte b/frontend/src/routes/onboarding/settings/+page.svelte
index 6ce71bd17..c69d2b8f9 100644
--- a/frontend/src/routes/onboarding/settings/+page.svelte
+++ b/frontend/src/routes/onboarding/settings/+page.svelte
@@ -1,44 +1,39 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button';
- import * as Card from '$lib/components/ui/card';
- import { Input } from '$lib/components/ui/input';
- import { Label } from '$lib/components/ui/label';
- import * as Select from '$lib/components/ui/select';
- import { Switch } from '$lib/components/ui/switch';
+ import * as FieldSet from '$lib/components/ui/field-set';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import { settingsAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import { goto } from '$app/navigation';
import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import { z } from 'zod/v4';
+ import { m } from '$lib/paraglide/messages';
let { data } = $props();
let currentSettings = $state(data.settings);
let isLoading = $state(false);
- let appSettings = $state<{
- autoUpdate: boolean;
- autoUpdateInterval: string;
- pruneMode: 'dangling' | 'all';
- maturityThresholdDays: number;
- baseServerUrl: string;
- }>({
- autoUpdate: true,
- autoUpdateInterval: '300',
- pruneMode: 'dangling',
- maturityThresholdDays: 30,
- baseServerUrl: ''
+ const formSchema = z.object({
+ stacksDirectory: z.string().min(1, m.general_projects_directory_required()),
+ baseServerUrl: z.string().min(1, m.general_base_url_required()),
+ enableGravatar: z.boolean()
});
+ let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
+
async function handleNext() {
+ const validated = form.validate();
+ if (!validated) return;
+
isLoading = true;
try {
await settingsAPI.updateSettings({
...currentSettings,
- autoUpdate: appSettings.autoUpdate,
- autoUpdateInterval: parseInt(appSettings.autoUpdateInterval),
- dockerPruneMode: appSettings.pruneMode,
- baseServerUrl: appSettings.baseServerUrl,
+ ...validated,
onboardingCompleted: false,
onboardingSteps: {
...currentSettings.onboardingSteps,
@@ -48,7 +43,7 @@
goto('/onboarding/complete');
} catch (error) {
- toast.error('Failed to save application settings');
+ toast.error(m.general_settings_save_failed());
} finally {
isLoading = false;
}
@@ -61,94 +56,64 @@
<div class="space-y-6">
<div class="text-center">
- <h2 class="text-2xl font-bold">Application Settings</h2>
- <p class="text-muted-foreground mt-2">Configure general application behavior and features</p>
+ <h2 class="text-2xl font-bold">{m.general_title()}</h2>
+ <p class="text-muted-foreground mt-2">{m.general_description()}</p>
</div>
- <div class="grid gap-6 md:grid-cols-2">
- <Card.Root>
- <Card.Header>
- <Card.Title>Auto Update</Card.Title>
- <Card.Description>Configure automatic updating of containers and projects</Card.Description>
- </Card.Header>
- <Card.Content class="space-y-4">
- <div class="flex items-center justify-between">
- <div class="space-y-0.5">
- <Label>Enable Auto Update</Label>
- <p class="text-muted-foreground text-xs">Automatically check for and apply updates</p>
+ <form onsubmit={preventDefault(handleNext)} class="space-y-6">
+ <FieldSet.Root>
+ <FieldSet.Content class="grid grid-cols-1 gap-6 md:grid-cols-2">
+ <div class="bg-background/40 min-w-0 space-y-4 rounded-lg border p-5 shadow-sm">
+ <div class="space-y-1">
+ <h3 class="text-base font-medium">{m.general_projects_heading()}</h3>
+ <p class="text-muted-foreground text-sm">{m.general_projects_description()}</p>
</div>
- <Switch bind:checked={appSettings.autoUpdate} />
+
+ <FormInput
+ label={m.general_projects_directory_label()}
+ placeholder={m.general_projects_directory_placeholder()}
+ bind:input={$formInputs.stacksDirectory}
+ helpText={m.general_projects_directory_help()}
+ />
+
+ <FormInput
+ label={m.general_base_url_label()}
+ placeholder={m.general_base_url_placeholder()}
+ bind:input={$formInputs.baseServerUrl}
+ helpText={m.general_base_url_help()}
+ />
</div>
- {#if appSettings.autoUpdate}
- <div class="space-y-2">
- <Label>Update Interval</Label>
- <Select.Root type="single" bind:value={appSettings.autoUpdateInterval}>
- <Select.Trigger>
- {appSettings.autoUpdateInterval}
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="300">5 minutes</Select.Item>
- <Select.Item value="900">15 minutes</Select.Item>
- <Select.Item value="1800">30 minutes</Select.Item>
- <Select.Item value="3600">1 hour</Select.Item>
- <Select.Item value="21600">6 hours</Select.Item>
- </Select.Content>
- </Select.Root>
+ <div class="bg-background/40 min-w-0 space-y-4 rounded-lg border p-5 shadow-sm">
+ <div class="space-y-1">
+ <h3 class="text-base font-medium">{m.general_user_avatars_heading()}</h3>
+ <p class="text-muted-foreground text-sm">{m.general_user_avatars_description()}</p>
</div>
- {/if}
- </Card.Content>
- </Card.Root>
-
- <Card.Root>
- <Card.Header>
- <Card.Title>System Maintenance</Card.Title>
- <Card.Description>Configure system cleanup and maintenance settings</Card.Description>
- </Card.Header>
- <Card.Content class="space-y-4">
- <div class="space-y-2">
- <Label>Prune Mode</Label>
- <Select.Root type="single" bind:value={appSettings.pruneMode}>
- <Select.Trigger>
- {appSettings.pruneMode}
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="dangling">Dangling Only</Select.Item>
- <Select.Item value="all">All Unused</Select.Item>
- </Select.Content>
- </Select.Root>
- <p class="text-muted-foreground text-xs">How aggressive to be when pruning unused resources</p>
- </div>
- </Card.Content>
- </Card.Root>
-
- <Card.Root class="md:col-span-2">
- <Card.Header>
- <Card.Title>Network Settings</Card.Title>
- <Card.Description>Configure network and URL settings</Card.Description>
- </Card.Header>
- <Card.Content class="space-y-4">
- <div class="space-y-2">
- <Label for="base-server-url">Base Server URL (Optional)</Label>
- <Input id="base-server-url" bind:value={appSettings.baseServerUrl} placeholder="https://arcane.yourdomain.com" />
- <p class="text-muted-foreground text-xs">
- Used for generating external links and webhooks. Leave empty for auto-detection.
- </p>
+
+ <SwitchWithLabel
+ id="enableGravatar"
+ label={m.general_enable_gravatar_label()}
+ description={m.general_enable_gravatar_description()}
+ bind:checked={$formInputs.enableGravatar.value}
+ />
</div>
- </Card.Content>
- </Card.Root>
- </div>
+ </FieldSet.Content>
- <div class="flex justify-between">
- <Button variant="outline" onclick={() => goto('/onboarding/security')}>Back</Button>
- <div class="flex gap-2">
- <Button variant="ghost" onclick={handleSkip}>Skip</Button>
- <Button onclick={handleNext} disabled={isLoading}>
- {#if isLoading}
- <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
- {/if}
- Complete Setup
- </Button>
- </div>
- </div>
+ <FieldSet.Footer>
+ <div class="flex w-full place-items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.general_save_instructions()}</span>
+ <div class="flex gap-2">
+ <Button type="button" variant="outline" onclick={() => goto('/onboarding/security')}>Back</Button>
+ <Button type="button" variant="ghost" onclick={handleSkip}>Skip</Button>
+ <Button type="submit" disabled={isLoading}>
+ {#if isLoading}
+ <LoaderCircleIcon class="mr-2 size-4 animate-spin" />
+ {/if}
+ {m.common_continue()}
+ </Button>
+ </div>
+ </div>
+ </FieldSet.Footer>
+ </FieldSet.Root>
+ </form>
</div>