Skip to content

Modern Docker Management, Designed for Everyone

refactor: use zod schemas on settings pages (#397)

Kyle Mendellf381f6d9aaba
diff --git a/backend/internal/api/settings_handler.go b/backend/internal/api/settings_handler.go
index 637d92ab7..11ca316b2 100644
--- a/backend/internal/api/settings_handler.go
+++ b/backend/internal/api/settings_handler.go
@@ -59,12 +59,11 @@ func (h *SettingsHandler) GetPublicSettings(c *gin.Context) {
return
}
- // Convert to DTO format
settingDtos := make([]dto.PublicSettingDto, 0, len(publicSettings))
for _, setting := range publicSettings {
settingDtos = append(settingDtos, dto.PublicSettingDto{
Key: setting.Key,
- Type: "string", // All stored as strings in new structure
+ Type: "string",
Value: setting.Value,
IsPublic: true,
})
diff --git a/backend/internal/api/volume_handler.go b/backend/internal/api/volume_handler.go
index 17c1c1dbf..bf0d5087a 100644
--- a/backend/internal/api/volume_handler.go
+++ b/backend/internal/api/volume_handler.go
@@ -31,7 +31,6 @@ func (h *VolumeHandler) List(c *gin.Context) {
return
}
- // defaults like container handler
if req.Pagination.Page == 0 {
req.Pagination.Page = 1
}
diff --git a/backend/internal/services/auth_service.go b/backend/internal/services/auth_service.go
index 1b57684e4..d388bb783 100644
--- a/backend/internal/services/auth_service.go
+++ b/backend/internal/services/auth_service.go
@@ -17,7 +17,6 @@ import (
"github.com/ofkm/arcane-backend/internal/utils"
)
-// Common errors
var (
ErrInvalidCredentials = errors.New("invalid credentials")
ErrUserNotFound = errors.New("user not found")
@@ -28,14 +27,12 @@ var (
ErrPasswordChangeRequired = errors.New("password change required")
)
-// TokenPair represents access and refresh tokens
type TokenPair struct {
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken"`
ExpiresAt time.Time `json:"expiresAt"`
}
-// AuthSettings represents the auth configuration structure
type AuthSettings struct {
LocalAuthEnabled bool `json:"localAuthEnabled"`
OidcEnabled bool `json:"oidcEnabled"`
@@ -43,7 +40,6 @@ type AuthSettings struct {
Oidc *models.OidcConfig `json:"oidc,omitempty"`
}
-// OidcStatusInfo provides detailed OIDC configuration status
type OidcStatusInfo struct {
EnvForced bool `json:"envForced"`
EnvConfigured bool `json:"envConfigured"`
@@ -97,10 +93,13 @@ func (s *AuthService) getAuthSettings(ctx context.Context) (*AuthSettings, error
return nil, fmt.Errorf("failed to get settings: %w", err)
}
+ // Normalize using GetSessionTimeout so UI sees the same effective minutes we enforce
+ timeoutMinutes, _ := s.GetSessionTimeout(ctx)
+
authSettings := &AuthSettings{
LocalAuthEnabled: settings.AuthLocalEnabled.IsTrue(),
OidcEnabled: settings.AuthOidcEnabled.IsTrue(),
- SessionTimeout: settings.AuthSessionTimeout.AsInt() / 60, // Convert seconds to minutes
+ SessionTimeout: timeoutMinutes, // minutes
}
if authSettings.OidcEnabled && settings.AuthOidcConfig.Value != "" {
@@ -145,14 +144,22 @@ func (s *AuthService) GetOidcConfigurationStatus(ctx context.Context) (*dto.Oidc
func (s *AuthService) GetSessionTimeout(ctx context.Context) (int, error) {
settings, err := s.settingsService.GetSettings(ctx)
if err != nil {
- return 60, err // Default 60 minutes
+ return 60, nil
}
timeoutSeconds := settings.AuthSessionTimeout.AsInt()
- if timeoutSeconds == 0 {
- timeoutSeconds = 3600 // Default 1 hour
+ if timeoutSeconds <= 0 {
+ timeoutSeconds = 3600 // 1 hour default in seconds
+ }
+ minutes := timeoutSeconds / 60
+
+ if minutes < 15 {
+ minutes = 15
+ } else if minutes > 1440 {
+ minutes = 1440
}
- return timeoutSeconds / 60, nil
+
+ return minutes, nil
}
func (s *AuthService) IsLocalAuthEnabled(ctx context.Context) (bool, error) {
@@ -482,10 +489,7 @@ func (s *AuthService) ChangePassword(ctx context.Context, userID, currentPasswor
}
func (s *AuthService) generateTokenPair(ctx context.Context, user *models.User) (*TokenPair, error) {
- sessionTimeout, err := s.GetSessionTimeout(ctx)
- if err != nil {
- sessionTimeout = 1440
- }
+ sessionTimeout, _ := s.GetSessionTimeout(ctx)
accessTokenExpiry := time.Now().Add(time.Duration(sessionTimeout) * time.Minute)
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index a1857523a..9c403ecf2 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -37,7 +37,6 @@ func (s *SettingsService) GetSettings(ctx context.Context) (*models.Settings, er
settings := &models.Settings{}
- // Load values from database into the struct
for _, sv := range settingVars {
if err := settings.UpdateField(sv.Key, sv.Value, false); err != nil {
// If key not found, it's okay
@@ -58,14 +57,14 @@ func (s *SettingsService) getDefaultSettings() *models.Settings {
AutoUpdate: models.SettingVariable{Value: "true"},
AutoUpdateInterval: models.SettingVariable{Value: "3600"},
PollingEnabled: models.SettingVariable{Value: "true"},
- PollingInterval: models.SettingVariable{Value: "300"}, // 5 minutes in seconds
+ PollingInterval: models.SettingVariable{Value: "300"},
PruneMode: models.SettingVariable{Value: "dangling"},
BaseServerURL: models.SettingVariable{Value: ""},
// Authentication settings
AuthLocalEnabled: models.SettingVariable{Value: "true"},
AuthOidcEnabled: models.SettingVariable{Value: "false"},
- AuthSessionTimeout: models.SettingVariable{Value: "86400"}, // 24 hours in seconds
+ AuthSessionTimeout: models.SettingVariable{Value: "1440"},
AuthPasswordPolicy: models.SettingVariable{Value: "strong"},
AuthRbacEnabled: models.SettingVariable{Value: "false"},
AuthOidcConfig: models.SettingVariable{Value: "{}"},
@@ -85,7 +84,6 @@ func (s *SettingsService) SyncOidcEnvToDatabase(ctx context.Context) ([]models.S
return nil, errors.New("OIDC sync called but OIDC_ENABLED is false")
}
- // Add validation to ensure required env vars are present
if s.config.OidcClientID == "" || s.config.OidcIssuerURL == "" {
return nil, errors.New("required OIDC environment variables are missing (OIDC_CLIENT_ID or OIDC_ISSUER_URL)")
}
diff --git a/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte b/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte
index 958288f0a..28d681c4a 100644
--- a/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/oidc-config-dialog.svelte
@@ -9,14 +9,7 @@
import { Label } from '$lib/components/ui/label/index.js';
import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
-
- interface OidcStatus {
- envForced: boolean;
- envConfigured: boolean;
- effectivelyEnabled: boolean;
- effectivelyConfigured: boolean;
- dbConfigured: boolean;
- }
+ import type { OidcStatus } from '$lib/services/api/oidc-api-service';
interface OidcForm {
clientId: string;
@@ -40,10 +33,8 @@
} = $props();
let isOidcViewMode = $derived(oidcStatus.envForced && oidcStatus.envConfigured);
- let advancedSettingsOpen = $state(false);
- let redirectUri = $derived(`${window.location.origin}/auth/oidc/callback`);
+ let redirectUri = $derived(`${globalThis?.location?.origin ?? ''}/auth/oidc/callback`);
- // Parse OIDC config from JSON string
let parsedOidcConfig = $derived(() => {
if (!currentSettings.authOidcConfig) {
return {
@@ -67,21 +58,36 @@
}
});
+ const statusItems = $derived([
+ { label: 'Env Forced', value: oidcStatus.envForced, hint: 'Server forces OIDC' },
+ { label: 'Env Configured', value: oidcStatus.envConfigured, hint: 'Server OIDC vars present' },
+ { label: 'DB Enabled', value: oidcStatus.dbEnabled, hint: 'App settings enable OIDC' },
+ { label: 'DB Configured', value: oidcStatus.dbConfigured, hint: 'App OIDC config saved' }
+ ]);
+
+ function chipClass(v: boolean) {
+ return v
+ ? 'bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/20'
+ : 'bg-muted text-muted-foreground ring-1 ring-border';
+ }
+
async function copyToClipboard(text: string) {
try {
await navigator.clipboard.writeText(text);
toast.success('Copied to clipboard');
- } catch (err) {
+ } catch {
toast.error('Failed to copy to clipboard');
}
}
</script>
<Dialog.Root bind:open>
- <Dialog.Content class="flex max-h-[90vh] flex-col sm:max-w-[700px]">
+ <Dialog.Content class="flex max-h-[90vh] flex-col sm:max-w-[860px]">
<Dialog.Header class="flex-shrink-0 space-y-3">
<Dialog.Title class="flex items-center gap-2">
- <KeyIcon class="size-5" />
+ <span class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-md ring-1">
+ <KeyIcon class="size-4" />
+ </span>
{#if isOidcViewMode}
OIDC Server Configuration Status
{:else if oidcStatus.envForced && !oidcStatus.envConfigured}
@@ -105,135 +111,154 @@
</Dialog.Header>
<div class="min-h-0 flex-1 overflow-y-auto py-4">
- {#if isOidcViewMode}
- <!-- Read-only view for server-configured OIDC -->
+ <div class="grid gap-6 lg:grid-cols-[1fr_18rem]">
+ <!-- Main column -->
<div class="space-y-6">
- <div class="space-y-4">
- <h3 class="text-base font-semibold">Server Environment Configuration</h3>
- <p class="text-muted-foreground text-sm">The following OIDC settings are loaded from the server environment:</p>
-
- {#if currentSettings.authOidcEnabled}
- <div class="space-y-3">
- <div class="border-border/50 flex items-center justify-between border-b py-2">
- <span class="text-sm font-medium">Client ID</span>
- <code class="bg-muted rounded px-2 py-1 text-xs">
- {parsedOidcConfig().clientId || 'Not configured'}
- </code>
+ {#if isOidcViewMode}
+ <div class="bg-card/50 rounded-lg border p-4">
+ <h3 class="text-base font-semibold">Server Environment Configuration</h3>
+ <p class="text-muted-foreground mb-4 mt-1 text-sm">
+ The following OIDC settings are loaded from the server environment:
+ </p>
+
+ {#if currentSettings.authOidcEnabled}
+ <div class="divide-border/60 divide-y text-sm">
+ <div class="flex items-center justify-between py-2">
+ <span class="font-medium">Client ID</span>
+ <code class="bg-muted rounded px-2 py-1 text-xs">{parsedOidcConfig().clientId || 'Not configured'}</code>
+ </div>
+ <div class="flex items-center justify-between py-2">
+ <span class="font-medium">Issuer URL</span>
+ <code class="bg-muted rounded px-2 py-1 text-xs">{parsedOidcConfig().issuerUrl || 'Not configured'}</code>
+ </div>
+ <div class="flex items-center justify-between py-2">
+ <span class="font-medium">Client Secret</span>
+ <span class="text-muted-foreground text-xs italic">(Sensitive - Not Displayed)</span>
+ </div>
+ <div class="flex items-center justify-between py-2">
+ <span class="font-medium">Scopes</span>
+ <code class="bg-muted rounded px-2 py-1 text-xs">{parsedOidcConfig().scopes || 'openid email profile'}</code>
+ </div>
+ </div>
+ {:else}
+ <div class="py-6 text-center">
+ <TriangleAlertIcon class="text-destructive mx-auto mb-2 size-8" />
+ <p class="text-destructive text-sm font-medium">OIDC configuration details not found in effective settings.</p>
+ </div>
+ {/if}
+
+ <div class="bg-muted/40 mt-4 rounded-md p-3">
+ <p class="text-muted-foreground text-xs">
+ Changes to these settings must be made in your server's environment configuration.
+ </p>
+ </div>
+ </div>
+ {:else}
+ <!-- Editable form -->
+ <div class="bg-card/50 rounded-lg border p-4">
+ <h3 class="text-base font-semibold">Basic Configuration</h3>
+ <p class="text-muted-foreground mb-4 mt-1 text-sm">Essential OIDC provider settings</p>
+
+ <div class="space-y-4">
+ <div class="space-y-2">
+ <Label for="oidcClientId" class="text-sm font-medium">Client ID</Label>
+ <Input
+ id="oidcClientId"
+ bind:value={oidcForm.clientId}
+ placeholder="Provided by your OIDC Provider"
+ class="font-mono text-sm"
+ />
</div>
- <div class="border-border/50 flex items-center justify-between border-b py-2">
- <span class="text-sm font-medium">Issuer URL</span>
- <code class="bg-muted rounded px-2 py-1 text-xs">
- {parsedOidcConfig().issuerUrl || 'Not configured'}
- </code>
+
+ <div class="space-y-2">
+ <Label for="oidcClientSecret" class="text-sm font-medium">Client Secret</Label>
+ <Input
+ id="oidcClientSecret"
+ type="password"
+ bind:value={oidcForm.clientSecret}
+ placeholder="Provided by your OIDC Provider (leave blank to keep existing)"
+ class="font-mono text-sm"
+ />
</div>
- <div class="border-border/50 flex items-center justify-between border-b py-2">
- <span class="text-sm font-medium">Client Secret</span>
- <span class="text-muted-foreground text-xs italic"> (Sensitive - Not Displayed) </span>
+
+ <div class="space-y-2">
+ <Label for="oidcIssuerUrl" class="text-sm font-medium">Issuer URL</Label>
+ <Input
+ id="oidcIssuerUrl"
+ bind:value={oidcForm.issuerUrl}
+ placeholder="https://id.example.com"
+ class="font-mono text-sm"
+ />
+ <p class="text-muted-foreground text-xs">The issuer URL will be used to auto-discover OIDC endpoints.</p>
</div>
- <div class="flex items-center justify-between py-2">
- <span class="text-sm font-medium">Scopes</span>
- <code class="bg-muted rounded px-2 py-1 text-xs">
- {parsedOidcConfig().scopes || 'openid email profile'}
- </code>
+
+ <div class="space-y-2">
+ <Label for="oidcScopes" class="text-sm font-medium">Scopes</Label>
+ <Input
+ id="oidcScopes"
+ bind:value={oidcForm.scopes}
+ placeholder="openid email profile"
+ class="font-mono text-sm"
+ />
</div>
</div>
- {:else}
- <div class="py-4 text-center">
- <TriangleAlertIcon class="text-destructive mx-auto mb-2 size-8" />
- <p class="text-destructive text-sm font-medium">OIDC configuration details not found in effective settings.</p>
+ </div>
+
+ {#if oidcStatus.envForced && !oidcStatus.envConfigured}
+ <div class="border-destructive/50 bg-destructive/5 rounded-lg border p-4">
+ <div class="mb-2 flex items-center gap-2">
+ <TriangleAlertIcon class="text-destructive size-4" />
+ <h3 class="text-destructive text-base font-semibold">Server Override Warning</h3>
+ </div>
+ <p class="text-destructive/80 text-sm">
+ Server forces OIDC, but environment variables appear incomplete. Prefer fixing server env, or save app-level
+ config below.
+ </p>
</div>
{/if}
+ {/if}
- <div class="bg-muted/50 rounded-md p-3">
- <p class="text-muted-foreground text-xs">
- Changes to these settings must be made in your server's environment configuration.
- </p>
+ <!-- Redirect URI -->
+ <div class="bg-card/50 rounded-lg border p-4">
+ <div class="mb-3 flex items-center gap-2">
+ <InfoIcon class="size-4 text-blue-600" />
+ <h3 class="text-base font-semibold">Redirect URI Configuration</h3>
</div>
- </div>
- </div>
- {:else}
- <!-- Editable form for database-configured OIDC -->
- <div class="space-y-6">
- <!-- Basic Configuration -->
- <div class="space-y-4">
- <h3 class="text-base font-semibold">Basic Configuration</h3>
- <p class="text-muted-foreground text-sm">Essential OIDC provider settings</p>
-
- <div class="space-y-4">
- <div class="space-y-2">
- <Label for="oidcClientId" class="text-sm font-medium">Client ID</Label>
- <Input
- id="oidcClientId"
- bind:value={oidcForm.clientId}
- placeholder="Provided by your OIDC Provider"
- class="font-mono text-sm"
- />
- </div>
- <div class="space-y-2">
- <Label for="oidcClientSecret" class="text-sm font-medium">Client Secret</Label>
- <Input
- id="oidcClientSecret"
- type="password"
- bind:value={oidcForm.clientSecret}
- placeholder="Provided by your OIDC Provider (leave blank to keep existing)"
- class="font-mono text-sm"
- />
- </div>
- <div class="space-y-2">
- <Label for="oidcIssuerUrl" class="text-sm font-medium">Issuer URL</Label>
- <Input
- id="oidcIssuerUrl"
- bind:value={oidcForm.issuerUrl}
- placeholder="https://id.example.com"
- class="font-mono text-sm"
- />
- <p class="text-muted-foreground text-xs">
- The issuer URL will be used to auto-discover OIDC endpoints. This is the recommended approach.
- </p>
- </div>
- <div class="space-y-2">
- <Label for="oidcScopes" class="text-sm font-medium">Scopes</Label>
- <Input
- id="oidcScopes"
- bind:value={oidcForm.scopes}
- placeholder="openid email profile"
- class="font-mono text-sm"
- />
- </div>
+ <p class="text-muted-foreground mb-3 text-sm">Configure this redirect URI in your OIDC provider:</p>
+ <div class="flex items-center gap-2">
+ <code class="bg-muted flex-1 break-all rounded p-2 font-mono text-xs">{redirectUri}</code>
+ <Button size="sm" variant="outline" onclick={() => copyToClipboard(redirectUri)} class="flex-shrink-0">
+ <CopyIcon class="size-3" />
+ </Button>
</div>
</div>
+ </div>
- <!-- Warning for server override -->
- {#if oidcStatus.envForced && !oidcStatus.envConfigured}
- <div class="border-destructive/50 bg-destructive/5 rounded-md border p-4">
- <div class="mb-2 flex items-center gap-2">
- <TriangleAlertIcon class="text-destructive size-4" />
- <h3 class="text-destructive text-base font-semibold">Server Override Warning</h3>
- </div>
- <p class="text-destructive/80 text-sm">
- While you can save these settings to the application database, it's strongly recommended to configure the OIDC
- settings directly in your server's environment for them to take full effect as intended by the server override.
- </p>
+ <!-- Side panel (lg+) -->
+ <aside class="hidden lg:block">
+ <div class="sticky top-4 space-y-4">
+ <div class="bg-card/50 rounded-lg border p-4">
+ <h3 class="text-sm font-semibold">Status</h3>
+ <ul class="mt-3 space-y-2">
+ {#each statusItems as s (s.label)}
+ <li class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{s.label}</span>
+ <span class={'rounded px-2 py-0.5 text-xs ring-1 ' + chipClass(s.value)}>{s.value ? 'Yes' : 'No'}</span>
+ </li>
+ {/each}
+ </ul>
</div>
- {/if}
- </div>
- {/if}
- <!-- Redirect URI Information - Always shown -->
- <div class="mt-6 border-t pt-6">
- <div class="mb-3 flex items-center gap-2">
- <InfoIcon class="size-4 text-blue-600" />
- <h3 class="text-base font-semibold">Redirect URI Configuration</h3>
- </div>
- <p class="text-muted-foreground mb-3 text-sm">Configure this redirect URI in your OIDC provider:</p>
- <div class="flex items-center gap-2">
- <code class="bg-muted flex-1 break-all rounded p-2 font-mono text-xs">
- {redirectUri}
- </code>
- <Button size="sm" variant="outline" onclick={() => copyToClipboard(redirectUri)} class="flex-shrink-0">
- <CopyIcon class="size-3" />
- </Button>
- </div>
+ <div class="bg-card/50 rounded-lg border p-4">
+ <h3 class="text-sm font-semibold">Tips</h3>
+ <ul class="text-muted-foreground mt-3 list-disc space-y-1 pl-5 text-xs">
+ <li>If your server forces OIDC, app settings become read-only.</li>
+ <li>Use issuer discovery; avoid hardcoding endpoints.</li>
+ <li>Keep client secrets out of the UI when possible.</li>
+ </ul>
+ </div>
+ </div>
+ </aside>
</div>
</div>
@@ -242,7 +267,7 @@
{#if !isOidcViewMode}
<Button onclick={onSave} class="flex-1 sm:flex-none">
<KeyIcon class="mr-2 size-4" />
- Configure OIDC
+ Save OIDC Settings
</Button>
{/if}
</Dialog.Footer>
diff --git a/frontend/src/lib/components/form/select-with-label.svelte b/frontend/src/lib/components/form/select-with-label.svelte
index 5979920e4..8ba95889f 100644
--- a/frontend/src/lib/components/form/select-with-label.svelte
+++ b/frontend/src/lib/components/form/select-with-label.svelte
@@ -4,44 +4,67 @@
let {
id,
- value = $bindable(),
+ name,
+ value = $bindable<string>(),
label,
description,
disabled = false,
placeholder = 'Select an option',
options = [],
+ groupLabel,
onValueChange
}: {
id: string;
+ name?: string;
value: string;
label: string;
description?: string;
disabled?: boolean;
placeholder?: string;
- options: { label: string; value: string }[];
+ options: { label: string; value: string; description?: string }[];
+ groupLabel?: string;
onValueChange?: (value: string) => void;
} = $props();
+
+ const selectedLabel = $derived(options.find((o) => o.value === value)?.label ?? placeholder);
</script>
<div class="grid gap-2">
<Label for={id} class="text-sm font-medium leading-none">
{label}
</Label>
- <Select.Root type="single" bind:value {disabled} onValueChange={(v) => onValueChange && onValueChange(v)}>
+
+ <Select.Root type="single" bind:value {name} {disabled} onValueChange={(v) => onValueChange?.(v)}>
<Select.Trigger class="w-full" {id}>
- <span>{options.find((option) => option.value === value)?.label || placeholder}</span>
+ <span>{selectedLabel}</span>
</Select.Trigger>
+
<Select.Content>
- {#each options as option (option.value)}
- <Select.Item value={option.value}>
- {option.label}
- </Select.Item>
- {/each}
+ {#if groupLabel}
+ <Select.Group>
+ <Select.Label>{groupLabel}</Select.Label>
+ {#each options as option (option.value)}
+ <Select.Item value={option.value}>
+ <div class="flex flex-col items-start gap-1">
+ <span class="font-medium">{option.label}</span>
+ {#if option.description}
+ <span class="text-muted-foreground text-xs">{option.description}</span>
+ {/if}
+ </div>
+ </Select.Item>
+ {/each}
+ </Select.Group>
+ {:else}
+ {#each options as option (option.value)}
+ <Select.Item value={option.value}>
+ {option.label}
+ </Select.Item>
+ {/each}
+ {/if}
</Select.Content>
</Select.Root>
+
{#if description}
- <p class="text-muted-foreground text-[0.8rem]">
- {description}
- </p>
+ <p class="text-muted-foreground text-[0.8rem]">{description}</p>
{/if}
</div>
diff --git a/frontend/src/lib/components/ui/field-set/field-set-content.svelte b/frontend/src/lib/components/ui/field-set/field-set-content.svelte
new file mode 100644
index 000000000..8459c52e0
--- /dev/null
+++ b/frontend/src/lib/components/ui/field-set/field-set-content.svelte
@@ -0,0 +1,10 @@
+<script lang="ts">
+ import { cn } from '$lib/utils';
+ import type { FieldSetTitleProps } from './types';
+
+ let { ref = $bindable(null), class: className, children, ...restProps }: FieldSetTitleProps = $props();
+</script>
+
+<div bind:this={ref} class={cn('p-6', className)} {...restProps}>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/field-set/field-set-footer.svelte b/frontend/src/lib/components/ui/field-set/field-set-footer.svelte
new file mode 100644
index 000000000..4f7f05c55
--- /dev/null
+++ b/frontend/src/lib/components/ui/field-set/field-set-footer.svelte
@@ -0,0 +1,10 @@
+<script lang="ts">
+ import { cn } from '$lib/utils';
+ import type { FieldSetFooterProps } from './types';
+
+ let { ref = $bindable(null), class: className, children, ...rest }: FieldSetFooterProps = $props();
+</script>
+
+<div bind:this={ref} class={cn('border-t border-inherit px-6 py-3', className)} {...rest}>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/field-set/field-set-title.svelte b/frontend/src/lib/components/ui/field-set/field-set-title.svelte
new file mode 100644
index 000000000..a4c729798
--- /dev/null
+++ b/frontend/src/lib/components/ui/field-set/field-set-title.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { cn } from '$lib/utils';
+ import type { FieldSetTitleProps } from './types';
+
+ let { ref = $bindable(null), class: className, level = 3, children, ...rest }: FieldSetTitleProps = $props();
+</script>
+
+<div
+ bind:this={ref}
+ role="heading"
+ aria-level={level}
+ bind:this={ref}
+ class={cn('text-2xl font-semibold leading-none tracking-tight', className)}
+ {...rest}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/field-set/field-set.svelte b/frontend/src/lib/components/ui/field-set/field-set.svelte
new file mode 100644
index 000000000..28eff61a2
--- /dev/null
+++ b/frontend/src/lib/components/ui/field-set/field-set.svelte
@@ -0,0 +1,11 @@
+<script lang="ts">
+ import { cn } from '$lib/utils';
+ import { fieldSetVariants } from '.';
+ import type { FieldSetRootProps } from './types';
+
+ let { ref = $bindable(null), variant = 'default', children, class: className, ...rest }: FieldSetRootProps = $props();
+</script>
+
+<div bind:this={ref} class={cn(fieldSetVariants({ variant }), className)} {...rest}>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/field-set/index.ts b/frontend/src/lib/components/ui/field-set/index.ts
new file mode 100644
index 000000000..c440a00f8
--- /dev/null
+++ b/frontend/src/lib/components/ui/field-set/index.ts
@@ -0,0 +1,29 @@
+import Root from './field-set.svelte';
+import Content from './field-set-content.svelte';
+import Footer from './field-set-footer.svelte';
+import Title from './field-set-title.svelte';
+import type { FieldSetRootProps, FieldSetTitleProps, FieldSetContentProps, FieldSetFooterProps } from './types';
+import { tv, type VariantProps } from 'tailwind-variants';
+
+export const fieldSetVariants = tv({
+ base: 'border-border flex h-fit w-full flex-col rounded-lg border',
+ variants: {
+ variant: {
+ default: 'border-border bg-card',
+ destructive: 'border-destructive'
+ }
+ }
+});
+
+export type Variant = VariantProps<typeof fieldSetVariants>['variant'];
+
+export {
+ Root,
+ Content,
+ Footer,
+ Title,
+ type FieldSetRootProps as RootProps,
+ type FieldSetTitleProps as TitleProps,
+ type FieldSetContentProps as ContentProps,
+ type FieldSetFooterProps as FooterProps
+};
diff --git a/frontend/src/lib/components/ui/field-set/types.ts b/frontend/src/lib/components/ui/field-set/types.ts
new file mode 100644
index 000000000..88e785471
--- /dev/null
+++ b/frontend/src/lib/components/ui/field-set/types.ts
@@ -0,0 +1,29 @@
+import type { WithChildren, WithoutChildren } from 'bits-ui';
+import type { Variant } from '.';
+import type { HTMLAttributes } from 'svelte/elements';
+
+export type FieldSetRootPropsWithoutHTML = WithChildren<{
+ ref?: HTMLDivElement | null;
+ variant?: Variant;
+}>;
+
+export type FieldSetRootProps = FieldSetRootPropsWithoutHTML & WithoutChildren<HTMLAttributes<HTMLDivElement>>;
+
+export type FieldSetContentPropsWithoutHTML = WithChildren<{
+ ref?: HTMLDivElement | null;
+}>;
+
+export type FieldSetContentProps = FieldSetContentPropsWithoutHTML & WithoutChildren<HTMLAttributes<HTMLDivElement>>;
+
+export type FieldSetTitlePropsWithoutHtml = WithChildren<{
+ ref?: HTMLHeadingElement | null;
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
+}>;
+
+export type FieldSetTitleProps = FieldSetTitlePropsWithoutHtml & WithoutChildren<HTMLAttributes<HTMLHeadingElement>>;
+
+export type FieldSetFooterPropsWithoutHTML = WithChildren<{
+ ref?: HTMLDivElement | null;
+}>;
+
+export type FieldSetFooterProps = FieldSetFooterPropsWithoutHTML & WithoutChildren<HTMLAttributes<HTMLDivElement>>;
diff --git a/frontend/src/lib/components/ui/select/index.ts b/frontend/src/lib/components/ui/select/index.ts
index 1ba651396..9e8d3e903 100644
--- a/frontend/src/lib/components/ui/select/index.ts
+++ b/frontend/src/lib/components/ui/select/index.ts
@@ -1,34 +1,37 @@
-import { Select as SelectPrimitive } from 'bits-ui';
+import { Select as SelectPrimitive } from "bits-ui";
-import GroupHeading from './select-group-heading.svelte';
-import Item from './select-item.svelte';
-import Content from './select-content.svelte';
-import Trigger from './select-trigger.svelte';
-import Separator from './select-separator.svelte';
-import ScrollDownButton from './select-scroll-down-button.svelte';
-import ScrollUpButton from './select-scroll-up-button.svelte';
+import Group from "./select-group.svelte";
+import Label from "./select-label.svelte";
+import Item from "./select-item.svelte";
+import Content from "./select-content.svelte";
+import Trigger from "./select-trigger.svelte";
+import Separator from "./select-separator.svelte";
+import ScrollDownButton from "./select-scroll-down-button.svelte";
+import ScrollUpButton from "./select-scroll-up-button.svelte";
+import GroupHeading from "./select-group-heading.svelte";
const Root = SelectPrimitive.Root;
-const Group = SelectPrimitive.Group;
export {
Root,
Group,
- GroupHeading,
+ Label,
Item,
Content,
Trigger,
Separator,
ScrollDownButton,
ScrollUpButton,
+ GroupHeading,
//
Root as Select,
Group as SelectGroup,
- GroupHeading as SelectGroupHeading,
+ Label as SelectLabel,
Item as SelectItem,
Content as SelectContent,
Trigger as SelectTrigger,
Separator as SelectSeparator,
ScrollDownButton as SelectScrollDownButton,
- ScrollUpButton as SelectScrollUpButton
+ ScrollUpButton as SelectScrollUpButton,
+ GroupHeading as SelectGroupHeading,
};
diff --git a/frontend/src/lib/components/ui/select/select-content.svelte b/frontend/src/lib/components/ui/select/select-content.svelte
index 796c425b5..dc16d65dd 100644
--- a/frontend/src/lib/components/ui/select/select-content.svelte
+++ b/frontend/src/lib/components/ui/select/select-content.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
- import { Select as SelectPrimitive, type WithoutChild } from 'bits-ui';
- import SelectScrollUpButton from './select-scroll-up-button.svelte';
- import SelectScrollDownButton from './select-scroll-down-button.svelte';
- import { cn } from '$lib/utils.js';
+ import { Select as SelectPrimitive } from "bits-ui";
+ import SelectScrollUpButton from "./select-scroll-up-button.svelte";
+ import SelectScrollDownButton from "./select-scroll-down-button.svelte";
+ import { cn, type WithoutChild } from "$lib/utils.js";
let {
ref = $bindable(null),
@@ -20,14 +20,19 @@
<SelectPrimitive.Content
bind:ref
{sideOffset}
+ data-slot="select-content"
class={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border shadow-md data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--bits-select-content-available-height) origin-(--bits-select-content-transform-origin) relative z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border shadow-md data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
{...restProps}
>
<SelectScrollUpButton />
- <SelectPrimitive.Viewport class={cn('h-(--bits-select-anchor-height) w-full min-w-(--bits-select-anchor-width) p-1')}>
+ <SelectPrimitive.Viewport
+ class={cn(
+ "h-(--bits-select-anchor-height) min-w-(--bits-select-anchor-width) w-full scroll-my-1 p-1"
+ )}
+ >
{@render children?.()}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
diff --git a/frontend/src/lib/components/ui/select/select-group-heading.svelte b/frontend/src/lib/components/ui/select/select-group-heading.svelte
index 32b9ec92f..1fab5f002 100644
--- a/frontend/src/lib/components/ui/select/select-group-heading.svelte
+++ b/frontend/src/lib/components/ui/select/select-group-heading.svelte
@@ -1,8 +1,21 @@
<script lang="ts">
- import { Select as SelectPrimitive } from 'bits-ui';
- import { cn } from '$lib/utils.js';
+ import { Select as SelectPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+ import type { ComponentProps } from "svelte";
- let { ref = $bindable(null), class: className, ...restProps }: SelectPrimitive.GroupHeadingProps = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: ComponentProps<typeof SelectPrimitive.GroupHeading> = $props();
</script>
-<SelectPrimitive.GroupHeading bind:ref class={cn('py-1.5 pr-2 pl-8 text-sm font-semibold', className)} {...restProps} />
+<SelectPrimitive.GroupHeading
+ bind:ref
+ data-slot="select-group-heading"
+ class={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</SelectPrimitive.GroupHeading>
diff --git a/frontend/src/lib/components/ui/select/select-group.svelte b/frontend/src/lib/components/ui/select/select-group.svelte
new file mode 100644
index 000000000..5454fdb39
--- /dev/null
+++ b/frontend/src/lib/components/ui/select/select-group.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { Select as SelectPrimitive } from "bits-ui";
+
+ let { ref = $bindable(null), ...restProps }: SelectPrimitive.GroupProps = $props();
+</script>
+
+<SelectPrimitive.Group data-slot="select-group" {...restProps} />
diff --git a/frontend/src/lib/components/ui/select/select-item.svelte b/frontend/src/lib/components/ui/select/select-item.svelte
index f72954447..49dbbd7fa 100644
--- a/frontend/src/lib/components/ui/select/select-item.svelte
+++ b/frontend/src/lib/components/ui/select/select-item.svelte
@@ -1,21 +1,32 @@
<script lang="ts">
- import Check from '@lucide/svelte/icons/check';
- import { Select as SelectPrimitive, type WithoutChild } from 'bits-ui';
- import { cn } from '$lib/utils.js';
+ import CheckIcon from "@lucide/svelte/icons/check";
+ import { Select as SelectPrimitive } from "bits-ui";
+ import { cn, type WithoutChild } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, value, label, children: childrenProp, ...restProps }: WithoutChild<SelectPrimitive.ItemProps> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ value,
+ label,
+ children: childrenProp,
+ ...restProps
+ }: WithoutChild<SelectPrimitive.ItemProps> = $props();
</script>
<SelectPrimitive.Item
bind:ref
{value}
- class={cn('data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-50', className)}
+ data-slot="select-item"
+ class={cn(
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
+ className
+ )}
{...restProps}
>
{#snippet children({ selected, highlighted })}
- <span class="absolute left-2 flex size-3.5 items-center justify-center">
+ <span class="absolute right-2 flex size-3.5 items-center justify-center">
{#if selected}
- <Check class="size-4" />
+ <CheckIcon class="size-4" />
{/if}
</span>
{#if childrenProp}
diff --git a/frontend/src/lib/components/ui/select/select-label.svelte b/frontend/src/lib/components/ui/select/select-label.svelte
new file mode 100644
index 000000000..46960259f
--- /dev/null
+++ b/frontend/src/lib/components/ui/select/select-label.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { cn, type WithElementRef } from "$lib/utils.js";
+ import type { HTMLAttributes } from "svelte/elements";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {} = $props();
+</script>
+
+<div
+ bind:this={ref}
+ data-slot="select-label"
+ class={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte b/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte
index aaabf723c..362920582 100644
--- a/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte
+++ b/frontend/src/lib/components/ui/select/select-scroll-down-button.svelte
@@ -1,11 +1,20 @@
<script lang="ts">
- import ChevronDown from '@lucide/svelte/icons/chevron-down';
- import { Select as SelectPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
- import { cn } from '$lib/utils.js';
+ import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
+ import { Select as SelectPrimitive } from "bits-ui";
+ import { cn, type WithoutChildrenOrChild } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, ...restProps }: WithoutChildrenOrChild<SelectPrimitive.ScrollDownButtonProps> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: WithoutChildrenOrChild<SelectPrimitive.ScrollDownButtonProps> = $props();
</script>
-<SelectPrimitive.ScrollDownButton bind:ref class={cn('flex cursor-default items-center justify-center py-1', className)} {...restProps}>
- <ChevronDown class="size-4" />
+<SelectPrimitive.ScrollDownButton
+ bind:ref
+ data-slot="select-scroll-down-button"
+ class={cn("flex cursor-default items-center justify-center py-1", className)}
+ {...restProps}
+>
+ <ChevronDownIcon class="size-4" />
</SelectPrimitive.ScrollDownButton>
diff --git a/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte b/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte
index 567ef3cf3..1aa2300c9 100644
--- a/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte
+++ b/frontend/src/lib/components/ui/select/select-scroll-up-button.svelte
@@ -1,11 +1,20 @@
<script lang="ts">
- import ChevronUp from '@lucide/svelte/icons/chevron-up';
- import { Select as SelectPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
- import { cn } from '$lib/utils.js';
+ import ChevronUpIcon from "@lucide/svelte/icons/chevron-up";
+ import { Select as SelectPrimitive } from "bits-ui";
+ import { cn, type WithoutChildrenOrChild } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, ...restProps }: WithoutChildrenOrChild<SelectPrimitive.ScrollUpButtonProps> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: WithoutChildrenOrChild<SelectPrimitive.ScrollUpButtonProps> = $props();
</script>
-<SelectPrimitive.ScrollUpButton bind:ref class={cn('flex cursor-default items-center justify-center py-1', className)} {...restProps}>
- <ChevronUp class="size-4" />
+<SelectPrimitive.ScrollUpButton
+ bind:ref
+ data-slot="select-scroll-up-button"
+ class={cn("flex cursor-default items-center justify-center py-1", className)}
+ {...restProps}
+>
+ <ChevronUpIcon class="size-4" />
</SelectPrimitive.ScrollUpButton>
diff --git a/frontend/src/lib/components/ui/select/select-separator.svelte b/frontend/src/lib/components/ui/select/select-separator.svelte
index b5d11e5b8..0eac3ebc5 100644
--- a/frontend/src/lib/components/ui/select/select-separator.svelte
+++ b/frontend/src/lib/components/ui/select/select-separator.svelte
@@ -1,9 +1,18 @@
<script lang="ts">
- import type { Separator as SeparatorPrimitive } from 'bits-ui';
- import { Separator } from '$lib/components/ui/separator/index.js';
- import { cn } from '$lib/utils.js';
+ import type { Separator as SeparatorPrimitive } from "bits-ui";
+ import { Separator } from "$lib/components/ui/separator/index.js";
+ import { cn } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, ...restProps }: SeparatorPrimitive.RootProps = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: SeparatorPrimitive.RootProps = $props();
</script>
-<Separator bind:ref class={cn('bg-muted -mx-1 my-1 h-px', className)} {...restProps} />
+<Separator
+ bind:ref
+ data-slot="select-separator"
+ class={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/select/select-trigger.svelte b/frontend/src/lib/components/ui/select/select-trigger.svelte
index 7cf61c7fb..d405187db 100644
--- a/frontend/src/lib/components/ui/select/select-trigger.svelte
+++ b/frontend/src/lib/components/ui/select/select-trigger.svelte
@@ -1,19 +1,29 @@
<script lang="ts">
- import { Select as SelectPrimitive, type WithoutChild } from 'bits-ui';
- import ChevronDown from '@lucide/svelte/icons/chevron-down';
- import { cn } from '$lib/utils.js';
+ import { Select as SelectPrimitive } from "bits-ui";
+ import ChevronDownIcon from "@lucide/svelte/icons/chevron-down";
+ import { cn, type WithoutChild } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, children, ...restProps }: WithoutChild<SelectPrimitive.TriggerProps> = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ size = "default",
+ ...restProps
+ }: WithoutChild<SelectPrimitive.TriggerProps> & {
+ size?: "sm" | "default";
+ } = $props();
</script>
<SelectPrimitive.Trigger
bind:ref
+ data-slot="select-trigger"
+ data-size={size}
class={cn(
- 'border-input bg-background ring-offset-background data-placeholder:text-muted-foreground focus:ring-ring flex h-10 w-full items-center justify-between rounded-md border px-3 py-2 text-sm focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 shadow-xs flex w-fit select-none items-center justify-between gap-2 whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
className
)}
{...restProps}
>
{@render children?.()}
- <ChevronDown class="size-4 opacity-50" />
+ <ChevronDownIcon class="size-4 opacity-50" />
</SelectPrimitive.Trigger>
diff --git a/frontend/src/lib/components/ui/separator/index.ts b/frontend/src/lib/components/ui/separator/index.ts
index 768efac96..82442d2cd 100644
--- a/frontend/src/lib/components/ui/separator/index.ts
+++ b/frontend/src/lib/components/ui/separator/index.ts
@@ -1,7 +1,7 @@
-import Root from './separator.svelte';
+import Root from "./separator.svelte";
export {
Root,
//
- Root as Separator
+ Root as Separator,
};
diff --git a/frontend/src/lib/components/ui/separator/separator.svelte b/frontend/src/lib/components/ui/separator/separator.svelte
index 4ce9e4c13..09d88f4a9 100644
--- a/frontend/src/lib/components/ui/separator/separator.svelte
+++ b/frontend/src/lib/components/ui/separator/separator.svelte
@@ -1,8 +1,20 @@
<script lang="ts">
- import { Separator as SeparatorPrimitive } from 'bits-ui';
- import { cn } from '$lib/utils.js';
+ import { Separator as SeparatorPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
- let { ref = $bindable(null), class: className, ...restProps }: SeparatorPrimitive.RootProps = $props();
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: SeparatorPrimitive.RootProps = $props();
</script>
-<SeparatorPrimitive.Root bind:ref data-slot="separator-root" class={cn('bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px', className)} {...restProps} />
+<SeparatorPrimitive.Root
+ bind:ref
+ data-slot="separator"
+ class={cn(
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px",
+ className
+ )}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.ts
index 0b4029b93..bad1d5572 100644
--- a/frontend/src/lib/types/settings.type.ts
+++ b/frontend/src/lib/types/settings.type.ts
@@ -7,7 +7,7 @@ export type SettingRawResponse = {
export type Settings = {
stacksDirectory: string;
- autoUpdateEnabled: boolean;
+ autoUpdate: boolean;
autoUpdateInterval: number;
pollingEnabled: boolean;
pollingInterval: number;
@@ -17,7 +17,7 @@ export type Settings = {
authLocalEnabled: boolean;
authOidcEnabled: boolean;
authSessionTimeout: number;
- authPasswordPolicy: string;
+ authPasswordPolicy: 'basic' | 'standard' | 'strong';
authRbacEnabled: boolean;
authOidcConfig: string;
diff --git a/frontend/src/routes/settings/+layout.svelte b/frontend/src/routes/settings/+layout.svelte
index 6550d0b97..1236f581f 100644
--- a/frontend/src/routes/settings/+layout.svelte
+++ b/frontend/src/routes/settings/+layout.svelte
@@ -11,7 +11,7 @@
</script>
<div class="settings-container">
- <div class="settings-content mx-auto w-full max-w-6xl px-4 sm:px-6 lg:px-8">
+ <div class="settings-content w-full px-4 sm:px-6 lg:px-8">
{@render children()}
</div>
</div>
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 725c02d50..5996214ab 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -1,53 +1,15 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
- import type { FormInput as FormInputType } from '$lib/utils/form.utils';
- import { Button } from '$lib/components/ui/button/index.js';
- import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
- import ImageMinusIcon from '@lucide/svelte/icons/image-minus';
- import SaveIcon from '@lucide/svelte/icons/save';
- import ClockIcon from '@lucide/svelte/icons/clock';
- import ZapIcon from '@lucide/svelte/icons/zap';
- import InfoIcon from '@lucide/svelte/icons/info';
- import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import * as Alert from '$lib/components/ui/alert/index.js';
- import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
import settingsStore from '$lib/stores/config-store';
import { settingsAPI } from '$lib/services/api';
- import FormInput from '$lib/components/form/form-input.svelte';
+ import DockerSettingsForm from '../forms/docker-settings-form.svelte';
+ import BoxesIcon from '@lucide/svelte/icons/boxes';
let { data } = $props();
let currentSettings = $state<Settings>(data.settings);
- let isLoading = $state({
- saving: false,
- testing: false
- });
-
- let pollingIntervalInput = $state<FormInputType<number>>({
- value: 0,
- error: null
- });
-
- let pollingEnabledSwitch = $state<FormInputType<boolean>>({
- value: false,
- error: null
- });
-
- let autoUpdateSwitch = $state<FormInputType<boolean>>({
- value: false,
- error: null
- });
-
- let autoUpdateIntervalInput = $state<FormInputType<number>>({
- value: 5,
- error: null
- });
-
- const _initialPruneMode = data.settings?.dockerPruneMode === 'dangling' ? 'dangling' : 'all';
-
- let pruneModeValue = $state<'all' | 'dangling'>(_initialPruneMode);
+ let isLoading = $state({ saving: false, testing: false });
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
@@ -62,237 +24,26 @@
throw error;
}
}
-
- function handleDockerSettingUpdates() {
- isLoading.saving = true;
- updateSettingsConfig({
- dockerPruneMode: pruneModeValue,
- autoUpdateEnabled: autoUpdateSwitch.value,
- pollingEnabled: pollingEnabledSwitch.value,
- pollingInterval: pollingIntervalInput.value,
- autoUpdateInterval: autoUpdateIntervalInput.value
- })
- .then(() => {
- toast.success(`Settings Saved Successfully`);
- })
- .catch((error) => {
- toast.error('Failed to save settings');
- console.error('Settings save error:', error);
- })
- .finally(() => {
- isLoading.saving = false;
- });
- }
-
- $effect(() => {
- if (!isLoading.saving) {
- pollingIntervalInput.value = currentSettings.pollingInterval || 60;
- pollingEnabledSwitch.value = currentSettings.pollingEnabled || false;
- autoUpdateSwitch.value = currentSettings.autoUpdateEnabled || false;
- autoUpdateIntervalInput.value = currentSettings.autoUpdateInterval || 60;
- pruneModeValue = currentSettings.dockerPruneMode === 'dangling' ? 'dangling' : 'all';
- }
- });
-
- let isPollingConfigValid = $derived(
- !pollingEnabledSwitch.value || (pollingIntervalInput.value >= 5 && pollingIntervalInput.value <= 1440)
- );
-
- let isAutoUpdateConfigValid = $derived(
- !autoUpdateSwitch.value || (autoUpdateIntervalInput.value >= 5 && autoUpdateIntervalInput.value <= 1440)
- );
-
- let canSave = $derived(isPollingConfigValid && isAutoUpdateConfigValid);
</script>
-<div class="settings-page">
- <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">
- <h1 class="settings-title text-3xl font-bold tracking-tight">Docker Settings</h1>
- <p class="settings-description text-muted-foreground max-w-2xl text-sm">
- Configure Docker automation behavior and container management settings
- </p>
+<div class="settings-page px-4 py-6">
+ <div
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-6 shadow-sm"
+ >
+ <div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
+ <div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
+ <div class="relative flex items-start gap-4">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-10 items-center justify-center rounded-lg ring-1">
+ <BoxesIcon class="size-5" />
</div>
-
- <div class="settings-actions">
- <Button
- onclick={() => handleDockerSettingUpdates()}
- disabled={isLoading.saving || !canSave}
- class="arcane-button-save h-10 min-w-[140px]"
- >
- {#if isLoading.saving}
- <RefreshCwIcon class="size-4 animate-spin" />
- Saving...
- {:else}
- <SaveIcon class="size-4" />
- Save Settings
- {/if}
- </Button>
+ <div>
+ <h1 class="settings-title">Docker Settings</h1>
+ <p class="settings-description">Configure Docker automation behavior and container management settings</p>
</div>
</div>
+ </div>
- <!-- Alert Section -->
- {#if autoUpdateSwitch.value && pollingEnabledSwitch.value}
- <div class="settings-alert">
- <Alert.Root variant="warning">
- <ZapIcon class="size-4" />
- <Alert.Title>Auto-update Enabled</Alert.Title>
- <Alert.Description>Automatic container updates are active with polling enabled</Alert.Description>
- </Alert.Root>
- </div>
- {/if}
-
- <!-- Settings Grid -->
- <div class="settings-grid grid gap-6 md:grid-cols-1">
- <div class="grid grid-cols-1 gap-6">
- <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-emerald-500/10 p-2.5">
- <ClockIcon class="size-5 text-emerald-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Image Automation</Card.Title>
- <Card.Description class="text-sm">Control automatic image polling and updates</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="space-y-6 pt-0">
- <FormInput
- bind:input={pollingEnabledSwitch}
- type="switch"
- id="pollingEnabled"
- label="Enable Image Polling"
- description="Periodically check registries for newer image versions"
- />
-
- {#if pollingEnabledSwitch.value}
- <div class="space-y-4 pl-4">
- <FormInput
- bind:input={pollingIntervalInput}
- type="number"
- id="pollingInterval"
- label="Polling Interval (minutes)"
- placeholder="60"
- description="How often to check for new images (5-1440 minutes)"
- />
-
- {#if pollingIntervalInput.value < 30}
- <Alert.Root variant="warning">
- <ZapIcon class="size-4" />
- <Alert.Title>Rate Limiting Warning</Alert.Title>
- <Alert.Description
- >Polling intervals below 30 minutes may trigger rate limits on Docker registries, potentially blocking your
- account temporarily. Consider using longer intervals for production environments.</Alert.Description
- >
- </Alert.Root>
- {/if}
-
- <FormInput
- bind:input={autoUpdateSwitch}
- type="switch"
- id="autoUpdateSwitch"
- label="Auto-update Containers"
- description="Automatically update containers when newer images are found"
- />
-
- {#if autoUpdateSwitch.value}
- <div class="pl-4">
- <FormInput
- bind:input={autoUpdateIntervalInput}
- type="number"
- id="autoUpdateInterval"
- label="Auto-update Interval (minutes)"
- placeholder="60"
- description="How often to perform automatic updates (5-1440 minutes)"
- />
- </div>
- {/if}
- </div>
-
- <Alert.Root>
- <InfoIcon />
- <Alert.Title>Automation Summary</Alert.Title>
- <Alert.Description>
- <ul class="list-inside list-disc text-sm">
- {#if autoUpdateSwitch.value}
- <li>Images checked every {pollingIntervalInput.value || 60} minutes</li>
- {:else}
- <li>Manual updates only (auto-update disabled)</li>
- {/if}
- </ul>
- </Alert.Description>
- </Alert.Root>
- {/if}
- </Card.Content>
- </Card.Root>
- </div>
-
- <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-purple-500/10 p-2.5">
- <ImageMinusIcon class="size-5 text-purple-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Image Pruning</Card.Title>
- <Card.Description class="text-sm">Configure cleanup behavior for unused Docker images</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="pt-0">
- <div class="space-y-4">
- <Label for="pruneMode" class="text-base font-medium">Prune Action Behavior</Label>
-
- <RadioGroup.Root
- value={pruneModeValue}
- onValueChange={(val) => {
- pruneModeValue = val as 'all' | 'dangling';
- updateSettingsConfig({ dockerPruneMode: pruneModeValue }).catch((error) => {
- toast.error('Failed to update prune mode');
- console.error('Error updating prune mode:', error);
- });
- }}
- class="space-y-3"
- id="pruneMode"
- >
- <div class="hover:bg-muted/50 flex items-start space-x-3 rounded-lg border p-3 transition-colors">
- <RadioGroup.Item value="all" id="prune-all" class="mt-0.5" />
- <div class="space-y-1">
- <Label for="prune-all" class="cursor-pointer font-medium">All Unused Images</Label>
- <p class="text-muted-foreground text-sm">
- Remove all images not referenced by containers (equivalent to <code
- class="bg-background rounded px-1 py-0.5 text-xs">docker image prune -a</code
- >)
- </p>
- </div>
- </div>
-
- <div class="hover:bg-muted/50 flex items-start space-x-3 rounded-lg border p-3 transition-colors">
- <RadioGroup.Item value="dangling" id="prune-dangling" class="mt-0.5" />
- <div class="space-y-1">
- <Label for="prune-dangling" class="cursor-pointer font-medium">Dangling Images Only</Label>
- <p class="text-muted-foreground text-sm">
- Remove only untagged images (equivalent to <code class="bg-background rounded px-1 py-0.5 text-xs"
- >docker image prune</code
- >)
- </p>
- </div>
- </div>
- </RadioGroup.Root>
-
- <div class="bg-muted/50 rounded-lg p-3">
- <p class="text-muted-foreground text-sm">
- <strong>Note:</strong> This setting affects the "Prune Unused Images" action on the Images page.
- {pruneModeValue === 'all'
- ? 'All unused images will be removed, which frees up more space but may require re-downloading images later.'
- : 'Only dangling images will be removed, which is safer but may leave some unused images behind.'}
- </p>
- </div>
- </div>
- </Card.Content>
- </Card.Root>
- </div>
+ <div class="settings-grid settings-grid-single">
+ <DockerSettingsForm settings={currentSettings} callback={updateSettingsConfig} />
</div>
</div>
diff --git a/frontend/src/routes/settings/forms/docker-settings-form.svelte b/frontend/src/routes/settings/forms/docker-settings-form.svelte
new file mode 100644
index 000000000..a4eb1cdea
--- /dev/null
+++ b/frontend/src/routes/settings/forms/docker-settings-form.svelte
@@ -0,0 +1,139 @@
+<script lang="ts">
+ import ZapIcon from '@lucide/svelte/icons/zap';
+ import * as Alert from '$lib/components/ui/alert/index.js';
+ import { toast } from 'svelte-sonner';
+ import type { Settings } from '$lib/types/settings.type';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import { Button } from '$lib/components/ui/button';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import * as FieldSet from '$lib/components/ui/field-set';
+ import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
+
+ let {
+ callback,
+ settings
+ }: {
+ settings: Settings;
+ callback: (appConfig: Partial<Settings>) => Promise<void>;
+ } = $props();
+
+ let isLoading = $state(false);
+ let pruneMode = $state(settings.dockerPruneMode);
+
+ const pruneModeOptions = [
+ { value: 'all', label: 'All', description: 'Remove all images not referenced by containers (docker image prune -a)' },
+ { value: 'dangling', label: 'Dangling', description: 'Remove only untagged images (docker image prune)' }
+ ];
+
+ const pruneModeDescription = $derived(
+ pruneModeOptions.find((o) => o.value === pruneMode)?.description ?? 'Choose how unused images should be pruned.'
+ );
+
+ 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, settings));
+
+ async function onSubmit() {
+ const data = form.validate();
+ if (!data) return;
+ isLoading = true;
+
+ await callback(data).finally(() => (isLoading = false));
+ toast.success('Settings Updated Succesfully');
+ }
+</script>
+
+{#if settings.autoUpdate && settings.pollingEnabled}
+ <div class="mb-4">
+ <Alert.Root variant="warning">
+ <ZapIcon class="size-4" />
+ <Alert.Title>Auto-update Enabled</Alert.Title>
+ <Alert.Description>Automatic container updates are active with polling enabled</Alert.Description>
+ </Alert.Root>
+ </div>
+{/if}
+
+<form onsubmit={preventDefault(onSubmit)} class="space-y-6">
+ <div class="w-full p-6">
+ <FieldSet.Root>
+ <FieldSet.Content class="flex flex-col gap-8">
+ <div class="min-w-0 space-y-4">
+ <SwitchWithLabel
+ id="pollingEnabled"
+ label="Enable Image Polling"
+ description="Periodically check registries for newer image versions"
+ bind:checked={$formInputs.pollingEnabled.value}
+ />
+ {#if $formInputs.pollingEnabled.value}
+ <div class="space-y-4">
+ <FormInput
+ bind:input={$formInputs.pollingInterval}
+ type="number"
+ id="pollingInterval"
+ label="Polling Interval (minutes)"
+ placeholder="60"
+ description="How often to check for new images (5-1440 minutes)"
+ />
+ <div>
+ {#if $formInputs.pollingInterval.value < 30}
+ <Alert.Root variant="warning">
+ <ZapIcon class="size-4" />
+ <Alert.Title>Rate Limiting Warning</Alert.Title>
+ <Alert.Description>
+ Polling intervals below 30 minutes may trigger registry rate limits. Prefer longer intervals in production.
+ </Alert.Description>
+ </Alert.Root>
+ {/if}
+ </div>
+ <div>
+ <SwitchWithLabel
+ id="autoUpdateSwitch"
+ label="Auto-update Containers"
+ description="Automatically update containers when newer images are found"
+ bind:checked={$formInputs.autoUpdate.value}
+ />
+ </div>
+ {#if $formInputs.autoUpdate.value}
+ <FormInput
+ bind:input={$formInputs.autoUpdateInterval}
+ type="number"
+ id="autoUpdateInterval"
+ label="Auto-update Interval (minutes)"
+ placeholder="60"
+ description="How often to perform automatic updates (5-1440 minutes)"
+ />
+ {/if}
+ </div>
+ {/if}
+ </div>
+ <div class="min-w-0">
+ <SelectWithLabel
+ id="dockerPruneMode"
+ name="pruneMode"
+ bind:value={pruneMode}
+ label="Image Prune Action Behavior"
+ description={pruneModeDescription}
+ placeholder="Docker Prune Mode"
+ options={pruneModeOptions}
+ groupLabel="Image Prune Modes"
+ onValueChange={(v) => (pruneMode = v as 'all' | 'dangling')}
+ />
+ </div>
+ </FieldSet.Content>
+ <FieldSet.Footer>
+ <div class="flex w-full place-items-center justify-between">
+ <span class="text-muted-foreground text-sm">Save your updated settings.</span>
+ <Button type="submit" disabled={isLoading} size="sm">{isLoading ? 'Saving…' : 'Save'}</Button>
+ </div>
+ </FieldSet.Footer>
+ </FieldSet.Root>
+ </div>
+</form>
diff --git a/frontend/src/routes/settings/forms/general-settings-form.svelte b/frontend/src/routes/settings/forms/general-settings-form.svelte
new file mode 100644
index 000000000..33c3e9d39
--- /dev/null
+++ b/frontend/src/routes/settings/forms/general-settings-form.svelte
@@ -0,0 +1,67 @@
+<script lang="ts">
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import { Button } from '$lib/components/ui/button';
+ import * as FieldSet from '$lib/components/ui/field-set';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import type { Settings } from '$lib/types/settings.type';
+ import { toast } from 'svelte-sonner';
+
+ let {
+ settings,
+ callback
+ }: {
+ settings: Settings;
+ callback: (appConfig: Partial<Settings>) => Promise<void>;
+ } = $props();
+
+ let isLoading = $state(false);
+
+ const formSchema = z.object({
+ stacksDirectory: z.string().min(1, 'Projects directory is required'),
+ baseServerUrl: z.string().min(1, 'Base server URL is required')
+ });
+
+ let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, settings));
+
+ async function onSubmit() {
+ const data = form.validate();
+ if (!data) return;
+ isLoading = true;
+
+ await callback(data)
+ .then(() => toast.success('Settings Updated Successfully'))
+ .finally(() => (isLoading = false));
+ }
+</script>
+
+<form onsubmit={preventDefault(onSubmit)} class="space-y-6">
+ <div class="w-full p-6">
+ <FieldSet.Root>
+ <FieldSet.Content class="flex flex-col gap-8">
+ <div class="min-w-0 space-y-4">
+ <FormInput
+ label="Projects Directory"
+ placeholder="data/projects"
+ bind:input={$formInputs.stacksDirectory}
+ helpText="Directory where Docker Compose files are stored (this is inside the container)"
+ />
+
+ <FormInput
+ label="Base Server URL"
+ placeholder="localhost"
+ bind:input={$formInputs.baseServerUrl}
+ helpText="Base URL for accessing Arcane (used for webhooks and notifications)"
+ />
+ </div>
+ </FieldSet.Content>
+
+ <FieldSet.Footer>
+ <div class="flex w-full place-items-center justify-between">
+ <span class="text-muted-foreground text-sm">Save your updated settings.</span>
+ <Button type="submit" disabled={isLoading} size="sm">{isLoading ? 'Saving…' : 'Save'}</Button>
+ </div>
+ </FieldSet.Footer>
+ </FieldSet.Root>
+ </div>
+</form>
diff --git a/frontend/src/routes/settings/forms/security-settings-form.svelte b/frontend/src/routes/settings/forms/security-settings-form.svelte
new file mode 100644
index 000000000..a78edb6ad
--- /dev/null
+++ b/frontend/src/routes/settings/forms/security-settings-form.svelte
@@ -0,0 +1,250 @@
+<script lang="ts">
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import * as FieldSet from '$lib/components/ui/field-set';
+ import { Button } from '$lib/components/ui/button';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
+ import { toast } from 'svelte-sonner';
+ import type { Settings } from '$lib/types/settings.type';
+ import type { OidcStatus } from '$lib/services/api/oidc-api-service';
+ import * as Tooltip from '$lib/components/ui/tooltip/index.js';
+
+ let {
+ settings,
+ oidcStatus,
+ callback
+ }: {
+ settings: Settings;
+ oidcStatus: OidcStatus;
+ callback: (appConfig: Partial<Settings>) => Promise<void>;
+ } = $props();
+
+ let isLoading = $state({ saving: false });
+ let showOidcConfigDialog = $state(false);
+
+ let oidcConfigForm = $state({
+ clientId: '',
+ clientSecret: '',
+ issuerUrl: '',
+ scopes: 'openid email profile'
+ });
+
+ const formSchema = z.object({
+ authLocalEnabled: z.boolean(),
+ authOidcEnabled: z.boolean(),
+ authSessionTimeout: z
+ .number('Session timeout is required')
+ .int('Must be an integer')
+ .min(15, 'Minimum is 15 minutes')
+ .max(1440, 'Maximum is 1440 minutes'),
+ authPasswordPolicy: z.enum(['basic', 'standard', 'strong'])
+ });
+
+ let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, settings));
+
+ async function onSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ isLoading.saving = true;
+
+ let authOidcConfig = settings.authOidcConfig;
+ if (data.authOidcEnabled && !oidcStatus.envForced) {
+ authOidcConfig = JSON.stringify({
+ clientId: oidcConfigForm.clientId,
+ clientSecret: oidcConfigForm.clientSecret || '',
+ issuerUrl: oidcConfigForm.issuerUrl,
+ scopes: oidcConfigForm.scopes
+ });
+ }
+
+ await callback({
+ authLocalEnabled: data.authLocalEnabled,
+ authOidcEnabled: data.authOidcEnabled,
+ authSessionTimeout: data.authSessionTimeout,
+ authPasswordPolicy: data.authPasswordPolicy
+ })
+ .then(() => toast.success('Settings Saved Successfully'))
+ .finally(() => (isLoading.saving = false));
+ }
+ const effectivelyEnabled = $derived(oidcStatus.envForced || oidcStatus.dbEnabled);
+
+ function handleOidcSwitchChange(checked: boolean) {
+ $formInputs.authOidcEnabled.value = checked;
+
+ if (checked && !oidcStatus.envForced && !effectivelyEnabled) {
+ showOidcConfigDialog = true;
+ }
+ }
+
+ function openOidcDialog() {
+ if (settings.authOidcConfig) {
+ const cfg = JSON.parse(settings.authOidcConfig);
+ oidcConfigForm.clientId = cfg.clientId || '';
+ oidcConfigForm.issuerUrl = cfg.issuerUrl || '';
+ oidcConfigForm.scopes = cfg.scopes || 'openid email profile';
+ }
+ oidcConfigForm.clientSecret = '';
+ showOidcConfigDialog = true;
+ }
+
+ async function handleSaveOidcConfig() {
+ try {
+ isLoading.saving = true;
+ $formInputs.authOidcEnabled.value = true;
+
+ const data = form.validate();
+ if (!data) {
+ isLoading.saving = false;
+ return;
+ }
+
+ const authOidcConfig = JSON.stringify({
+ clientId: oidcConfigForm.clientId,
+ clientSecret: oidcConfigForm.clientSecret || '',
+ issuerUrl: oidcConfigForm.issuerUrl,
+ scopes: oidcConfigForm.scopes
+ });
+
+ await callback({
+ authOidcEnabled: true,
+ authOidcConfig
+ });
+
+ toast.success('OIDC configuration saved successfully.');
+ showOidcConfigDialog = false;
+ } finally {
+ isLoading.saving = false;
+ }
+ }
+</script>
+
+<form onsubmit={preventDefault(onSubmit)} class="space-y-6">
+ <div class="w-full p-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">Authentication</h2>
+
+ <SwitchWithLabel
+ id="localAuthSwitch"
+ label="Local Authentication"
+ description="Username and password stored by Arcane. Keep enabled as a fallback."
+ bind:checked={$formInputs.authLocalEnabled.value}
+ />
+
+ <div class="space-y-2">
+ <SwitchWithLabel
+ id="oidcAuthSwitch"
+ label="OIDC Authentication"
+ description={`Use an external OIDC provider${oidcStatus.envForced ? ' (forced by server)' : ''}`}
+ disabled={oidcStatus.envForced}
+ checked={$formInputs.authOidcEnabled.value}
+ onCheckedChange={handleOidcSwitchChange}
+ />
+ {#if effectivelyEnabled}
+ <div class="pl-11">
+ {#if oidcStatus.envForced && !oidcStatus.envConfigured}
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ Server forces OIDC, but env vars missing. Configure or fix server env.
+ </Button>
+ {:else if oidcStatus.envForced && oidcStatus.envConfigured}
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ OIDC configured & forced by server. View status.
+ </Button>
+ {:else if !oidcStatus.envForced && effectivelyEnabled && oidcStatus.dbConfigured}
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
+ OIDC configured via application settings. Manage.
+ </Button>
+ {:else if !oidcStatus.envForced && effectivelyEnabled && !oidcStatus.dbConfigured}
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
+ OIDC enabled, but settings incomplete. Configure.
+ </Button>
+ {/if}
+ </div>
+ {/if}
+ </div>
+ </div>
+
+ <div class="min-w-0 space-y-4">
+ <h2 class="text-muted-foreground text-sm font-semibold">Session</h2>
+
+ <FormInput
+ type="number"
+ id="sessionTimeout"
+ label="Session Timeout (minutes)"
+ placeholder="60"
+ bind:input={$formInputs.authSessionTimeout}
+ description="Inactive sessions will be logged out automatically (15–1440 minutes)."
+ />
+
+ <div class="space-y-2">
+ <span class="text-sm font-medium" id="passwordPolicyLabel">Password Policy</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">Basic</Button
+ >
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">Minimum 8 characters.</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">Standard</Button
+ >
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">10+ chars with upper, lower, and a number.</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">Strong</Button
+ >
+ </Tooltip.Trigger>
+ <Tooltip.Content side="top" align="center">12+ chars with upper, lower, number, and symbol.</Tooltip.Content>
+ </Tooltip.Root>
+ </div>
+ </Tooltip.Provider>
+ </div>
+ </div>
+ </FieldSet.Content>
+
+ <FieldSet.Footer>
+ <div class="flex w-full place-items-center justify-between">
+ <span class="text-muted-foreground text-sm">Save your updated settings.</span>
+ <Button type="submit" disabled={isLoading.saving} size="sm">{isLoading.saving ? 'Saving…' : 'Save'}</Button>
+ </div>
+ </FieldSet.Footer>
+ </FieldSet.Root>
+ </div>
+
+ <OidcConfigDialog
+ bind:open={showOidcConfigDialog}
+ currentSettings={settings}
+ {oidcStatus}
+ bind:oidcForm={oidcConfigForm}
+ onSave={handleSaveOidcConfig}
+ />
+</form>
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index 29fb2fda0..e89aa9416 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -1,26 +1,17 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
- import FormInput from '$lib/components/form/form-input.svelte';
- import { Button } from '$lib/components/ui/button/index.js';
- import SaveIcon from '@lucide/svelte/icons/save';
- import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
- import FolderIcon from '@lucide/svelte/icons/folder';
- import GlobeIcon from '@lucide/svelte/icons/globe';
- import type { FormInput as FormInputType } from '$lib/utils/form.utils';
- import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
import settingsStore from '$lib/stores/config-store';
import { settingsAPI } from '$lib/services/api';
+ import GeneralSettingsForm from '../forms/general-settings-form.svelte';
+ import SettingsIcon from '@lucide/svelte/icons/settings';
let { data } = $props();
let currentSettings = $state(data.settings);
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
- currentSettings = await settingsAPI.updateSettings({
- ...currentSettings,
- ...updatedSettings
- });
+ await settingsAPI.updateSettings(updatedSettings as any);
+ currentSettings = { ...currentSettings, ...updatedSettings };
settingsStore.set(currentSettings);
settingsStore.reload();
} catch (error) {
@@ -28,119 +19,26 @@
throw error;
}
}
-
- function handleGeneralSettingUpdates() {
- isLoading.saving = true;
- updateSettingsConfig({
- stacksDirectory: projectsDirectoryInput.value,
- baseServerUrl: baseServerUrlInput.value
- })
- .then(async () => {
- toast.success(`Settings Saved Successfully`);
- })
- .catch((error) => {
- toast.error('Failed to save settings');
- console.error('Settings save error:', error);
- })
- .finally(() => {
- isLoading.saving = false;
- });
- }
-
- let projectsDirectoryInput = $state<FormInputType<string>>({
- value: '',
- error: null
- });
-
- let baseServerUrlInput = $state<FormInputType<string>>({
- value: '',
- error: null
- });
-
- let isLoading = $state({
- saving: false
- });
-
- $effect(() => {
- const s = $settingsStore ?? currentSettings;
- if (!s) return;
-
- currentSettings = s;
-
- if (!isLoading.saving) {
- projectsDirectoryInput.value = s.stacksDirectory || '';
- baseServerUrlInput.value = s.baseServerUrl || 'localhost';
- }
- });
</script>
-<div class="space-y-8">
- <!-- Header -->
- <div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
- <div class="space-y-1">
- <h1 class="text-3xl font-bold tracking-tight">General Settings</h1>
- <p class="text-muted-foreground max-w-2xl text-sm">
- Core configuration for how Arcane operates and manages your containers.
- </p>
+<div class="settings-page px-4 py-6">
+ <div
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-6 shadow-sm"
+ >
+ <div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
+ <div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
+ <div class="relative flex items-start gap-4">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-10 items-center justify-center rounded-lg ring-1">
+ <SettingsIcon class="size-5" />
+ </div>
+ <div>
+ <h1 class="settings-title">General Settings</h1>
+ <p class="settings-description">Core configuration for how Arcane operates</p>
+ </div>
</div>
-
- <Button onclick={() => handleGeneralSettingUpdates()} disabled={isLoading.saving} class="h-10 min-w-[140px]">
- {#if isLoading.saving}
- <RefreshCwIcon class="size-4 animate-spin" />
- Saving...
- {:else}
- <SaveIcon class="size-4" />
- Save Settings
- {/if}
- </Button>
</div>
- <!-- Settings Cards -->
- <div class="grid gap-6 md:grid-cols-2">
- <!-- Storage Configuration -->
- <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-blue-500/10 p-2">
- <FolderIcon class="size-5 text-blue-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Storage Configuration</Card.Title>
- <Card.Description class="text-sm">Configure where Arcane stores stack files and data</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="pt-0">
- <FormInput
- label="Projects Directory"
- placeholder="data/projects"
- bind:input={projectsDirectoryInput}
- helpText="Directory where Docker Compose files are stored (this is inside the container)"
- />
- </Card.Content>
- </Card.Root>
-
- <!-- Network Configuration -->
- <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-green-500/10 p-2">
- <GlobeIcon class="size-5 text-green-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Network Configuration</Card.Title>
- <Card.Description class="text-sm">Configure base server URL and network settings</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="pt-0">
- <FormInput
- label="Base Server URL"
- placeholder="localhost"
- bind:input={baseServerUrlInput}
- helpText="Base URL for accessing Arcane (used for webhooks and notifications)"
- />
- </Card.Content>
- </Card.Root>
+ <div class="settings-grid settings-grid-single">
+ <GeneralSettingsForm settings={currentSettings} callback={updateSettingsConfig} />
</div>
</div>
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index 4d90dbc0d..6aaeaf2b7 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -1,70 +1,18 @@
<script lang="ts">
import type { PageData } from './$types';
- import * as Card from '$lib/components/ui/card/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Switch } from '$lib/components/ui/switch/index.js';
- 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 SaveIcon from '@lucide/svelte/icons/save';
- import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
- import settingsStore from '$lib/stores/config-store';
- import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
- import { toast } from 'svelte-sonner';
- import { invalidateAll } from '$app/navigation';
import type { Settings } from '$lib/types/settings.type';
+ import settingsStore from '$lib/stores/config-store';
import { settingsAPI } from '$lib/services/api';
+ import SecuritySettingsForm from '../forms/security-settings-form.svelte';
+ import LockIcon from '@lucide/svelte/icons/lock';
let { data }: { data: PageData } = $props();
- let currentSettings = $state(data.settings);
-
- let showOidcConfigDialog = $state(false);
- let oidcConfigForm = $state({
- clientId: '',
- clientSecret: '',
- issuerUrl: '',
- scopes: 'openid email profile'
- });
-
- let localAuthEnabled = $state(true);
- let oidcEnabled = $state(false);
- let sessionTimeout = $state(60);
- let passwordPolicy = $state('strong');
-
- let isLoading = $state({
- saving: false
- });
-
- let isOidcViewMode = $derived(data.oidcStatus.envForced && data.oidcStatus.envConfigured);
-
- $effect(() => {
- localAuthEnabled = currentSettings.authLocalEnabled ?? true;
- oidcEnabled = currentSettings.authOidcEnabled ?? false;
- sessionTimeout = currentSettings.authSessionTimeout ?? 60;
- passwordPolicy = currentSettings.authPasswordPolicy ?? 'strong';
-
- // Parse OIDC config from string if it exists
- if (currentSettings.authOidcConfig) {
- try {
- const oidcConfig = JSON.parse(currentSettings.authOidcConfig);
- oidcConfigForm.clientId = oidcConfig.clientId || '';
- oidcConfigForm.scopes = oidcConfig.scopes || 'openid email profile';
- oidcConfigForm.issuerUrl = oidcConfig.issuerUrl || '';
- } catch (e) {
- console.warn('Failed to parse OIDC config:', e);
- }
- }
- oidcConfigForm.clientSecret = '';
- });
+ let currentSettings = $state<Settings>(data.settings);
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
- currentSettings = await settingsAPI.updateSettings({
- ...currentSettings,
- ...updatedSettings
- });
+ await settingsAPI.updateSettings(updatedSettings as any);
+ currentSettings = { ...currentSettings, ...updatedSettings };
settingsStore.set(currentSettings);
settingsStore.reload();
} catch (error) {
@@ -72,269 +20,26 @@
throw error;
}
}
-
- function handleSecuritySettingUpdates() {
- isLoading.saving = true;
-
- // Prepare OIDC config if needed
- let oidcConfigString = currentSettings.authOidcConfig;
- if (oidcEnabled && !data.oidcStatus.envForced) {
- oidcConfigString = JSON.stringify({
- clientId: oidcConfigForm.clientId,
- clientSecret: oidcConfigForm.clientSecret || '',
- issuerUrl: oidcConfigForm.issuerUrl,
- scopes: oidcConfigForm.scopes
- });
- }
-
- updateSettingsConfig({
- authLocalEnabled: localAuthEnabled,
- authOidcEnabled: oidcEnabled,
- authSessionTimeout: sessionTimeout,
- authPasswordPolicy: passwordPolicy,
- authOidcConfig: oidcConfigString
- })
- .then(async () => {
- toast.success(`Settings Saved Successfully`);
- })
- .catch((error) => {
- toast.error('Failed to save settings');
- console.error('Settings save error:', error);
- })
- .finally(() => {
- isLoading.saving = false;
- });
- }
-
- function handleOidcSwitchChange(checked: boolean) {
- oidcEnabled = checked;
-
- if (checked && !data.oidcStatus.envForced && !data.oidcStatus.effectivelyConfigured) {
- showOidcConfigDialog = true;
- }
- }
-
- function openOidcDialog() {
- if (!isOidcViewMode) {
- if (currentSettings.authOidcConfig) {
- try {
- const oidcConfig = JSON.parse(currentSettings.authOidcConfig);
- oidcConfigForm.clientId = oidcConfig.clientId || '';
- oidcConfigForm.issuerUrl = oidcConfig.issuerUrl || '';
- oidcConfigForm.scopes = oidcConfig.scopes || 'openid email profile';
- } catch (e) {
- console.warn('Failed to parse OIDC config:', e);
- }
- }
- oidcConfigForm.clientSecret = '';
- }
- showOidcConfigDialog = true;
- }
-
- async function handleSaveOidcConfig() {
- try {
- isLoading.saving = true;
- oidcEnabled = true;
-
- const oidcConfigString = JSON.stringify({
- clientId: oidcConfigForm.clientId,
- clientSecret: oidcConfigForm.clientSecret || '',
- issuerUrl: oidcConfigForm.issuerUrl,
- scopes: oidcConfigForm.scopes
- });
-
- await updateSettingsConfig({
- authLocalEnabled: localAuthEnabled,
- authOidcEnabled: true,
- authSessionTimeout: sessionTimeout,
- authPasswordPolicy: passwordPolicy,
- authOidcConfig: oidcConfigString
- });
-
- toast.success('OIDC configuration saved successfully.');
- showOidcConfigDialog = false;
- await invalidateAll();
- } catch (error) {
- console.error('Failed to save OIDC configuration:', error);
- toast.error('Failed to save OIDC configuration.', {
- description: error instanceof Error ? error.message : 'An unknown error occurred.'
- });
- } finally {
- isLoading.saving = false;
- }
- }
</script>
-<div class="settings-page">
- <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">
- <h1 class="text-3xl font-bold tracking-tight">Security Settings</h1>
- <p class="text-muted-foreground max-w-2xl text-sm">
- Configure authentication methods, session policies, and security settings.
- </p>
+<div class="settings-page px-4 py-6">
+ <div
+ class="from-background/60 via-background/40 to-background/60 relative overflow-hidden rounded-xl border bg-gradient-to-br p-6 shadow-sm"
+ >
+ <div class="bg-primary/10 pointer-events-none absolute -right-10 -top-10 size-40 rounded-full blur-3xl"></div>
+ <div class="bg-muted/40 pointer-events-none absolute -bottom-10 -left-10 size-40 rounded-full blur-3xl"></div>
+ <div class="relative flex items-start gap-4">
+ <div class="bg-primary/10 text-primary ring-primary/20 flex size-10 items-center justify-center rounded-lg ring-1">
+ <LockIcon class="size-5" />
</div>
-
<div>
- <Button onclick={() => handleSecuritySettingUpdates()} disabled={isLoading.saving} class="h-10 min-w-[140px]">
- {#if isLoading.saving}
- <RefreshCwIcon class="size-4 animate-spin" />
- Saving...
- {:else}
- <SaveIcon class="size-4" />
- Save Settings
- {/if}
- </Button>
+ <h1 class="settings-title">Security Settings</h1>
+ <p class="settings-description">Configure authentication methods, session policies, and security settings.</p>
</div>
</div>
+ </div>
- <div class="grid gap-6 md:grid-cols-2">
- <Card.Root class="settings-card rounded-lg border shadow-sm">
- <Card.Header class="settings-card-header pb-2">
- <div class="settings-card-title-wrapper flex items-center gap-3">
- <div class="settings-card-icon rounded-md bg-indigo-500/10 p-2">
- <LockIcon class="size-5 text-indigo-600" />
- </div>
- <div>
- <Card.Title class="settings-card-title text-lg">Authentication Methods</Card.Title>
- <Card.Description class="settings-card-description 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>
-
- <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>
-
- {#if data.oidcStatus.effectivelyEnabled || data.oidcStatus.envForced}
- <div class="mt-1">
- {#if data.oidcStatus.envForced && !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 missing. Configure app settings or fix server env.
- </Button>
- {:else if data.oidcStatus.envForced && data.oidcStatus.envConfigured}
- <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.
- </Button>
- {:else if !data.oidcStatus.envForced && data.oidcStatus.effectivelyEnabled && data.oidcStatus.dbConfigured}
- <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 via application settings. Manage.
- </Button>
- {:else if !data.oidcStatus.envForced && data.oidcStatus.effectivelyEnabled && !data.oidcStatus.dbConfigured}
- <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
- <TriangleAlertIcon class="mr-1 size-3" />
- OIDC enabled, but app settings incomplete. Configure.
- </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}
- />
-
- <Card.Root class="settings-card rounded-lg border shadow-sm">
- <Card.Header class="settings-card-header pb-2">
- <div class="settings-card-title-wrapper flex items-center gap-3">
- <div class="settings-card-icon rounded-md bg-cyan-500/10 p-2">
- <KeyIcon class="size-5 text-cyan-600" />
- </div>
- <div>
- <Card.Title class="settings-card-title text-lg">Session Settings</Card.Title>
- <Card.Description class="settings-card-description text-sm">
- Configure session behavior and password policies
- </Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="pt-0">
- <div class="space-y-5">
- <div class="space-y-2">
- <label for="sessionTimeout" class="text-sm font-medium">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>
- </div>
-
- <div class="space-y-2">
- <label for="passwordPolicy" class="text-sm font-medium">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
- {/if}
- </p>
- </div>
- </div>
- </Card.Content>
- </Card.Root>
- </div>
+ <div class="settings-grid settings-grid-single">
+ <SecuritySettingsForm settings={currentSettings} oidcStatus={data.oidcStatus} callback={updateSettingsConfig} />
</div>
</div>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6da2e893a..4f28ef347 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -84,8 +84,8 @@ importers:
specifier: ^3.9.0
version: 3.9.0
'@lucide/svelte':
- specifier: ^0.542.0
- version: 0.542.0([email protected])
+ specifier: ^0.515.0
+ version: 0.515.0([email protected])
'@sveltejs/kit':
specifier: ^2.31.0
@@ -539,8 +539,8 @@ packages:
resolution: {integrity: sha512-GuBLekbw9jDBDhGur82nuwkxKQ+a3W5H0GfaAthDXcAu+XdpS43VlnxA9E9hllkpSP5ellRDKjLLj7Lu9Wr6xA==}
- '@lucide/[email protected]':
- resolution: {integrity: sha512-NuWttxTVfMSURpOxcKiKvoCtma3JtEpcJWzF/0cO69saZfXlv6G8NYAvEEGLmk75YPl+I+ROe+F97WhddM8r2A==}
+ '@lucide/[email protected]':
+ resolution: {integrity: sha512-CEAyqcZmNBfYzVgaRmK2RFJP5tnbXxekRyDk0XX/eZQRfsJmkDvmQwXNX8C869BgNeryzmrRyjHhUL6g9ZOHNA==}
peerDependencies:
svelte: ^5
@@ -2568,7 +2568,7 @@ snapshots:
'@lezer/highlight': 1.2.1
'@lezer/lr': 1.4.2
dependencies:
svelte: 5.38.1