Skip to content

Modern Docker Management, Designed for Everyone

chore: fix some ui issues

Kyle Mendell5360bd619c34
diff --git a/frontend/src/app.css b/frontend/src/app.css
index 8465c2e89..0b62d3ee1 100644
--- a/frontend/src/app.css
+++ b/frontend/src/app.css
@@ -346,3 +346,134 @@ main {
.flex {
min-width: 0;
}
+
+/* Settings Page Styles */
+
+/* Unified page structure */
+.settings-page {
+ @apply space-y-8;
+}
+
+/* Header section styling */
+.settings-header {
+ @apply flex flex-col justify-between gap-4;
+}
+
+.settings-header-content {
+ @apply space-y-1;
+}
+
+.settings-title {
+ @apply text-foreground text-3xl font-bold tracking-tight;
+}
+
+.settings-description {
+ @apply text-muted-foreground text-sm leading-relaxed;
+}
+
+.settings-actions {
+ @apply flex gap-2;
+}
+
+/* Button consistency */
+.arcane-button-save {
+ @apply h-10 min-w-[120px];
+}
+
+.arcane-button-test {
+ @apply h-10;
+}
+
+/* Card grid layouts */
+.settings-grid {
+ @apply grid gap-6;
+}
+
+.settings-grid-single {
+ @apply grid-cols-1;
+}
+
+.settings-grid-double {
+ @apply grid-cols-1 lg:grid-cols-2;
+}
+
+.settings-grid-triple {
+ @apply grid-cols-1 md:grid-cols-2 xl:grid-cols-3;
+}
+
+/* Card styling */
+.settings-card {
+ @apply border shadow-sm transition-shadow hover:shadow-md;
+}
+
+.settings-card-header {
+ @apply pb-4;
+}
+
+.settings-card-title-wrapper {
+ @apply flex items-center gap-3;
+}
+
+.settings-card-icon {
+ @apply rounded-full p-2;
+}
+
+.settings-card-title {
+ @apply text-lg font-semibold;
+}
+
+.settings-card-description {
+ @apply text-muted-foreground mt-1 text-sm;
+}
+
+/* Form element consistency */
+.settings-form-section {
+ @apply space-y-4;
+}
+
+.settings-form-row {
+ @apply space-y-2;
+}
+
+.settings-form-group {
+ @apply bg-muted/30 flex items-center justify-between rounded-lg border p-4;
+}
+
+.settings-form-label {
+ @apply text-sm font-medium;
+}
+
+.settings-form-help {
+ @apply text-muted-foreground mt-1 text-xs;
+}
+
+/* Alert styling */
+.settings-alert {
+ @apply mb-6;
+}
+
+/* Loading states */
+.settings-loading {
+ @apply pointer-events-none opacity-60;
+}
+
+/* Responsive styles for settings */
+@media (min-width: 640px) {
+ .settings-header {
+ @apply flex-row items-center;
+ }
+}
+
+@media (max-width: 640px) {
+ .settings-page {
+ @apply space-y-6;
+ }
+
+ .settings-header {
+ @apply gap-3;
+ }
+
+ .settings-grid {
+ @apply gap-4;
+ }
+}
diff --git a/frontend/src/hooks.client.ts b/frontend/src/hooks.client.ts
index 8f7475b5a..34edabdf0 100644
--- a/frontend/src/hooks.client.ts
+++ b/frontend/src/hooks.client.ts
@@ -3,14 +3,12 @@ import type { Handle } from '@sveltejs/kit';
import { redirect } from '@sveltejs/kit';
import { building, dev } from '$app/environment';
import SessionAPIService from '$lib/services/api/session-api-service';
-import { loadSettingsFromServer } from '$lib/stores/settings-store';
+import { settingsAPI, sessionAPI } from '$lib/services/api';
+import settingsStore from '$lib/stores/config-store';
-// Get environment variable
const isTestEnvironment = process.env.APP_ENV === 'TEST';
-// Settings initialization handler
const settingsHandler: Handle = async ({ event, resolve }) => {
- // Skip during build
if (building) {
return resolve(event);
}
@@ -18,25 +16,21 @@ const settingsHandler: Handle = async ({ event, resolve }) => {
const { url } = event;
const path = url.pathname;
- // Only initialize settings for authenticated pages (not auth pages)
const isAuthPath = path.startsWith('/auth/') || path.startsWith('/api/');
if (!isAuthPath) {
try {
- // Load settings from server to populate the store
- await loadSettingsFromServer();
+ const settings = await settingsAPI.getSettings();
+ settingsStore.set(settings);
} catch (error) {
console.error('Failed to initialize settings store:', error);
- // Don't block the request if settings fail to load
}
}
return resolve(event);
};
-// Authentication and authorization handler
const authHandler: Handle = async ({ event, resolve }) => {
- // Skip auth processing during build
if (building) {
return resolve(event);
}
@@ -44,7 +38,6 @@ const authHandler: Handle = async ({ event, resolve }) => {
const { url } = event;
const path = url.pathname;
- // Define paths that don't require authentication
const publicPaths = [
'/auth/login',
'/auth/logout',
@@ -59,7 +52,6 @@ const authHandler: Handle = async ({ event, resolve }) => {
'/_app'
];
- // Check for specific agent polling patterns that should be public
const agentPollingPattern = /^\/api\/agents\/[^\/]+\/tasks$/;
const agentResultPattern = /^\/api\/agents\/[^\/]+\/tasks\/[^\/]+\/result$/;
const agentTaskStatusPattern = /^\/api\/agents\/[^\/]+\/tasks\/[^\/]+\/status$/;
@@ -69,30 +61,22 @@ const authHandler: Handle = async ({ event, resolve }) => {
const isAgentResult = agentResultPattern.test(path) && event.request.method === 'POST';
const isAgentTaskStatus = agentTaskStatusPattern.test(path) && event.request.method === 'PUT';
- // Allow access to public paths and specific agent endpoints
if (isPublicPath || isAgentPolling || isAgentResult || isAgentTaskStatus) {
return await resolve(event);
}
- // For API routes, just pass through - the Go backend will handle authentication
if (path.startsWith('/api/')) {
return await resolve(event);
}
- // For frontend routes, check session with backend using session-api-service
if (dev && !isTestEnvironment) {
try {
- const sessionApiService = new SessionAPIService();
-
- // Validate session using the session API service
- const isValidSession = await sessionApiService.validateSession();
+ const isValidSession = await sessionAPI.validateSession();
if (!isValidSession) {
- // No valid session - redirect to login
throw redirect(302, `/auth/login?redirect=${encodeURIComponent(path)}`);
}
- // Check onboarding status
const isOnboardingPath = path.startsWith('/onboarding');
if (!isOnboardingPath) {
diff --git a/frontend/src/lib/services/encryption-service.ts b/frontend/src/lib/services/encryption-service.ts
deleted file mode 100644
index 62e81e695..000000000
--- a/frontend/src/lib/services/encryption-service.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import crypto from 'node:crypto';
-import fs from 'node:fs/promises';
-import path from 'node:path';
-import { promisify } from 'node:util';
-import { KEY_FILE, ensureDirectory } from './paths-service';
-
-const PBKDF2_ITERATIONS = 100000;
-const SALT_LENGTH = 32;
-const KEY_LENGTH = 32;
-
-const pbkdf2Async = promisify(crypto.pbkdf2);
-
-export async function getSecretKey(): Promise<Buffer> {
- try {
- await fs.access(KEY_FILE);
- const keyData = await fs.readFile(KEY_FILE);
- return keyData;
- } catch (error) {
- if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
- console.log('Generating new encryption key...');
- const key = crypto.randomBytes(KEY_LENGTH);
-
- await ensureDirectory(path.dirname(KEY_FILE), 0o700);
-
- await fs.writeFile(KEY_FILE, key, { mode: 0o600 });
- return key;
- }
-
- console.error('Error accessing encryption key:', error);
- throw error;
- }
-}
-
-export async function encrypt(data: any): Promise<string> {
- const secretKey = await getSecretKey();
- const iv = crypto.randomBytes(16);
- const salt = crypto.randomBytes(SALT_LENGTH);
-
- const key = await pbkdf2Async(secretKey, salt, PBKDF2_ITERATIONS, KEY_LENGTH, 'sha256');
-
- const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
-
- let encrypted = cipher.update(JSON.stringify(data), 'utf8', 'hex');
- encrypted += cipher.final('hex');
-
- const authTag = cipher.getAuthTag();
-
- return (
- salt.toString('hex') +
- ':' +
- iv.toString('hex') +
- ':' +
- authTag.toString('hex') +
- ':' +
- encrypted
- );
-}
-
-export async function decrypt(encryptedData: string): Promise<any> {
- const secretKey = await getSecretKey();
- const parts = encryptedData.split(':');
- if (parts.length !== 4) throw new Error('Invalid encrypted data format');
-
- const salt = Buffer.from(parts[0], 'hex');
- const iv = Buffer.from(parts[1], 'hex');
- const authTag = Buffer.from(parts[2], 'hex');
- const encrypted = parts[3];
-
- const key = await pbkdf2Async(secretKey, salt, PBKDF2_ITERATIONS, KEY_LENGTH, 'sha256');
-
- const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
- decipher.setAuthTag(authTag);
-
- let decrypted = decipher.update(encrypted, 'hex', 'utf8');
- decrypted += decipher.final('utf8');
-
- return JSON.parse(decrypted);
-}
diff --git a/frontend/src/lib/services/paths-service.ts b/frontend/src/lib/services/paths-service.ts
deleted file mode 100644
index a341687f6..000000000
--- a/frontend/src/lib/services/paths-service.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import * as path from 'node:path';
-import fs from 'node:fs/promises';
-
-export const BASE_PATH = 'data';
-
-export const SETTINGS_DIR = path.join(BASE_PATH, 'settings');
-export const KEY_FILE = path.join(BASE_PATH, '.secret_key');
-export const SESSIONS_DIR = path.join(BASE_PATH, 'sessions');
-export const USER_DIR = path.join(BASE_PATH, 'users');
-
-export const STACKS_DIR = path.join(BASE_PATH, 'stacks');
-
-export async function ensureDirectory(dir: string, mode = 0o755): Promise<void> {
- try {
- await fs.mkdir(dir, { recursive: true, mode });
- } catch (error) {
- console.error(`Failed to ensure directory ${dir}:`, error);
- throw error;
- }
-}
diff --git a/frontend/src/lib/services/validation-service.ts b/frontend/src/lib/services/validation-service.ts
deleted file mode 100644
index fa95dfee5..000000000
--- a/frontend/src/lib/services/validation-service.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import type { ValidationMode } from '$lib/utils/compose-validate.utils';
-
-export interface ValidationResult {
- valid: boolean;
- errors: string[];
- warnings: string[];
- mode?: ValidationMode;
-}
-
-export class ValidationService {
- /**
- * Validate compose configuration via API
- */
- static async validateComposeConfiguration(
- composeContent: string,
- envContent: string = '',
- mode: ValidationMode = 'default'
- ): Promise<ValidationResult> {
- try {
- const response = await fetch('/api/stacks/validate', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- composeContent,
- envContent,
- mode
- })
- });
-
- if (!response.ok) {
- const errorData = await response.json().catch(() => ({}));
- return {
- valid: false,
- errors: [errorData.error || 'Validation request failed'],
- warnings: []
- };
- }
-
- return await response.json();
- } catch (error) {
- return {
- valid: false,
- errors: [error instanceof Error ? error.message : 'Network error during validation'],
- warnings: []
- };
- }
- }
-
- /**
- * Validate stack by ID via API
- */
- static async validateStackById(
- stackId: string,
- mode: ValidationMode = 'default'
- ): Promise<ValidationResult> {
- try {
- const response = await fetch(`/api/stacks/${stackId}/validate?mode=${mode}`);
-
- if (!response.ok) {
- const errorData = await response.json().catch(() => ({}));
- return {
- valid: false,
- errors: [errorData.error || 'Stack validation request failed'],
- warnings: []
- };
- }
-
- return await response.json();
- } catch (error) {
- return {
- valid: false,
- errors: [error instanceof Error ? error.message : 'Network error during validation'],
- warnings: []
- };
- }
- }
-}
diff --git a/frontend/src/lib/stores/client-init.ts b/frontend/src/lib/stores/client-init.ts
index afb9f1c83..1cb8fdcaf 100644
--- a/frontend/src/lib/stores/client-init.ts
+++ b/frontend/src/lib/stores/client-init.ts
@@ -1,6 +1,7 @@
import { browser } from '$app/environment';
-import { loadSettingsFromServer } from './settings-store';
+import settingsStore from './config-store';
import { goto } from '$app/navigation';
+import { settingsAPI } from '$lib/services/api';
let isInitialized = false;
@@ -10,21 +11,19 @@ export async function initializeClientStores() {
}
try {
- // Load settings from server
- await loadSettingsFromServer();
+ const settings = await settingsAPI.getSettings();
+ settingsStore.set(settings);
console.log('Settings store initialized successfully');
isInitialized = true;
} catch (error) {
console.error('Failed to initialize client stores:', error);
- // If it's an authentication error, redirect to login
if (error instanceof Error && error.message.includes('401')) {
goto('/auth/login');
}
}
}
-// Check authentication status
export async function checkAuthStatus(): Promise<boolean> {
if (!browser) {
return false;
@@ -42,7 +41,6 @@ export async function checkAuthStatus(): Promise<boolean> {
}
}
-// Auto-initialize when this module is imported in the browser
if (browser) {
initializeClientStores();
}
diff --git a/frontend/src/lib/stores/user-store.ts b/frontend/src/lib/stores/user-store.ts
new file mode 100644
index 000000000..19147c50a
--- /dev/null
+++ b/frontend/src/lib/stores/user-store.ts
@@ -0,0 +1,18 @@
+import type { User } from '$lib/types/user.type';
+import { writable } from 'svelte/store';
+
+const userStore = writable<User | null>(null);
+
+const setUser = (user: User) => {
+ userStore.set(user);
+};
+
+const clearUser = () => {
+ userStore.set(null);
+};
+
+export default {
+ subscribe: userStore.subscribe,
+ setUser,
+ clearUser
+};
diff --git a/frontend/src/routes/images/+page.svelte b/frontend/src/routes/images/+page.svelte
index a574cb17f..3ec6cb092 100644
--- a/frontend/src/routes/images/+page.svelte
+++ b/frontend/src/routes/images/+page.svelte
@@ -28,7 +28,6 @@
import ImageAPIService from '$lib/services/api/image-api-service';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import { settingsStore } from '$lib/stores/settings-store';
import ArcaneButton from '$lib/components/arcane-button.svelte';
import { tablePersistence } from '$lib/stores/table-store';
import MaturityItem from '$lib/components/maturity-item.svelte';
@@ -59,15 +58,6 @@
let isPullingInline = $state<Record<string, boolean>>({});
- $effect(() => {
- if (data.settings) {
- settingsStore.update((current) => ({
- ...current,
- ...data.settings
- }));
- }
- });
-
const imageApi = new ImageAPIService();
let isPullDialogOpen = $state(false);
diff --git a/frontend/src/routes/settings/+layout.svelte b/frontend/src/routes/settings/+layout.svelte
new file mode 100644
index 000000000..e14e54619
--- /dev/null
+++ b/frontend/src/routes/settings/+layout.svelte
@@ -0,0 +1,18 @@
+<script lang="ts">
+ import { page } from '$app/state';
+
+ interface Props {
+ children: import('svelte').Snippet;
+ }
+
+ let { children }: Props = $props();
+
+ let currentPageName = $derived(page.url.pathname.split('/').pop() || 'settings');
+ let pageTitle = $derived(currentPageName.charAt(0).toUpperCase() + currentPageName.slice(1));
+</script>
+
+<div class="settings-container">
+ <div class="settings-content">
+ {@render children()}
+ </div>
+</div>
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 2dd7baa6d..24e9aed2d 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -2,7 +2,7 @@
import * as Card from '$lib/components/ui/card/index.js';
import type { FormInput as FormInputType } from '$lib/types/form.type';
import { Button } from '$lib/components/ui/button/index.js';
- import { RefreshCw, ImageMinus, Server, Save, Clock, Zap, InfoIcon } from '@lucide/svelte';
+ import { RefreshCw, ImageMinus, Save, Clock, Zap, InfoIcon } from '@lucide/svelte';
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';
@@ -104,20 +104,21 @@
<title>Docker Settings - Arcane</title>
</svelte:head>
-<div class="space-y-6">
- <div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
- <div>
- <h1 class="text-3xl font-bold tracking-tight">Docker Settings</h1>
- <p class="text-muted-foreground mt-1 text-sm">
- Configure Docker automation behavior. Remote hosts should use agents.
+<div class="settings-page">
+ <!-- Header Section -->
+ <div class="settings-header">
+ <div class="settings-header-content">
+ <h1 class="settings-title">Docker Settings</h1>
+ <p class="settings-description">
+ Configure Docker automation behavior and container management settings
</p>
</div>
- <div class="flex gap-2">
+ <div class="settings-actions">
<Button
onclick={() => handleDockerSettingUpdates()}
disabled={isLoading.saving || !canSave}
- class="arcane-button-save h-10"
+ class="arcane-button-save"
>
{#if isLoading.saving}
<RefreshCw class="size-4 animate-spin" />
@@ -130,181 +131,186 @@
</div>
</div>
+ <!-- Alert Section -->
{#if currentSettings.autoUpdate && currentSettings.pollingEnabled}
- <Alert.Root variant="warning">
- <Zap class="size-4" />
- <Alert.Title>Auto-update Enabled</Alert.Title>
- <Alert.Description>
- Containers will be automatically updated when newer images are detected. Make sure you have
- proper backup procedures in place.
- </Alert.Description>
- </Alert.Root>
+ <div class="settings-alert">
+ <Alert.Root variant="warning">
+ <Zap 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}
- <div class="grid grid-cols-1 gap-6">
- <Card.Root class="border shadow-sm">
- <Card.Header class="pb-4">
- <div class="flex items-center gap-3">
- <div class="rounded-lg bg-emerald-500/10 p-2.5">
- <Clock class="size-5 text-emerald-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Image Automation</Card.Title>
- <Card.Description>Control automatic image polling and updates</Card.Description>
+ <!-- Settings Grid -->
+ <div class="settings-grid settings-grid-single">
+ <div class="grid grid-cols-1 gap-6">
+ <Card.Root class="border shadow-sm">
+ <Card.Header class="pb-4">
+ <div class="flex items-center gap-3">
+ <div class="rounded-lg bg-emerald-500/10 p-2.5">
+ <Clock class="size-5 text-emerald-600" />
+ </div>
+ <div>
+ <Card.Title class="text-lg">Image Automation</Card.Title>
+ <Card.Description>Control automatic image polling and updates</Card.Description>
+ </div>
</div>
- </div>
- </Card.Header>
- <Card.Content class="space-y-6">
- <div
- class="from-background to-muted/30 flex items-center justify-between rounded-lg border bg-gradient-to-r p-4"
- >
- <FormInput
- bind:input={pollingEnabledSwitch}
- type="switch"
- id="pollingEnabled"
- label="Enable Image Polling"
- description="Periodically check registries for newer image versions"
- />
- </div>
-
- {#if currentSettings.pollingEnabled}
- <div class="space-y-4 pl-4">
+ </Card.Header>
+ <Card.Content class="space-y-6">
+ <div
+ class="from-background to-muted/30 flex items-center justify-between rounded-lg border bg-gradient-to-r p-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)"
+ bind:input={pollingEnabledSwitch}
+ type="switch"
+ id="pollingEnabled"
+ label="Enable Image Polling"
+ description="Periodically check registries for newer image versions"
/>
+ </div>
- {#if pollingIntervalInput.value < 30}
- <Alert.Root variant="warning">
- <Zap 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}
-
- <div
- class="from-background flex items-center justify-between rounded-lg border bg-gradient-to-r to-amber-50/50 p-4"
- >
+ {#if currentSettings.pollingEnabled}
+ <div class="space-y-4 pl-4">
<FormInput
- bind:input={autoUpdateSwitch}
- type="switch"
- id="autoUpdateSwitch"
- label="Auto-update Containers"
- description="Automatically update containers when newer images are found"
+ bind:input={pollingIntervalInput}
+ type="number"
+ id="pollingInterval"
+ label="Polling Interval (minutes)"
+ placeholder="60"
+ description="How often to check for new images (5-1440 minutes)"
/>
- </div>
- {#if currentSettings.autoUpdate}
- <div class="pl-4">
+ {#if pollingIntervalInput.value < 30}
+ <Alert.Root variant="warning">
+ <Zap 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}
+
+ <div
+ class="from-background flex items-center justify-between rounded-lg border bg-gradient-to-r to-amber-50/50 p-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)"
+ bind:input={autoUpdateSwitch}
+ type="switch"
+ id="autoUpdateSwitch"
+ label="Auto-update Containers"
+ description="Automatically update containers when newer images are found"
/>
</div>
- {/if}
- </div>
- <Alert.Root>
- <InfoIcon />
- <Alert.Title>Automation Summary</Alert.Title>
- <Alert.Description>
- <ul class="list-inside list-disc text-sm">
- {#if currentSettings.autoUpdate}
- <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>
+ {#if currentSettings.autoUpdate}
+ <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>
- <Card.Root>
- <Card.Header class="pb-4">
- <div class="flex items-center gap-3">
- <div class="rounded-lg bg-purple-500/10 p-2.5">
- <ImageMinus class="size-5 text-purple-600" />
- </div>
- <div>
- <Card.Title class="text-lg">Image Pruning</Card.Title>
- <Card.Description>Configure cleanup behavior for unused Docker images</Card.Description>
+ <Alert.Root>
+ <InfoIcon />
+ <Alert.Title>Automation Summary</Alert.Title>
+ <Alert.Description>
+ <ul class="list-inside list-disc text-sm">
+ {#if currentSettings.autoUpdate}
+ <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>
+ <Card.Header class="pb-4">
+ <div class="flex items-center gap-3">
+ <div class="rounded-lg bg-purple-500/10 p-2.5">
+ <ImageMinus class="size-5 text-purple-600" />
+ </div>
+ <div>
+ <Card.Title class="text-lg">Image Pruning</Card.Title>
+ <Card.Description>Configure cleanup behavior for unused Docker images</Card.Description>
+ </div>
</div>
- </div>
- </Card.Header>
- <Card.Content>
- <div class="space-y-4">
- <Label for="pruneMode" class="text-base font-medium">Prune Action Behavior</Label>
+ </Card.Header>
+ <Card.Content>
+ <div class="space-y-4">
+ <Label for="pruneMode" class="text-base font-medium">Prune Action Behavior</Label>
- <RadioGroup.Root
- value={currentSettings.pruneMode}
- onValueChange={(val) => {
- settingsAPI.updateSettings({
- ...currentSettings,
- pruneMode: val as 'all' | 'dangling'
- });
- settingsStore.reload();
- }}
- 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.Root
+ value={currentSettings.pruneMode}
+ onValueChange={(val) => {
+ settingsAPI.updateSettings({
+ ...currentSettings,
+ pruneMode: val as 'all' | 'dangling'
+ });
+ settingsStore.reload();
+ }}
+ class="space-y-3"
+ id="pruneMode"
>
- <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
+ 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>
- <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
+ 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>
- </div>
- </RadioGroup.Root>
+ </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.
- {currentSettings.pruneMode === '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 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.
+ {currentSettings.pruneMode === '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>
- </div>
- </Card.Content>
- </Card.Root>
+ </Card.Content>
+ </Card.Root>
- <input type="hidden" id="csrf_token" value={data.csrf} />
+ <input type="hidden" id="csrf_token" value={data.csrf} />
+ </div>
</div>
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index 867ac5afb..adde745ff 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -2,7 +2,7 @@
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 { Cog, Save, RefreshCw } from '@lucide/svelte';
+ import { Cog, Save, RefreshCw, Folder, Globe, Calendar } from '@lucide/svelte';
import type { FormInput as FormInputType } from '$lib/types/form.type';
import { toast } from 'svelte-sonner';
import { invalidateAll } from '$app/navigation';
@@ -18,19 +18,23 @@
...currentSettings,
...updatedSettings
});
-
settingsStore.reload();
}
function handleGeneralSettingUpdates() {
+ isLoading.saving = true;
updateSettingsConfig({
stacksDirectory: stacksDirectoryInput.value,
baseServerUrl: baseServerUrlInput.value,
maturityThresholdDays: maturityThresholdInput.value
- }).then(async () => {
- toast.success(`Settings Saved Successfully`);
- await invalidateAll();
- });
+ })
+ .then(async () => {
+ toast.success(`Settings Saved Successfully`);
+ await invalidateAll();
+ })
+ .finally(() => {
+ isLoading.saving = false;
+ });
}
let stacksDirectoryInput = $state<FormInputType<string>>({
@@ -73,16 +77,19 @@
</svelte:head>
<div class="space-y-6">
+ <!-- Header -->
<div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
<div>
<h1 class="text-3xl font-bold tracking-tight">General Settings</h1>
- <p class="text-muted-foreground mt-1 text-sm">Core configuration for how Arcane operates</p>
+ <p class="text-muted-foreground mt-1 text-sm">
+ Core configuration for how Arcane operates and manages your containers
+ </p>
</div>
<Button
onclick={() => handleGeneralSettingUpdates()}
disabled={isLoading.saving}
- class="arcane-button-save h-10"
+ class="h-10 min-w-[120px]"
>
{#if isLoading.saving}
<RefreshCw class="size-4 animate-spin" />
@@ -94,54 +101,76 @@
</Button>
</div>
- <div class="grid auto-cols-auto gap-6 lg:auto-cols-auto">
- <Card.Root class="border shadow-sm">
- <Card.Header class="pb-3">
- <div class="flex items-center gap-2">
- <div class="bg-primary/10 rounded-full p-2">
- <Cog class="text-primary size-5" />
+ <!-- Settings Cards -->
+ <div class="grid gap-6">
+ <!-- Storage Configuration -->
+ <Card.Root>
+ <Card.Header>
+ <div class="flex items-center gap-3">
+ <div class="rounded-lg bg-blue-500/10 p-2">
+ <Folder class="size-5 text-blue-600" />
</div>
<div>
- <Card.Title>Core Arcane Configuration</Card.Title>
- <Card.Description>Essential settings for how Arcane operates.</Card.Description>
+ <Card.Title>Storage Configuration</Card.Title>
+ <Card.Description>Configure where Arcane stores stack files and data</Card.Description>
</div>
</div>
</Card.Header>
<Card.Content>
- <div class="space-y-6">
- <FormInput
- bind:input={stacksDirectoryInput}
- type="text"
- id="stacksDirectory"
- label="Stack Projects Directory"
- placeholder="data/stacks"
- description="The primary folder where Arcane will store and manage your Docker Compose stack projects. This path is inside Arcane's container."
- warningText="Important: Changing this path will not automatically move existing stack projects."
- />
+ <FormInput
+ label="Stacks Directory"
+ placeholder="data/stacks"
+ bind:input={stacksDirectoryInput}
+ helpText="Directory where Docker Compose stack files are stored"
+ />
+ </Card.Content>
+ </Card.Root>
- <FormInput
- bind:input={baseServerUrlInput}
- type="text"
- id="baseServerUrl"
- label="Default Service Access URL"
- placeholder="localhost"
- description="When Arcane provides links to your services (e.g., web UIs), this URL (like 'localhost' or an IP address) is used as the default. This is primarily for services not on directly accessible networks (e.g., macvlan)."
- />
+ <!-- Network Configuration -->
+ <Card.Root>
+ <Card.Header>
+ <div class="flex items-center gap-3">
+ <div class="rounded-lg bg-green-500/10 p-2">
+ <Globe class="size-5 text-green-600" />
+ </div>
+ <div>
+ <Card.Title>Network Configuration</Card.Title>
+ <Card.Description>Configure base server URL and network settings</Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content>
+ <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>
- <FormInput
- bind:input={maturityThresholdInput}
- type="number"
- id="maturityThresholdDays"
- label="Image Maturity Threshold (days)"
- placeholder="30"
- description="The number of days after an image release before it's considered 'matured'."
- warningText="Higher values mean more caution with new images."
- />
+ <!-- Container Management -->
+ <Card.Root>
+ <Card.Header>
+ <div class="flex items-center gap-3">
+ <div class="rounded-lg bg-purple-500/10 p-2">
+ <Calendar class="size-5 text-purple-600" />
+ </div>
+ <div>
+ <Card.Title>Container Management</Card.Title>
+ <Card.Description>Configure container lifecycle and update policies</Card.Description>
+ </div>
</div>
+ </Card.Header>
+ <Card.Content>
+ <FormInput
+ type="number"
+ label="Image Maturity Threshold (Days)"
+ placeholder="30"
+ bind:input={maturityThresholdInput}
+ helpText="Number of days to wait before considering an image update stable"
+ />
</Card.Content>
</Card.Root>
</div>
-
- <!-- Hidden CSRF token if needed -->
- <input type="hidden" id="csrf_token" value={data.csrf} />
</div>
diff --git a/frontend/src/routes/settings/rbac/+page.svelte b/frontend/src/routes/settings/rbac/+page.svelte
index 668aaf018..847157a66 100644
--- a/frontend/src/routes/settings/rbac/+page.svelte
+++ b/frontend/src/routes/settings/rbac/+page.svelte
@@ -5,30 +5,14 @@
import { Shield, Plus, Users, Settings, Save, RefreshCw } from '@lucide/svelte';
import type { PageData } from './$types';
import Switch from '$lib/components/ui/switch/switch.svelte';
- import {
- settingsStore,
- saveSettingsToServer,
- updateSettingsStore
- } from '$lib/stores/settings-store';
- import { toast } from 'svelte-sonner';
- import { invalidateAll } from '$app/navigation';
- import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import { tryCatch } from '$lib/utils/try-catch';
+ import settingsStore from '$lib/stores/config-store';
let { data }: { data: PageData } = $props();
- // Loading states
let isLoading = $state({
saving: false
});
- // Initialize settings from page data
- $effect(() => {
- if (data.settings) {
- updateSettingsStore(data.settings);
- }
- });
-
const roles = [
{
id: 1,
@@ -93,22 +77,6 @@
];
let selectedRole = $state(roles[0]);
-
- // Save settings function
- async function saveSettings() {
- if (isLoading.saving) return;
- isLoading.saving = true;
-
- handleApiResultWithCallbacks({
- result: await tryCatch(saveSettingsToServer()),
- message: 'Error Saving Settings',
- setLoadingState: (value) => (isLoading.saving = value),
- onSuccess: async () => {
- toast.success(`Settings Saved Successfully`);
- await invalidateAll();
- }
- });
- }
</script>
<svelte:head>
@@ -122,7 +90,7 @@
<p class="text-muted-foreground mt-1 text-sm">Manage user roles and permissions</p>
</div>
- <Button onclick={saveSettings} disabled={isLoading.saving} class="arcane-button-save h-10">
+ <Button disabled={isLoading.saving} class="arcane-button-save h-10">
{#if isLoading.saving}
<RefreshCw class="size-4 animate-spin" />
Saving...
@@ -147,15 +115,7 @@
id="rbacEnabledSwitch"
name="rbacEnabled"
checked={$settingsStore.auth?.rbacEnabled}
- onCheckedChange={(checked) => {
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...current.auth,
- rbacEnabled: checked
- }
- }));
- }}
+ onCheckedChange={() => {}}
/>
</div>
</div>
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index 936908851..26aa812e0 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -1,37 +1,80 @@
<script lang="ts">
- import { onMount } from 'svelte';
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 { Lock, Key, AlertTriangle, Info, Save, RefreshCw } from '@lucide/svelte';
- import {
- settingsStore,
- saveSettingsToServer,
- updateSettingsStore
- } from '$lib/stores/settings-store';
+ import settingsStore from '$lib/stores/config-store';
import * as Dialog from '$lib/components/ui/dialog/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import { toast } from 'svelte-sonner';
import { invalidateAll } from '$app/navigation';
- import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import { tryCatch } from '$lib/utils/try-catch';
+ import type { Settings } from '$lib/types/settings.type';
+ import { settingsAPI } from '$lib/services/api';
let { data }: { data: PageData } = $props();
+ let currentSettings = $state(data.settings);
+
+ async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
+ currentSettings = await settingsAPI.updateSettings({
+ ...currentSettings,
+ ...updatedSettings
+ });
+
+ settingsStore.reload();
+ }
+
+ function handleSecuritySettingUpdates() {
+ isLoading.saving = true;
+ updateSettingsConfig({
+ auth: {
+ ...currentSettings.auth,
+ localAuthEnabled: localAuthEnabled,
+ oidcEnabled: oidcEnabled,
+ sessionTimeout: sessionTimeout,
+ passwordPolicy: passwordPolicy,
+ ...(oidcEnabled && !data.oidcStatus.envForced
+ ? {
+ oidc: {
+ clientId: oidcConfigForm.clientId,
+ clientSecret: oidcConfigForm.clientSecret || undefined,
+ redirectUri: oidcConfigForm.redirectUri,
+ authorizationEndpoint: oidcConfigForm.authorizationEndpoint,
+ tokenEndpoint: oidcConfigForm.tokenEndpoint,
+ userinfoEndpoint: oidcConfigForm.userinfoEndpoint,
+ scopes: oidcConfigForm.scopes
+ }
+ }
+ : {})
+ }
+ })
+ .then(async () => {
+ toast.success(`Settings Saved Successfully`);
+ await invalidateAll();
+ })
+ .finally(() => {
+ isLoading.saving = false;
+ });
+ }
let showOidcConfigDialog = $state(false);
let oidcConfigForm = $state({
- clientId: data.settings?.auth?.oidc?.clientId || '',
+ clientId: '',
clientSecret: '',
- redirectUri:
- data.settings?.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback',
- authorizationEndpoint: data.settings?.auth?.oidc?.authorizationEndpoint || '',
- tokenEndpoint: data.settings?.auth?.oidc?.tokenEndpoint || '',
- userinfoEndpoint: data.settings?.auth?.oidc?.userinfoEndpoint || '',
- scopes: data.settings?.auth?.oidc?.scopes || 'openid email profile'
+ redirectUri: 'http://localhost:3000/auth/oidc/callback',
+ authorizationEndpoint: '',
+ tokenEndpoint: '',
+ userinfoEndpoint: '',
+ scopes: 'openid email profile'
});
+ // State variables for form inputs
+ let localAuthEnabled = $state(true);
+ let oidcEnabled = $state(false);
+ let sessionTimeout = $state(60);
+ let passwordPolicy = $state<'basic' | 'standard' | 'strong'>('strong');
+
// Loading states
let isLoading = $state({
saving: false
@@ -39,28 +82,26 @@
let isOidcViewMode = $derived(data.oidcStatus.envForced && data.oidcStatus.envConfigured);
+ // Update state when currentSettings changes
$effect(() => {
- if (data.settings) {
- updateSettingsStore(data.settings);
- oidcConfigForm.clientId = data.settings.auth?.oidc?.clientId || '';
- oidcConfigForm.redirectUri =
- data.settings.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback';
- oidcConfigForm.authorizationEndpoint = data.settings.auth?.oidc?.authorizationEndpoint || '';
- oidcConfigForm.tokenEndpoint = data.settings.auth?.oidc?.tokenEndpoint || '';
- oidcConfigForm.userinfoEndpoint = data.settings.auth?.oidc?.userinfoEndpoint || '';
- oidcConfigForm.scopes = data.settings.auth?.oidc?.scopes || 'openid email profile';
- oidcConfigForm.clientSecret = '';
- }
+ localAuthEnabled = currentSettings.auth?.localAuthEnabled ?? true;
+ oidcEnabled = currentSettings.auth?.oidcEnabled ?? false;
+ sessionTimeout = currentSettings.auth?.sessionTimeout ?? 60;
+ passwordPolicy = currentSettings.auth?.passwordPolicy ?? 'strong';
+
+ // Update OIDC form
+ oidcConfigForm.clientId = currentSettings.auth?.oidc?.clientId || '';
+ oidcConfigForm.redirectUri =
+ currentSettings.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback';
+ oidcConfigForm.authorizationEndpoint = currentSettings.auth?.oidc?.authorizationEndpoint || '';
+ oidcConfigForm.tokenEndpoint = currentSettings.auth?.oidc?.tokenEndpoint || '';
+ oidcConfigForm.userinfoEndpoint = currentSettings.auth?.oidc?.userinfoEndpoint || '';
+ oidcConfigForm.scopes = currentSettings.auth?.oidc?.scopes || 'openid email profile';
+ oidcConfigForm.clientSecret = '';
});
function handleOidcSwitchChange(checked: boolean) {
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...(current.auth || {}),
- oidcEnabled: checked
- }
- }));
+ oidcEnabled = checked;
if (checked && !data.oidcStatus.envForced && !data.oidcStatus.effectivelyConfigured) {
showOidcConfigDialog = true;
@@ -69,106 +110,78 @@
function openOidcDialog() {
if (!isOidcViewMode) {
- oidcConfigForm.clientId = data.settings?.auth?.oidc?.clientId || '';
+ oidcConfigForm.clientId = currentSettings.auth?.oidc?.clientId || '';
oidcConfigForm.clientSecret = '';
oidcConfigForm.redirectUri =
- data.settings?.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback';
- oidcConfigForm.authorizationEndpoint = data.settings?.auth?.oidc?.authorizationEndpoint || '';
- oidcConfigForm.tokenEndpoint = data.settings?.auth?.oidc?.tokenEndpoint || '';
- oidcConfigForm.userinfoEndpoint = data.settings?.auth?.oidc?.userinfoEndpoint || '';
- oidcConfigForm.scopes = data.settings?.auth?.oidc?.scopes || 'openid email profile';
+ currentSettings.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback';
+ oidcConfigForm.authorizationEndpoint =
+ currentSettings.auth?.oidc?.authorizationEndpoint || '';
+ oidcConfigForm.tokenEndpoint = currentSettings.auth?.oidc?.tokenEndpoint || '';
+ oidcConfigForm.userinfoEndpoint = currentSettings.auth?.oidc?.userinfoEndpoint || '';
+ oidcConfigForm.scopes = currentSettings.auth?.oidc?.scopes || 'openid email profile';
}
showOidcConfigDialog = true;
}
async function handleSaveOidcConfig() {
try {
- settingsStore.update((current) => {
- const existingAuth = { ...(current.auth || {}) };
- const newOidcConfig = {
- clientId: oidcConfigForm.clientId,
- clientSecret: oidcConfigForm.clientSecret,
- redirectUri: oidcConfigForm.redirectUri,
- authorizationEndpoint: oidcConfigForm.authorizationEndpoint,
- tokenEndpoint: oidcConfigForm.tokenEndpoint,
- userinfoEndpoint: oidcConfigForm.userinfoEndpoint,
- scopes: oidcConfigForm.scopes
- };
-
- return {
- ...current,
- auth: {
- ...existingAuth,
- oidcEnabled: true,
- oidc: newOidcConfig
- }
- };
- });
-
- await saveSettingsToServer();
- await invalidateAll();
-
- toast.success('OIDC configuration saved successfully.');
+ oidcEnabled = true;
+ toast.success('OIDC configuration will be saved with other settings.');
showOidcConfigDialog = false;
} catch (error) {
- console.error('Failed to save OIDC configuration:', error);
- toast.error('Failed to save OIDC configuration.', {
+ console.error('Failed to prepare OIDC configuration:', error);
+ toast.error('Failed to prepare OIDC configuration.', {
description: error instanceof Error ? error.message : 'An unknown error occurred.'
});
}
}
-
- // Save settings function
- async function saveSettings() {
- if (isLoading.saving) return;
- isLoading.saving = true;
-
- handleApiResultWithCallbacks({
- result: await tryCatch(saveSettingsToServer()),
- message: 'Error Saving Settings',
- setLoadingState: (value) => (isLoading.saving = value),
- onSuccess: async () => {
- toast.success(`Settings Saved Successfully`);
- await invalidateAll();
- }
- });
- }
</script>
<svelte:head>
<title>Security Settings - Arcane</title>
</svelte:head>
-<div class="space-y-6">
- <div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
- <div>
- <h1 class="text-3xl font-bold tracking-tight">Security Settings</h1>
- <p class="text-muted-foreground mt-1 text-sm">
- Configure authentication methods and security policies
+<div class="settings-page">
+ <!-- Header Section -->
+ <div class="settings-header">
+ <div class="settings-header-content">
+ <h1 class="settings-title">Security Settings</h1>
+ <p class="settings-description">
+ Configure authentication methods, session policies, and security settings
</p>
</div>
- <Button onclick={saveSettings} disabled={isLoading.saving} class="arcane-button-save h-10">
- {#if isLoading.saving}
- <RefreshCw class="size-4 animate-spin" />
- Saving...
- {:else}
- <Save class="size-4" />
- Save Settings
- {/if}
- </Button>
+ <div class="settings-actions">
+ <Button
+ onclick={() => handleSecuritySettingUpdates()}
+ disabled={isLoading.saving}
+ class="arcane-button-save"
+ >
+ {#if isLoading.saving}
+ <RefreshCw class="size-4 animate-spin" />
+ Saving...
+ {:else}
+ <Save class="size-4" />
+ Save Settings
+ {/if}
+ </Button>
+ </div>
</div>
- <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
- <Card.Root class="border shadow-sm">
- <Card.Header class="pb-3">
- <div class="flex items-center gap-2">
- <div class="rounded-full bg-indigo-500/10 p-2">
- <Lock class="size-5 text-indigo-500" />
+ <!-- Settings Grid -->
+ <div class="settings-grid settings-grid-double">
+ <!-- Authentication Methods Card -->
+ <Card.Root class="settings-card">
+ <Card.Header class="settings-card-header">
+ <div class="settings-card-title-wrapper">
+ <div class="settings-card-icon bg-indigo-500/10">
+ <Lock class="size-5 text-indigo-600" />
</div>
<div>
- <Card.Title>Authentication Methods</Card.Title>
- <Card.Description>Configure how users sign in</Card.Description>
+ <Card.Title class="settings-card-title">Authentication Methods</Card.Title>
+ <Card.Description class="settings-card-description">
+ Configure how users sign in to Arcane
+ </Card.Description>
</div>
</div>
</Card.Header>
@@ -188,15 +201,9 @@
</div>
<Switch
id="localAuthSwitch"
- checked={$settingsStore.auth?.localAuthEnabled ?? true}
+ checked={localAuthEnabled}
onCheckedChange={(checked) => {
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...(current.auth || {}),
- localAuthEnabled: checked
- }
- }));
+ localAuthEnabled = checked;
}}
/>
</div>
@@ -262,9 +269,7 @@
</div>
<Switch
id="oidcAuthSwitch"
- checked={'effectivelyEnabled' in data.oidcStatus
- ? data.oidcStatus.effectivelyEnabled
- : data.oidcStatus.enabled}
+ checked={oidcEnabled}
disabled={'envForced' in data.oidcStatus && data.oidcStatus.envForced}
onCheckedChange={handleOidcSwitchChange}
/>
@@ -307,23 +312,23 @@
{#if isOidcViewMode}
<div class="max-h-[50vh] overflow-y-auto py-4 pr-2">
<ul class="mt-1 list-inside list-disc space-y-1 text-sm">
- {#if data.settings?.auth?.oidc}
- <li><strong>Client ID:</strong> {data.settings.auth.oidc.clientId}</li>
+ {#if currentSettings.auth?.oidc}
+ <li><strong>Client ID:</strong> {currentSettings.auth.oidc.clientId}</li>
<li>
<strong>Client Secret:</strong>
<span class="text-muted-foreground italic">(Sensitive - Not Displayed)</span>
</li>
- <li><strong>Redirect URI:</strong> {data.settings.auth.oidc.redirectUri}</li>
+ <li><strong>Redirect URI:</strong> {currentSettings.auth.oidc.redirectUri}</li>
<li>
<strong>Authorization Endpoint:</strong>
- {data.settings.auth.oidc.authorizationEndpoint}
+ {currentSettings.auth.oidc.authorizationEndpoint}
</li>
- <li><strong>Token Endpoint:</strong> {data.settings.auth.oidc.tokenEndpoint}</li>
+ <li><strong>Token Endpoint:</strong> {currentSettings.auth.oidc.tokenEndpoint}</li>
<li>
<strong>User Info Endpoint:</strong>
- {data.settings.auth.oidc.userinfoEndpoint}
+ {currentSettings.auth.oidc.userinfoEndpoint}
</li>
- <li><strong>Scopes:</strong> {data.settings.auth.oidc.scopes}</li>
+ <li><strong>Scopes:</strong> {currentSettings.auth.oidc.scopes}</li>
{:else}
<li>
<span class="text-destructive"
@@ -409,131 +414,89 @@
<Dialog.Footer>
<Button variant="outline" onclick={() => (showOidcConfigDialog = false)}>Close</Button>
{#if !isOidcViewMode}
- <Button onclick={handleSaveOidcConfig}>Save Configuration</Button>
+ <Button onclick={handleSaveOidcConfig}>Configure OIDC</Button>
{/if}
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>
- <div class="space-y-6">
- <Card.Root class="border shadow-sm">
- <Card.Header class="pb-3">
- <div class="flex items-center gap-2">
- <div class="rounded-full bg-cyan-500/10 p-2">
- <Key class="size-5 text-cyan-500" />
- </div>
- <div>
- <Card.Title>Session Settings</Card.Title>
- <Card.Description>Configure session behavior</Card.Description>
- </div>
+ <!-- Session Settings Card -->
+ <Card.Root class="settings-card">
+ <Card.Header class="settings-card-header">
+ <div class="settings-card-title-wrapper">
+ <div class="settings-card-icon bg-cyan-500/10">
+ <Key class="size-5 text-cyan-600" />
+ </div>
+ <div>
+ <Card.Title class="settings-card-title">Session Settings</Card.Title>
+ <Card.Description class="settings-card-description">
+ Configure session behavior and password policies
+ </Card.Description>
+ </div>
+ </div>
+ </Card.Header>
+ <Card.Content>
+ <div class="space-y-4">
+ <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">
+ Time until inactive sessions are automatically logged out (15-1440 minutes)
+ </p>
</div>
- </Card.Header>
- <Card.Content>
- <div class="space-y-4">
- <div class="space-y-2">
- <label for="sessionTimeout" class="text-sm font-medium"
- >Session Timeout (minutes)</label
- >
- <Input
- type="number"
- id="sessionTimeout"
- name="sessionTimeout"
- value={$settingsStore.auth?.sessionTimeout ?? 60}
- min="15"
- max="1440"
- oninput={(event) => {
- const target = event.target as HTMLInputElement;
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...(current.auth ?? {}),
- sessionTimeout: parseInt(target.value)
- }
- }));
- }}
- />
- <p class="text-muted-foreground text-xs">
- Time until inactive sessions are automatically logged out (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={($settingsStore.auth?.passwordPolicy || 'strong') === 'basic'
- ? 'default'
- : 'outline'}
- class={($settingsStore.auth?.passwordPolicy || 'strong') === 'basic'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
- onclick={() => {
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...current.auth,
- passwordPolicy: 'basic'
- }
- }));
- }}>Basic</Button
- >
- <Button
- variant={($settingsStore.auth?.passwordPolicy || 'strong') === 'standard'
- ? 'default'
- : 'outline'}
- class={($settingsStore.auth?.passwordPolicy || 'strong') === 'standard'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
- onclick={() => {
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...current.auth,
- passwordPolicy: 'standard'
- }
- }));
- }}>Standard</Button
- >
- <Button
- variant={($settingsStore.auth?.passwordPolicy || 'strong') === 'strong'
- ? 'default'
- : 'outline'}
- class={($settingsStore.auth?.passwordPolicy || 'strong') === 'strong'
- ? 'arcane-button-create w-full'
- : 'arcane-button-restart w-full'}
- onclick={() => {
- settingsStore.update((current) => ({
- ...current,
- auth: {
- ...current.auth,
- passwordPolicy: 'strong'
- }
- }));
- }}>Strong</Button
- >
- </div>
- <input
- type="hidden"
- id="passwordPolicy"
- name="passwordPolicy"
- value={$settingsStore.auth?.passwordPolicy || 'strong'}
- />
- <p class="text-muted-foreground mt-1 text-xs">
- {#if $settingsStore.auth?.passwordPolicy === 'basic'}
- Basic: Minimum 8 characters
- {:else if $settingsStore.auth?.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 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>
- </Card.Content>
- </Card.Root>
- </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
</div>
-
- <!-- Hidden CSRF token if needed -->
- <input type="hidden" id="csrf_token" value={data.csrf} />
</div>