Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: add more options for onboarding (#321)
Kyle Mendell45ae5807c2bb
diff --git a/.gitignore b/.gitignoreindex 01bfb9436..614ad8a3f 100644--- a/.gitignore+++ b/.gitignore@@ -11,7 +11,6 @@ frontend/buildbuilddata/dist/-docker/arcane# OSdiff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.tsindex d275caeb5..1a3a3612c 100644--- a/frontend/src/lib/types/settings.type.ts+++ b/frontend/src/lib/types/settings.type.ts@@ -46,6 +46,8 @@ export interface Onboarding {steps?: {welcome?: boolean;password?: boolean;+ docker?: boolean;+ security?: boolean;settings?: boolean;};}diff --git a/frontend/src/lib/utils/redirect.util.ts b/frontend/src/lib/utils/redirect.util.tsindex 29705fa40..2437ab82a 100644--- a/frontend/src/lib/utils/redirect.util.ts+++ b/frontend/src/lib/utils/redirect.util.ts@@ -19,15 +19,19 @@ export function getAuthRedirectPath(path: string, user: User | null, settings: Sconst isPublicPath = ['/authorize', '/device', '/health', '/healthz'].includes(path);const isOnboardingPath = path == '/onboarding' || path.startsWith('/onboarding');- if (!isOnboardingPath && settings && settings.onboarding && !settings.onboarding.completed) {- return '/onboarding/welcome';- }-if (!isUnauthenticatedOnlyPath && !isPublicPath && !isSignedIn) {return '/auth/login';}- if (isUnauthenticatedOnlyPath && isSignedIn) {+ if (isSignedIn && settings && (!settings.onboarding || !settings.onboarding.completed)) {+ if (!isOnboardingPath) {+ return '/onboarding/welcome';+ }+ }++ if (isUnauthenticatedOnlyPath && isSignedIn && settings?.onboarding?.completed) {return '/';}++ return null;}diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelteindex 54fc0d0da..1526732e0 100644--- a/frontend/src/routes/+layout.svelte+++ b/frontend/src/routes/+layout.svelte@@ -15,10 +15,16 @@const { versionInformation, user, settings } = data;- const redirectPath = getAuthRedirectPath(page.url.pathname, user, settings);- if (redirectPath) {- goto(redirectPath);- }+ $effect(() => {+ const currentUser = $userStore || user;+ const currentSettings = $settingsStore || settings;++ const redirectPath = getAuthRedirectPath(page.url.pathname, currentUser, currentSettings);+ if (redirectPath) {+ goto(redirectPath);+ }+ });+const isNavigating = $derived(navigating.type !== null);const isOnboardingPage = $derived(page.url.pathname.startsWith('/onboarding'));diff --git a/frontend/src/routes/onboarding/+layout.svelte b/frontend/src/routes/onboarding/+layout.svelteindex 8277cd720..de7dc9766 100644--- a/frontend/src/routes/onboarding/+layout.svelte+++ b/frontend/src/routes/onboarding/+layout.svelte@@ -1,25 +1,24 @@<script lang="ts">import '../../app.css';+ import { CheckCircle2, Key, Settings, Database, Shield, CheckCircle } from '@lucide/svelte';import { page } from '$app/state';- import { CheckCircle2, Settings, Key } from '@lucide/svelte';- interface Props {- children?: import('svelte').Snippet;- }- let { children }: Props = $props();+ let { children } = $props();const steps = [{ id: 'welcome', label: 'Welcome', path: '/onboarding/welcome', icon: CheckCircle2 },{ id: 'password', label: 'Admin Password', path: '/onboarding/password', icon: Key },- { id: 'settings', label: 'Initial Setup', path: '/onboarding/settings', icon: Settings },- { id: 'complete', label: 'Complete', path: '/onboarding/complete', icon: CheckCircle2 }+ { id: 'docker', label: 'Docker Setup', path: '/onboarding/docker', icon: Database },+ { id: 'security', label: 'Security', path: '/onboarding/security', icon: Shield },+ { id: 'settings', label: 'Application Settings', path: '/onboarding/settings', icon: Settings },+ { id: 'complete', label: 'Complete', path: '/onboarding/complete', icon: CheckCircle }];- let currentStep = $derived(steps.findIndex((step) => page.url.pathname === step.path));+ const currentStepIndex = $derived(steps.findIndex((step) => page.url.pathname === step.path));</script><div class="flex min-h-screen flex-col">- <header class="border-b px-8 pb-6">+ <header class="border-b px-8 py-8"><div class="flex items-center"><img src="/img/arcane.png" alt="Arcane" class="size-12" /><h1 class="ml-4 text-2xl font-bold">Arcane Setup</h1>@@ -30,20 +29,27 @@<div class="mb-8 flex items-center justify-between">{#each steps as step, i (step.id)}<div class="flex flex-col items-center">- <div class={`flex size-10 items-center justify-center rounded-full ${i <= currentStep ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}>+ <div+ class={`flex size-10 items-center justify-center rounded-full ${i <= currentStepIndex ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}+ ><step.icon class="size-5" /></div>- <span class={`mt-2 text-sm ${i <= currentStep ? 'text-foreground' : 'text-muted-foreground'}`}>{step.label}</span>+ <span+ class={`mt-2 text-sm ${i <= currentStepIndex ? 'text-foreground' : 'text-muted-foreground'}`}+ >{step.label}</span+ ></div>{#if i < steps.length - 1}- <div class={`h-1 flex-1 ${i < currentStep ? 'bg-primary' : 'bg-muted'}`}></div>+ <div class={`h-1 flex-1 ${i < currentStepIndex ? 'bg-primary' : 'bg-muted'}`}></div>{/if}{/each}</div></div><main class="container mx-auto flex-1 px-4 py-6">- {@render children?.()}+ <div class="rounded-lg border bg-card p-8 shadow-sm">+ {@render children()}+ </div></main></div>diff --git a/frontend/src/routes/onboarding/complete/+page.svelte b/frontend/src/routes/onboarding/complete/+page.svelteindex bf479a028..fbeab6898 100644--- a/frontend/src/routes/onboarding/complete/+page.svelte+++ b/frontend/src/routes/onboarding/complete/+page.svelte@@ -1,22 +1,73 @@<script lang="ts">- import { goto } from '$app/navigation';- import { Button } from '$lib/components/ui/button/index.js';- import { CheckCircle } from '@lucide/svelte';+ import { Button } from '$lib/components/ui/button';+ import { settingsAPI } from '$lib/services/api';+ import { toast } from 'svelte-sonner';+ import { goto, invalidateAll } from '$app/navigation';+ import { Loader2, CheckCircle, ArrowRight } from '@lucide/svelte';++ let isLoading = $state(false);++ async function completeOnboarding() {+ isLoading = true;++ try {+ await settingsAPI.updateSettings({+ onboarding: {+ completed: true,+ completedAt: Date.now(),+ steps: {+ welcome: true,+ password: true,+ docker: true,+ security: true,+ settings: true+ }+ }+ });++ toast.success('Onboarding completed successfully!');+ await invalidateAll();+ goto('/', { replaceState: true });+ } catch (error) {+ toast.error('Failed to complete onboarding');+ } finally {+ isLoading = false;+ }+ }</script>-<div class="mx-auto max-w-2xl text-center">- <div class="mb-6 flex justify-center">- <div class="rounded-full bg-green-100 p-4 dark:bg-green-900/20">- <CheckCircle class="size-12 text-green-600 dark:text-green-400" />- </div>+<div class="space-y-6 text-center">+ <div class="mx-auto flex size-20 items-center justify-center rounded-full bg-green-100">+ <CheckCircle class="size-10 text-green-600" /></div>- <h1 class="mb-6 text-3xl font-bold">Setup Complete!</h1>-- <div class="prose dark:prose-invert mx-auto mb-8 max-w-xl">- <p>Congratulations! You've successfully completed the initial setup for Arcane.</p>- <p>You can now start using the application to manage your Docker containers and compose stacks.</p>+ <div>+ <h2 class="text-2xl font-bold">Setup Complete!</h2>+ <p class="text-muted-foreground mt-2">+ Congratulations! You've successfully configured Arcane. You're ready to start managing your+ containers.+ </p></div>- <Button onclick={() => goto('/', { invalidateAll: true })} size="lg">Go to Dashboard</Button>+ <div class="space-y-4">+ <div class="rounded-lg border bg-muted/50 p-4">+ <h3 class="font-semibold">What's Next?</h3>+ <ul class="mt-2 space-y-1 text-sm text-muted-foreground">+ <li>• Start managing your Docker containers and images</li>+ <li>• Create and deploy Docker Compose stacks</li>+ <li>• Monitor system resources and performance</li>+ <li>• Configure additional settings as needed</li>+ </ul>+ </div>++ <Button onclick={completeOnboarding} disabled={isLoading} size="lg" class="w-full">+ {#if isLoading}+ <Loader2 class="mr-2 size-4 animate-spin" />+ Completing Setup...+ {:else}+ Go to Dashboard+ <ArrowRight class="ml-2 size-4" />+ {/if}+ </Button>+ </div></div>diff --git a/frontend/src/routes/onboarding/docker/+page.svelte b/frontend/src/routes/onboarding/docker/+page.sveltenew file mode 100644index 000000000..9dbea3e2d--- /dev/null+++ b/frontend/src/routes/onboarding/docker/+page.svelte@@ -0,0 +1,185 @@+<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 { Textarea } from '$lib/components/ui/textarea';+ import * as Select from '$lib/components/ui/select';+ import { Switch } from '$lib/components/ui/switch';+ import { settingsAPI } from '$lib/services/api';+ import { toast } from 'svelte-sonner';+ import { goto } from '$app/navigation';+ import { Loader2, CheckCircle, AlertCircle } from '@lucide/svelte';++ let isLoading = $state(false);+ let testingConnection = $state(false);+ let connectionStatus = $state<'success' | 'error' | null>(null);++ let dockerSettings = $state({+ stacksDirectory: '/opt/stacks',+ dockerTLSCert: '',+ pollingEnabled: true,+ pollingInterval: '5'+ });++ async function testDockerConnection() {+ testingConnection = true;+ connectionStatus = null;++ try {+ await settingsAPI.updateSettings({+ stacksDirectory: dockerSettings.stacksDirectory,+ dockerTLSCert: dockerSettings.dockerTLSCert,+ pollingEnabled: dockerSettings.pollingEnabled,+ pollingInterval: parseInt(dockerSettings.pollingInterval)+ });++ connectionStatus = 'success';+ toast.success('Docker connection successful!');+ } catch (error) {+ connectionStatus = 'error';+ toast.error('Docker connection failed. Please check your settings.');+ } finally {+ testingConnection = false;+ }+ }++ async function handleNext() {+ isLoading = true;++ try {+ await settingsAPI.updateSettings({+ stacksDirectory: dockerSettings.stacksDirectory,+ dockerTLSCert: dockerSettings.dockerTLSCert,+ pollingEnabled: dockerSettings.pollingEnabled,+ pollingInterval: parseInt(dockerSettings.pollingInterval),+ onboarding: {+ completed: false,+ steps: {+ welcome: true,+ password: true,+ docker: true+ }+ }+ });++ goto('/onboarding/security');+ } catch (error) {+ toast.error('Failed to save Docker settings');+ } finally {+ isLoading = false;+ }+ }++ function handleSkip() {+ goto('/onboarding/security');+ }+</script>++<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>+ </div>++ <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.Header>+ <Card.Content class="space-y-4">+ <div class="space-y-2">+ <Label for="stacks-directory">Stacks Directory</Label>+ <Input+ id="stacks-directory"+ bind:value={dockerSettings.stacksDirectory}+ placeholder="/opt/stacks"+ />+ <p class="text-xs text-muted-foreground">+ Directory where Docker Compose files will be stored+ </p>+ </div>++ <div class="space-y-2">+ <Label for="docker-tls">Docker TLS Certificate (Optional)</Label>+ <Textarea+ id="docker-tls"+ bind:value={dockerSettings.dockerTLSCert}+ placeholder="-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"+ rows={4}+ />+ <p class="text-xs text-muted-foreground">Leave empty for local Docker daemon</p>+ </div>+ </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.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-xs text-muted-foreground">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}++ <Button+ variant="outline"+ onclick={testDockerConnection}+ disabled={testingConnection}+ class="w-full"+ >+ {#if testingConnection}+ <Loader2 class="mr-2 size-4 animate-spin" />+ Testing Connection...+ {:else if connectionStatus === 'success'}+ <CheckCircle class="mr-2 size-4 text-green-500" />+ Connection Successful+ {:else if connectionStatus === 'error'}+ <AlertCircle class="mr-2 size-4 text-red-500" />+ Connection Failed+ {:else}+ Test Docker Connection+ {/if}+ </Button>+ </Card.Content>+ </Card.Root>+ </div>++ <div class="flex justify-between">+ <Button variant="outline" onclick={() => goto('/onboarding/password')}>Back</Button>+ <div class="flex gap-2">+ <Button variant="ghost" onclick={handleSkip}>Skip</Button>+ <Button onclick={handleNext} disabled={isLoading}>+ {#if isLoading}+ <Loader2 class="mr-2 size-4 animate-spin" />+ {/if}+ Next+ </Button>+ </div>+ </div>+</div>diff --git a/frontend/src/routes/onboarding/docker/+page.ts b/frontend/src/routes/onboarding/docker/+page.tsnew file mode 100644index 000000000..17886c85e--- /dev/null+++ b/frontend/src/routes/onboarding/docker/+page.ts@@ -0,0 +1,13 @@+import { redirect } from '@sveltejs/kit';+import type { PageLoad } from './$types';+import { settingsAPI } from '$lib/services/api';++export const load: PageLoad = async () => {+ const settings = await settingsAPI.getSettings();++ if (settings.onboarding?.completed) {+ throw redirect(302, '/');+ }++ return { settings };+};\ No newline at end of filediff --git a/frontend/src/routes/onboarding/security/+page.svelte b/frontend/src/routes/onboarding/security/+page.sveltenew file mode 100644index 000000000..02770d161--- /dev/null+++ b/frontend/src/routes/onboarding/security/+page.svelte@@ -0,0 +1,203 @@+<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 { toast } from 'svelte-sonner';+ import { goto } from '$app/navigation';+ import { Loader2 } from '@lucide/svelte';++ let isLoading = $state(false);++ let securitySettings = $state({+ authType: 'local',+ oidcIssuer: '',+ oidcClientId: '',+ oidcClientSecret: '',+ oidcScope: 'openid profile email',+ sessionTimeout: '24',+ requireTLS: false+ });++ async function handleNext() {+ isLoading = true;++ try {+ const authSettings = {+ localAuthEnabled: securitySettings.authType === 'local',+ oidcEnabled: securitySettings.authType === 'oidc',+ sessionTimeout: parseInt(securitySettings.sessionTimeout),+ passwordPolicy: 'strong',+ rbacEnabled: false,+ ...(securitySettings.authType === 'oidc' && {+ oidc: {+ clientId: securitySettings.oidcClientId,+ clientSecret: securitySettings.oidcClientSecret,+ redirectUri: `${window.location.origin}/auth/oidc/callback`,+ authorizationEndpoint: `${securitySettings.oidcIssuer}/auth`,+ tokenEndpoint: `${securitySettings.oidcIssuer}/token`,+ userinfoEndpoint: `${securitySettings.oidcIssuer}/userinfo`,+ scopes: securitySettings.oidcScope+ }+ })+ };++ await settingsAPI.updateSettings({+ auth: authSettings,+ onboarding: {+ completed: false,+ steps: {+ welcome: true,+ password: true,+ docker: true,+ security: true+ }+ }+ });++ goto('/onboarding/settings');+ } catch (error) {+ toast.error('Failed to save security settings');+ } finally {+ isLoading = false;+ }+ }++ function handleSkip() {+ goto('/onboarding/settings');+ }+</script>++<div class="space-y-6">+ <div class="text-center">+ <h2 class="text-2xl font-bold">Security Configuration</h2>+ <p class="text-muted-foreground mt-2">Configure authentication and security settings</p>+ </div>++ <div class="grid gap-6 md:grid-cols-2">+ <Card.Root>+ <Card.Header>+ <Card.Title>Authentication</Card.Title>+ <Card.Description>Choose your authentication method</Card.Description>+ </Card.Header>+ <Card.Content class="space-y-4">+ <div class="space-y-2">+ <Label>Authentication Type</Label>+ <Select.Root type="single" bind:value={securitySettings.authType}>+ <Select.Trigger>+ {securitySettings.authType}+ </Select.Trigger>+ <Select.Content>+ <Select.Item value="local">Local Authentication</Select.Item>+ <Select.Item value="oidc">OIDC/OAuth2</Select.Item>+ </Select.Content>+ </Select.Root>+ </div>++ <div class="space-y-2">+ <Label for="session-timeout">Session Timeout (hours)</Label>+ <Select.Root type="single" bind:value={securitySettings.sessionTimeout}>+ <Select.Trigger>+ {securitySettings.sessionTimeout}+ </Select.Trigger>+ <Select.Content>+ <Select.Item value="1">1 hour</Select.Item>+ <Select.Item value="8">8 hours</Select.Item>+ <Select.Item value="24">24 hours</Select.Item>+ <Select.Item value="168">1 week</Select.Item>+ </Select.Content>+ </Select.Root>+ </div>+ </Card.Content>+ </Card.Root>++ {#if securitySettings.authType === 'oidc'}+ <Card.Root>+ <Card.Header>+ <Card.Title>OIDC Configuration</Card.Title>+ <Card.Description>Configure your OIDC/OAuth2 provider</Card.Description>+ </Card.Header>+ <Card.Content class="space-y-4">+ <div class="space-y-2">+ <Label for="oidc-issuer">OIDC Issuer URL</Label>+ <Input+ id="oidc-issuer"+ bind:value={securitySettings.oidcIssuer}+ placeholder="https://your-provider.com"+ />+ <p class="text-xs text-muted-foreground">+ The base URL of your OIDC provider (e.g., Keycloak, Auth0)+ </p>+ </div>++ <div class="space-y-2">+ <Label for="oidc-client-id">Client ID</Label>+ <Input+ id="oidc-client-id"+ bind:value={securitySettings.oidcClientId}+ placeholder="your-client-id"+ />+ </div>++ <div class="space-y-2">+ <Label for="oidc-client-secret">Client Secret</Label>+ <Input+ id="oidc-client-secret"+ type="password"+ bind:value={securitySettings.oidcClientSecret}+ placeholder="your-client-secret"+ />+ </div>++ <div class="space-y-2">+ <Label for="oidc-scope">Scopes</Label>+ <Input+ id="oidc-scope"+ bind:value={securitySettings.oidcScope}+ placeholder="openid profile email"+ />+ <p class="text-xs text-muted-foreground">Space-separated list of OAuth scopes</p>+ </div>++ <div class="rounded-lg bg-muted/50 p-3">+ <p class="text-xs text-muted-foreground">+ <strong>Note:</strong> The redirect URI will be automatically set to:+ <code class="rounded bg-background px-1"+ >{window.location.origin}/auth/oidc/callback</code+ >+ </p>+ </div>+ </Card.Content>+ </Card.Root>+ {:else}+ <Card.Root>+ <Card.Header>+ <Card.Title>Local Authentication</Card.Title>+ <Card.Description>Using local username/password authentication</Card.Description>+ </Card.Header>+ <Card.Content>+ <p class="text-sm text-muted-foreground">+ You're using local authentication with the admin password you set in the previous step.+ You can always switch to OIDC later in the settings.+ </p>+ </Card.Content>+ </Card.Root>+ {/if}+ </div>++ <div class="flex justify-between">+ <Button variant="outline" onclick={() => goto('/onboarding/docker')}>Back</Button>+ <div class="flex gap-2">+ <Button variant="ghost" onclick={handleSkip}>Skip</Button>+ <Button onclick={handleNext} disabled={isLoading}>+ {#if isLoading}+ <Loader2 class="mr-2 size-4 animate-spin" />+ {/if}+ Next+ </Button>+ </div>+ </div>+</div>diff --git a/frontend/src/routes/onboarding/security/+page.ts b/frontend/src/routes/onboarding/security/+page.tsnew file mode 100644index 000000000..17886c85e--- /dev/null+++ b/frontend/src/routes/onboarding/security/+page.ts@@ -0,0 +1,13 @@+import { redirect } from '@sveltejs/kit';+import type { PageLoad } from './$types';+import { settingsAPI } from '$lib/services/api';++export const load: PageLoad = async () => {+ const settings = await settingsAPI.getSettings();++ if (settings.onboarding?.completed) {+ throw redirect(302, '/');+ }++ return { settings };+};\ No newline at end of filediff --git a/frontend/src/routes/onboarding/settings/+page.svelte b/frontend/src/routes/onboarding/settings/+page.svelteindex b150c5f64..68c5779d3 100644--- a/frontend/src/routes/onboarding/settings/+page.svelte+++ b/frontend/src/routes/onboarding/settings/+page.svelte@@ -1,110 +1,170 @@<script lang="ts">- import { Button } from '$lib/components/ui/button/index.js';- import { Input } from '$lib/components/ui/input/index.js';- import { Label } from '$lib/components/ui/label/index.js';- import { Switch } from '$lib/components/ui/switch/index.js';- import * as Alert from '$lib/components/ui/alert/index.js';- import * as Card from '$lib/components/ui/card/index.js';- import { AlertCircle, ChevronRight } from '@lucide/svelte';- import { goto } from '$app/navigation';- import type { Settings } from '$lib/types/settings.type';- import settingsStore from '$lib/stores/config-store';+ 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 { toast } from 'svelte-sonner';+ import { goto } from '$app/navigation';+ import { Loader2 } from '@lucide/svelte';- let { data } = $props();- let currentSettings = $state(data.settings);+ let isLoading = $state(false);- let error = $state('');- let loading = $state(false);- let stacksDirectory = $state(data.settings.stacksDirectory);- let pollingEnabled = $state(data.settings.pollingEnabled);- let pollingInterval = $state(data.settings.pollingInterval);- let autoUpdate = $state(data.settings.autoUpdate);+ let appSettings = $state({+ autoUpdate: true,+ autoUpdateInterval: '300',+ pruneMode: 'dangling',+ maturityThresholdDays: 30,+ baseServerUrl: ''+ });- function getUpdatedSettings(): Partial<Settings> {- return {- stacksDirectory,- pollingEnabled,- pollingInterval,- autoUpdate,- onboarding: {- steps: {- welcome: true,- password: true,- settings: true- },- completed: true,- completedAt: Date.now()- }- };- }+ async function handleNext() {+ isLoading = true;- async function continueToNextStep() {- currentSettings = await settingsAPI.updateSettings({- ...currentSettings,- ...getUpdatedSettings()- });+ try {+ await settingsAPI.updateSettings({+ autoUpdate: appSettings.autoUpdate,+ autoUpdateInterval: parseInt(appSettings.autoUpdateInterval),+ pruneMode: appSettings.pruneMode,+ maturityThresholdDays: appSettings.maturityThresholdDays,+ baseServerUrl: appSettings.baseServerUrl,+ onboarding: {+ completed: false,+ steps: {+ welcome: true,+ password: true,+ docker: true,+ security: true,+ settings: true+ }+ }+ });- settingsStore.reload();+ goto('/onboarding/complete');+ } catch (error) {+ toast.error('Failed to save application settings');+ } finally {+ isLoading = false;+ }+ }- goto('/onboarding/complete', { invalidateAll: true });+ function handleSkip() {+ goto('/onboarding/complete');}</script>-<div class="mx-auto max-w-2xl">- <h1 class="mb-4 text-3xl font-bold">Initial Setup</h1>-- <p class="text-muted-foreground mb-6">Configure basic settings for Arcane. You can change these later from the Settings page.</p>+<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>+ </div>- {#if error}- <Alert.Root class="mb-6" variant="destructive">- <AlertCircle class="mr-2 size-4" />- <Alert.Title>Error</Alert.Title>- <Alert.Description>{error}</Alert.Description>- </Alert.Root>- {/if}-- <form class="space-y-5" onsubmit={() => continueToNextStep()}>- <Card.Root class="border shadow-sm">- <Card.Header class="py-4">- <Card.Title>Monitoring & Updates</Card.Title>- <Card.Description>Configure how Arcane monitors containers</Card.Description>+ <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 stacks</Card.Description></Card.Header>- <Card.Content class="space-y-4 pt-0 pb-4">- <div class="flex items-center justify-between rounded-lg border p-4">- <div>- <Label for="pollingSwitch" class="font-medium">Container Status Polling</Label>- <p class="text-muted-foreground text-sm">Periodically check container status</p>+ <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-xs text-muted-foreground">Automatically check for and apply updates</p></div>- <Switch id="pollingSwitch" checked={pollingEnabled} onCheckedChange={(checked) => (pollingEnabled = checked)} />+ <Switch bind:checked={appSettings.autoUpdate} /></div>- {#if pollingEnabled}- <div class="px-4">- <Label for="pollingInterval" class="mb-2 block text-base">Polling Interval (minutes)</Label>- <Input id="pollingInterval" type="number" bind:value={pollingInterval} min="5" max="60" class="bg-muted/10 h-12 px-4" />- <p class="text-muted-foreground mt-1 text-xs">Set between 5-60 minutes.</p>+ {#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>{/if}+ </Card.Content>+ </Card.Root>- <div class="flex items-center justify-between rounded-lg border p-4">- <div>- <Label for="autoUpdateSwitch" class="font-medium">Auto Update Containers</Label>- <p class="text-muted-foreground text-sm">Update containers when newer images are available</p>- </div>- <Switch id="autoUpdateSwitch" checked={autoUpdate} onCheckedChange={(checked) => (autoUpdate = checked)} />+ <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-xs text-muted-foreground">+ How aggressive to be when pruning unused resources+ </p>+ </div>++ <div class="space-y-2">+ <Label for="maturity-threshold">Image Maturity Threshold (days)</Label>+ <Input+ id="maturity-threshold"+ type="number"+ bind:value={appSettings.maturityThresholdDays}+ min="1"+ max="365"+ />+ <p class="text-xs text-muted-foreground">+ Consider images older than this as potentially outdated+ </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-xs text-muted-foreground">+ Used for generating external links and webhooks. Leave empty for auto-detection.+ </p></div></Card.Content></Card.Root>+ </div>- <div class="flex justify-center pt-4">- <Button type="submit" disabled={loading} class="flex h-12 w-[80%] items-center gap-2 px-8">- {#if loading}- <span class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"></span>+ <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}+ <Loader2 class="mr-2 size-4 animate-spin" />{/if}- Continue- <ChevronRight class="size-4" />+ Complete Setup</Button></div>- </form>+ </div></div>