Skip to content

Modern Docker Management, Designed for Everyone

feat: zod v4 form validation, and sheet based forms (#301)

Kyle Mendell77c6d963a925
diff --git a/.vscode/settings.json b/.vscode/settings.json
index ddb94e70d..5456f3442 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,10 +1,10 @@
{
- "github.copilot.enable": {
- "*": false,
- "plaintext": false,
- "markdown": false,
- "scminput": false,
- "typescript": true
- },
- "typescript.tsdk": "node_modules/typescript/lib"
+ "github.copilot.enable": {
+ "*": false,
+ "plaintext": false,
+ "markdown": false,
+ "scminput": false,
+ "typescript": true
+ },
+ "typescript.tsdk": "frontend/node_modules/typescript/lib"
}
diff --git a/frontend/.prettierrc b/frontend/.prettierrc
index 0edc4d041..4d9f8c8b6 100644
--- a/frontend/.prettierrc
+++ b/frontend/.prettierrc
@@ -1,15 +1,15 @@
{
- "useTabs": true,
- "singleQuote": true,
- "trailingComma": "none",
- "printWidth": 450,
- "plugins": ["prettier-plugin-svelte"],
- "overrides": [
- {
- "files": "*.svelte",
- "options": {
- "parser": "svelte"
- }
- }
- ]
+ "useTabs": true,
+ "singleQuote": true,
+ "trailingComma": "none",
+ "printWidth": 300,
+ "plugins": ["prettier-plugin-svelte"],
+ "overrides": [
+ {
+ "files": "*.svelte",
+ "options": {
+ "parser": "svelte"
+ }
+ }
+ ]
}
diff --git a/frontend/src/hooks.client.ts b/frontend/src/hooks.client.ts
index 34edabdf0..9dc7aa42b 100644
--- a/frontend/src/hooks.client.ts
+++ b/frontend/src/hooks.client.ts
@@ -38,19 +38,7 @@ const authHandler: Handle = async ({ event, resolve }) => {
const { url } = event;
const path = url.pathname;
- const publicPaths = [
- '/auth/login',
- '/auth/logout',
- '/img',
- '/auth/oidc/login',
- '/auth/oidc/callback',
- '/api/agents/register',
- '/api/agents/heartbeat',
- '/api/health',
- '/api/version',
- '/favicon.ico',
- '/_app'
- ];
+ const publicPaths = ['/auth/login', '/auth/logout', '/img', '/auth/oidc/login', '/auth/oidc/callback', '/api/agents/register', '/api/agents/heartbeat', '/api/health', '/api/version', '/favicon.ico', '/_app'];
const agentPollingPattern = /^\/api\/agents\/[^\/]+\/tasks$/;
const agentResultPattern = /^\/api\/agents\/[^\/]+\/tasks\/[^\/]+\/result$/;
diff --git a/frontend/src/lib/components/LogViewer.svelte b/frontend/src/lib/components/LogViewer.svelte
index 4e43f8467..c4b835f46 100644
--- a/frontend/src/lib/components/LogViewer.svelte
+++ b/frontend/src/lib/components/LogViewer.svelte
@@ -24,19 +24,7 @@
onStop?: () => void;
}
- let {
- containerId = null,
- stackId = null,
- type = 'container',
- maxLines = 1000,
- autoScroll = $bindable(true),
- showTimestamps = true,
- height = '400px',
- onClear,
- onToggleAutoScroll,
- onStart,
- onStop
- }: Props = $props();
+ let { containerId = null, stackId = null, type = 'container', maxLines = 1000, autoScroll = $bindable(true), showTimestamps = true, height = '400px', onClear, onToggleAutoScroll, onStart, onStop }: Props = $props();
let logs: LogEntry[] = $state([]);
let logContainer: HTMLElement | undefined = $state();
@@ -54,10 +42,7 @@
error = null;
onStart?.();
- const endpoint =
- type === 'stack'
- ? `/api/stacks/${stackId}/logs/stream?follow=true&tail=100&timestamps=${showTimestamps}`
- : `/api/containers/${containerId}/logs/stream?follow=true&tail=100&timestamps=${showTimestamps}`;
+ const endpoint = type === 'stack' ? `/api/stacks/${stackId}/logs/stream?follow=true&tail=100&timestamps=${showTimestamps}` : `/api/containers/${containerId}/logs/stream?follow=true&tail=100&timestamps=${showTimestamps}`;
eventSource = new EventSource(endpoint);
@@ -175,13 +160,7 @@
return logs.length;
}
- function addLogEntry(logData: {
- level: string;
- message: string;
- timestamp?: string;
- service?: string;
- containerId?: string;
- }) {
+ function addLogEntry(logData: { level: string; message: string; timestamp?: string; service?: string; containerId?: string }) {
const entry: LogEntry = {
timestamp: logData.timestamp || new Date().toISOString(),
level: logData.level as LogEntry['level'],
@@ -246,11 +225,7 @@
</div>
{/if}
- <div
- bind:this={logContainer}
- class="log-viewer overflow-y-auto rounded-lg border bg-black font-mono text-sm text-white"
- style="height: {height}"
- >
+ <div bind:this={logContainer} class="log-viewer overflow-y-auto rounded-lg border bg-black font-mono text-sm text-white" style="height: {height}">
{#if logs.length === 0}
<div class="p-4 text-center text-gray-500">
{#if !containerId}
@@ -263,9 +238,7 @@
</div>
{:else}
{#each logs as log (log.timestamp + log.message + (log.service || ''))}
- <div
- class="flex border-l-2 border-transparent px-3 py-1 transition-colors hover:border-blue-500 hover:bg-gray-900/50"
- >
+ <div class="flex border-l-2 border-transparent px-3 py-1 transition-colors hover:border-blue-500 hover:bg-gray-900/50">
{#if showTimestamps}
<span class="mr-3 w-20 shrink-0 text-xs text-gray-500">
{formatTimestamp(log.timestamp)}
@@ -293,7 +266,6 @@
<style>
.log-viewer {
- font-family:
- 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
+ font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}
</style>
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index 5d7f7a9bb..57a06255b 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -3,15 +3,11 @@
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import type { LoadingStates } from '$lib/types/loading-states.type';
- import ContainerAPIService from '$lib/services/api/container-api-service';
- import StackAPIService from '$lib/services/api/stack-api-service';
+ import { stackAPI, containerAPI } from '$lib/services/api';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import ArcaneButton from './arcane-button.svelte';
- const containerApi = new ContainerAPIService();
- const stackApi = new StackAPIService();
-
type TargetType = 'container' | 'stack';
let {
@@ -38,9 +34,7 @@
validating: false
});
- const isRunning = $derived(
- itemState === 'running' || (type === 'stack' && itemState === 'partially running')
- );
+ const isRunning = $derived(itemState === 'running' || (type === 'stack' && itemState === 'partially running'));
$effect(() => {
isLoading.start = loading.start ?? false;
@@ -71,17 +65,11 @@
isLoading.remove = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- type === 'container'
- ? containerApi.remove(id)
- : stackApi.destroy(id, removeVolumes, removeFiles)
- ),
+ result: await tryCatch(type === 'container' ? containerAPI.remove(id) : stackAPI.destroy(id, removeVolumes, removeFiles)),
message: `Failed to ${type === 'stack' ? 'Destroy' : 'Remove'} ${type}`,
setLoadingState: (value) => (isLoading.remove = value),
onSuccess: async () => {
- toast.success(
- `${type.charAt(0).toUpperCase() + type.slice(1)} ${type === 'stack' ? 'Destroyed' : 'Removed'} Successfully`
- );
+ toast.success(`${type.charAt(0).toUpperCase() + type.slice(1)} ${type === 'stack' ? 'Destroyed' : 'Removed'} Successfully`);
await invalidateAll();
goto(`/${type}s`);
}
@@ -106,13 +94,11 @@
action: async () => {
isLoading.redeploy = true;
handleApiResultWithCallbacks({
- result: await tryCatch(stackApi.redeploy(id)),
+ result: await tryCatch(stackAPI.redeploy(id)),
message: `Failed to Redeploy ${type}`,
setLoadingState: (value) => (isLoading.redeploy = value),
onSuccess: async () => {
- toast.success(
- `${type.charAt(0).toUpperCase() + type.slice(1)} Redeployed Successfully`
- );
+ toast.success(`${type.charAt(0).toUpperCase() + type.slice(1)} Redeployed Successfully`);
await invalidateAll();
}
});
@@ -125,7 +111,7 @@
async function handleStart() {
isLoading.start = true;
handleApiResultWithCallbacks({
- result: await tryCatch(type === 'container' ? containerApi.start(id) : stackApi.deploy(id)),
+ result: await tryCatch(type === 'container' ? containerAPI.start(id) : stackAPI.deploy(id)),
message: `Failed to Start ${type}`,
setLoadingState: (value) => (isLoading.start = value),
onSuccess: async () => {
@@ -138,7 +124,7 @@
async function handleDeploy() {
isLoading.start = true;
handleApiResultWithCallbacks({
- result: await tryCatch(stackApi.deploy(id)),
+ result: await tryCatch(stackAPI.deploy(id)),
message: `Failed to Start ${type}`,
setLoadingState: (value) => (isLoading.start = value),
onSuccess: async () => {
@@ -151,7 +137,7 @@
async function handleStop() {
isLoading.stop = true;
handleApiResultWithCallbacks({
- result: await tryCatch(type === 'container' ? containerApi.stop(id) : stackApi.down(id)),
+ result: await tryCatch(type === 'container' ? containerAPI.stop(id) : stackAPI.down(id)),
message: `Failed to Stop ${type}`,
setLoadingState: (value) => (isLoading.stop = value),
onSuccess: async () => {
@@ -164,9 +150,7 @@
async function handleRestart() {
isLoading.restart = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- type === 'container' ? containerApi.restart(id) : stackApi.restart(id)
- ),
+ result: await tryCatch(type === 'container' ? containerAPI.restart(id) : stackAPI.restart(id)),
message: `Failed to Restart ${type}`,
setLoadingState: (value) => (isLoading.restart = value),
onSuccess: async () => {
@@ -179,7 +163,7 @@
async function handlePull() {
isLoading.pulling = true;
handleApiResultWithCallbacks({
- result: await tryCatch(type === 'container' ? containerApi.pull(id) : stackApi.pull(id)),
+ result: await tryCatch(type === 'container' ? containerAPI.pull(id) : stackAPI.pull(id)),
message: 'Failed to Pull Image(s)',
setLoadingState: (value) => (isLoading.pulling = value),
onSuccess: async () => {
@@ -192,39 +176,17 @@
<div class="flex items-center gap-2">
{#if !isRunning}
- <ArcaneButton
- action={type === 'container' ? 'start' : 'deploy'}
- onClick={type === 'container' ? () => handleStart() : () => handleDeploy()}
- loading={isLoading.start}
- />
+ <ArcaneButton action={type === 'container' ? 'start' : 'deploy'} onClick={type === 'container' ? () => handleStart() : () => handleDeploy()} loading={isLoading.start} />
{:else}
- <ArcaneButton
- label={type === 'stack' ? 'Down' : 'Stop'}
- action="stop"
- onClick={() => handleStop()}
- loading={isLoading.stop}
- />
+ <ArcaneButton label={type === 'stack' ? 'Down' : 'Stop'} action="stop" onClick={() => handleStop()} loading={isLoading.stop} />
<ArcaneButton action="restart" onClick={() => handleRestart()} loading={isLoading.restart} />
{/if}
{#if type === 'container'}
- <ArcaneButton
- action="remove"
- onClick={() => confirmAction('remove')}
- loading={isLoading.remove}
- />
+ <ArcaneButton action="remove" onClick={() => confirmAction('remove')} loading={isLoading.remove} />
{:else}
- <ArcaneButton
- action="redeploy"
- onClick={() => confirmAction('redeploy')}
- loading={isLoading.redeploy}
- />
+ <ArcaneButton action="redeploy" onClick={() => confirmAction('redeploy')} loading={isLoading.redeploy} />
<ArcaneButton action="pull" onClick={handlePull} loading={isLoading.pulling} />
- <ArcaneButton
- label={type === 'stack' ? 'Destroy' : 'Remove'}
- action="remove"
- onClick={() => confirmAction('remove')}
- loading={isLoading.remove}
- />
+ <ArcaneButton label={type === 'stack' ? 'Destroy' : 'Remove'} action="remove" onClick={() => confirmAction('remove')} loading={isLoading.remove} />
{/if}
</div>
diff --git a/frontend/src/lib/components/arcane-button.svelte b/frontend/src/lib/components/arcane-button.svelte
index a62174fc7..a2351a52b 100644
--- a/frontend/src/lib/components/arcane-button.svelte
+++ b/frontend/src/lib/components/arcane-button.svelte
@@ -1,40 +1,8 @@
<script lang="ts">
import { Button, type Props as ButtonProps } from '$lib/components/ui/button/index.js';
- import {
- Play,
- StopCircle,
- RotateCcw,
- Download,
- Trash2,
- Loader2,
- RefreshCcwDot,
- ScanSearch,
- FileText,
- EditIcon as Edit,
- Check,
- X,
- Save,
- PlusCircle,
- type Icon as IconType,
- LayoutTemplate
- } from '@lucide/svelte';
+ import { Play, StopCircle, RotateCcw, Download, Trash2, Loader2, RefreshCcwDot, ScanSearch, FileText, EditIcon as Edit, Check, X, Save, PlusCircle, type Icon as IconType, LayoutTemplate } from '@lucide/svelte';
- type Action =
- | 'start'
- | 'deploy'
- | 'stop'
- | 'restart'
- | 'remove'
- | 'pull'
- | 'redeploy'
- | 'inspect'
- | 'logs'
- | 'edit'
- | 'confirm'
- | 'cancel'
- | 'save'
- | 'create'
- | 'template';
+ type Action = 'start' | 'deploy' | 'stop' | 'restart' | 'remove' | 'pull' | 'redeploy' | 'inspect' | 'logs' | 'edit' | 'confirm' | 'cancel' | 'save' | 'create' | 'template';
interface Props {
/** The type of action this button represents. Determines icon, default label, and variant. */
@@ -203,14 +171,7 @@
let iconMarginClass = $derived(!isIconOnlyButton ? 'mr-2' : '');
</script>
-<Button
- variant={config.variant}
- size={customSize}
- class={`${extraClass} ${config.customClass || ''}`}
- disabled={disabled || loading}
- onclick={onClick}
- aria-label={isIconOnlyButton ? displayLabel : undefined}
->
+<Button variant={config.variant} size={customSize} class={`${extraClass} ${config.customClass || ''}`} disabled={disabled || loading} onclick={onClick} aria-label={isIconOnlyButton ? displayLabel : undefined}>
{#if loading}
<Loader2 class="animate-spin {iconMarginClass} size-4" />
{#if !isIconOnlyButton}
diff --git a/frontend/src/lib/components/badges/status-badge.svelte b/frontend/src/lib/components/badges/status-badge.svelte
index 0a6d700f8..14f5f86d1 100644
--- a/frontend/src/lib/components/badges/status-badge.svelte
+++ b/frontend/src/lib/components/badges/status-badge.svelte
@@ -1,24 +1,7 @@
<script lang="ts">
import { cn } from '$lib/utils';
- type Variant =
- | 'red'
- | 'purple'
- | 'green'
- | 'blue'
- | 'gray'
- | 'amber'
- | 'pink'
- | 'indigo'
- | 'cyan'
- | 'lime'
- | 'emerald'
- | 'teal'
- | 'sky'
- | 'violet'
- | 'fuchsia'
- | 'rose'
- | 'orange';
+ type Variant = 'red' | 'purple' | 'green' | 'blue' | 'gray' | 'amber' | 'pink' | 'indigo' | 'cyan' | 'lime' | 'emerald' | 'teal' | 'sky' | 'violet' | 'fuchsia' | 'rose' | 'orange';
let {
text,
@@ -54,13 +37,6 @@
};
</script>
-<span
- class={cn(
- 'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium',
- variantStyles[typedVariant],
- className
- )}
- {...restProps}
->
+<span class={cn('inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium', variantStyles[typedVariant], className)} {...restProps}>
{text}
</span>
diff --git a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
index 4a08ba9ca..0a558640c 100644
--- a/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
+++ b/frontend/src/lib/components/confirm-dialog/confirm-dialog.svelte
@@ -46,24 +46,11 @@
{#each $confirmDialogStore.checkboxes as checkbox (checkbox.id)}
<div class="flex items-center space-x-2">
{#if checkboxStates[checkbox.id] !== undefined}
- <Checkbox
- id={checkbox.id}
- bind:checked={checkboxStates[checkbox.id]}
- aria-labelledby={`${checkbox.id}-label`}
- />
+ <Checkbox id={checkbox.id} bind:checked={checkboxStates[checkbox.id]} aria-labelledby={`${checkbox.id}-label`} />
{:else}
- <Checkbox
- id={checkbox.id}
- checked={false}
- onchange={(e) => (checkboxStates[checkbox.id] = true)}
- aria-labelledby={`${checkbox.id}-label`}
- />
+ <Checkbox id={checkbox.id} checked={false} onchange={(e) => (checkboxStates[checkbox.id] = true)} aria-labelledby={`${checkbox.id}-label`} />
{/if}
- <Label
- id={`${checkbox.id}-label`}
- for={checkbox.id}
- class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- >
+ <Label id={`${checkbox.id}-label`} for={checkbox.id} class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
{checkbox.label}
</Label>
</div>
@@ -73,16 +60,8 @@
<Dialog.Footer class="mt-6">
<div class="flex justify-end gap-2">
- <Button
- class="arcane-button-cancel"
- variant="outline"
- onclick={() => ($confirmDialogStore.open = false)}>Cancel</Button
- >
- <Button
- class="arcane-button-create"
- variant={$confirmDialogStore.confirm.destructive ? 'destructive' : 'default'}
- onclick={handleConfirm}
- >
+ <Button class="arcane-button-cancel" variant="outline" onclick={() => ($confirmDialogStore.open = false)}>Cancel</Button>
+ <Button class="arcane-button-create" variant={$confirmDialogStore.confirm.destructive ? 'destructive' : 'default'} onclick={handleConfirm}>
{$confirmDialogStore.confirm.label}
</Button>
</div>
diff --git a/frontend/src/lib/components/dialogs/container-registry-form-dialog.svelte b/frontend/src/lib/components/dialogs/container-registry-form-dialog.svelte
deleted file mode 100644
index 4d1cbadcd..000000000
--- a/frontend/src/lib/components/dialogs/container-registry-form-dialog.svelte
+++ /dev/null
@@ -1,189 +0,0 @@
-<script lang="ts">
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import { Textarea } from '$lib/components/ui/textarea/index.js';
- import { Switch } from '$lib/components/ui/switch/index.js';
- import { Loader2 } from '@lucide/svelte';
- import type { ContainerRegistry } from '$lib/models/container-registry';
- import type {
- ContainerRegistryCreateDto,
- ContainerRegistryUpdateDto
- } from '$lib/dto/container-registry-dto';
- import { preventDefault } from '$lib/utils/form.utils';
-
- type ContainerRegistryFormDialogProps = {
- open: boolean;
- registryToEdit: ContainerRegistry | null;
- onSubmit: (detail: {
- registry: ContainerRegistryCreateDto | ContainerRegistryUpdateDto;
- isEditMode: boolean;
- }) => void;
- isLoading: boolean;
- };
-
- let {
- open = $bindable(false),
- registryToEdit = $bindable(),
- onSubmit,
- isLoading
- }: ContainerRegistryFormDialogProps = $props();
-
- let internalRegistry = $state<ContainerRegistry>({
- url: '',
- username: '',
- token: '',
- description: '',
- insecure: false,
- enabled: true
- });
- let isEditMode = $state(false);
-
- $effect(() => {
- if (registryToEdit) {
- internalRegistry = {
- ...registryToEdit,
- token: '' // Don't pre-fill token for security
- };
- isEditMode = true;
- } else {
- internalRegistry = {
- url: '',
- username: '',
- token: '',
- description: '',
- insecure: false,
- enabled: true
- };
- isEditMode = false;
- }
- });
-
- function handleSubmit() {
- if (isLoading) return;
-
- const registryData = {
- url: internalRegistry.url,
- username: internalRegistry.username,
- token: internalRegistry.token,
- description: internalRegistry.description,
- insecure: internalRegistry.insecure,
- enabled: internalRegistry.enabled
- };
-
- // Call the onSubmit function directly with the detail
- onSubmit({ registry: registryData, isEditMode });
- }
-
- function handleOpenChange(newOpenState: boolean) {
- open = newOpenState;
- if (!newOpenState) {
- registryToEdit = null;
- }
- }
-
- // Form validation
- let isFormValid = $derived(
- internalRegistry.url.trim() !== '' &&
- internalRegistry.username.trim() !== '' &&
- (isEditMode || internalRegistry.token?.trim() !== '')
- );
-</script>
-
-<Dialog.Root bind:open onOpenChange={handleOpenChange}>
- <Dialog.Content class="sm:max-w-[500px]">
- <Dialog.Header>
- <Dialog.Title>{isEditMode ? 'Edit' : 'Add'} Container Registry</Dialog.Title>
- <Dialog.Description>
- {isEditMode
- ? 'Update the details for this container registry.'
- : 'Enter the details for the new container registry.'}
- </Dialog.Description>
- </Dialog.Header>
- <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <div class="grid gap-2">
- <Label for="registry-url">Registry URL *</Label>
- <Input
- id="registry-url"
- bind:value={internalRegistry.url}
- placeholder="e.g., docker.io, ghcr.io, gcr.io, quay.io"
- required
- />
- <p class="text-muted-foreground text-xs">Leave empty or use 'docker.io' for Docker Hub</p>
- </div>
-
- <div class="grid gap-2">
- <Label for="registry-username">Username *</Label>
- <Input
- id="registry-username"
- bind:value={internalRegistry.username}
- placeholder="Your registry username"
- required
- />
- </div>
-
- <div class="grid gap-2">
- <Label for="registry-token">Password/Token *</Label>
- <Input
- type="password"
- id="registry-token"
- bind:value={internalRegistry.token}
- placeholder={isEditMode
- ? 'Leave empty to keep current token'
- : 'Your registry password or token'}
- required={!isEditMode}
- />
- <p class="text-muted-foreground text-xs">
- For GitHub, use a Personal Access Token. For Docker Hub, use your password.
- </p>
- </div>
-
- <div class="grid gap-2">
- <Label for="registry-description">Description</Label>
- <Textarea
- id="registry-description"
- bind:value={internalRegistry.description}
- placeholder="Optional description for this registry"
- rows={2}
- />
- </div>
-
- <div class="flex items-center justify-between rounded-lg border p-4">
- <div class="space-y-0.5">
- <Label for="registry-enabled" class="text-base">Enabled</Label>
- <p class="text-muted-foreground text-sm">Enable this registry for authentication</p>
- </div>
- <Switch id="registry-enabled" bind:checked={internalRegistry.enabled} />
- </div>
-
- <div class="flex items-center justify-between rounded-lg border p-4">
- <div class="space-y-0.5">
- <Label for="registry-insecure" class="text-base">Allow Insecure Connection</Label>
- <p class="text-muted-foreground text-sm">
- Allow HTTP connections (not recommended for production)
- </p>
- </div>
- <Switch id="registry-insecure" bind:checked={internalRegistry.insecure} />
- </div>
-
- <Dialog.Footer>
- <Button
- type="button"
- class="arcane-button-cancel"
- variant="outline"
- onclick={() => (open = false)}
- disabled={isLoading}
- >
- Cancel
- </Button>
- <Button type="submit" class="arcane-button-create" disabled={isLoading || !isFormValid}>
- {#if isLoading}
- <Loader2 class="mr-2 size-4 animate-spin" />
- {/if}
- {isEditMode ? 'Save Changes' : 'Add Registry'}
- </Button>
- </Dialog.Footer>
- </form>
- </Dialog.Content>
-</Dialog.Root>
diff --git a/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte b/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte
index 7a1bd913a..242b80041 100644
--- a/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/prune-confirmation-dialog.svelte
@@ -16,13 +16,7 @@
onCancel?: () => void;
}
- let {
- open = $bindable(),
- isPruning = false,
- imagePruneMode = 'dangling',
- onConfirm = () => {},
- onCancel = () => {}
- }: Props = $props();
+ let { open = $bindable(), isPruning = false, imagePruneMode = 'dangling', onConfirm = () => {}, onCancel = () => {} }: Props = $props();
let pruneContainers = $state(true);
let pruneImages = $state(true);
@@ -61,55 +55,31 @@
<Dialog.Content class="sm:max-w-[450px]" onkeydown={handleKeydown}>
<Dialog.Header>
<Dialog.Title>Confirm System Prune</Dialog.Title>
- <Dialog.Description
- >Select the resources you want to prune. This action permanently removes unused data and
- cannot be undone.</Dialog.Description
- >
+ <Dialog.Description>Select the resources you want to prune. This action permanently removes unused data and cannot be undone.</Dialog.Description>
</Dialog.Header>
<div class="grid gap-4 py-4">
<div class="flex items-center space-x-3">
<Checkbox.Root id="prune-containers" bind:checked={pruneContainers} disabled={isPruning} />
- <Label
- for="prune-containers"
- class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- >Stopped Containers</Label
- >
+ <Label for="prune-containers" class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">Stopped Containers</Label>
</div>
<div class="flex items-center space-x-3">
<Checkbox.Root id="prune-images" bind:checked={pruneImages} disabled={isPruning} />
- <Label
- for="prune-images"
- class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- >
+ <Label for="prune-images" class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
Unused Images ({imagePruneMode === 'dangling' ? 'Dangling Only' : 'All Unused'})
</Label>
</div>
<div class="flex items-center space-x-3">
<Checkbox.Root id="prune-networks" bind:checked={pruneNetworks} disabled={isPruning} />
- <Label
- for="prune-networks"
- class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- >Unused Networks</Label
- >
+ <Label for="prune-networks" class="text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">Unused Networks</Label>
</div>
<div class="flex items-start space-x-3">
- <Checkbox.Root
- id="prune-volumes"
- bind:checked={pruneVolumes}
- disabled={isPruning}
- class="mt-1"
- />
+ <Checkbox.Root id="prune-volumes" bind:checked={pruneVolumes} disabled={isPruning} class="mt-1" />
<div class="grid gap-1.5 leading-none">
- <Label
- for="prune-volumes"
- class="text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
- >
+ <Label for="prune-volumes" class="text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
Unused Volumes <span class="text-destructive">(Potentially Destructive!)</span>
</Label>
- <p class="text-muted-foreground text-xs">
- Only enable this if you are certain no important data resides in unused volumes.
- </p>
+ <p class="text-muted-foreground text-xs">Only enable this if you are certain no important data resides in unused volumes.</p>
</div>
</div>
@@ -117,26 +87,14 @@
<Alert.Root variant="destructive" class="mt-2">
<AlertCircle class="size-4" />
<Alert.Title>Warning: Pruning Volumes</Alert.Title>
- <Alert.Description
- >Pruning volumes permanently deletes data. Ensure you have backups if necessary.</Alert.Description
- >
+ <Alert.Description>Pruning volumes permanently deletes data. Ensure you have backups if necessary.</Alert.Description>
</Alert.Root>
{/if}
</div>
<Dialog.Footer>
- <Button
- class="arcane-button-cancel"
- variant="outline"
- onclick={handleCancel}
- disabled={isPruning}>Cancel</Button
- >
- <Button
- class="arcane-button-remove"
- variant="destructive"
- onclick={handleConfirm}
- disabled={selectedTypes.length === 0 || isPruning}
- >
+ <Button class="arcane-button-cancel" variant="outline" onclick={handleCancel} disabled={isPruning}>Cancel</Button>
+ <Button class="arcane-button-remove" variant="destructive" onclick={handleConfirm} disabled={selectedTypes.length === 0 || isPruning}>
{#if isPruning}
<Loader2 class="mr-2 size-4 animate-spin" /> Pruning...
{:else}
diff --git a/frontend/src/lib/components/dialogs/user-form-dialog.svelte b/frontend/src/lib/components/dialogs/user-form-dialog.svelte
deleted file mode 100644
index d617ce8bd..000000000
--- a/frontend/src/lib/components/dialogs/user-form-dialog.svelte
+++ /dev/null
@@ -1,168 +0,0 @@
-<script lang="ts">
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import * as Select from '$lib/components/ui/select/index.js';
- import { Loader2, UserPlus, Save } from '@lucide/svelte';
- import type { User } from '$lib/types/user.type';
- import { preventDefault } from '$lib/utils/form.utils';
-
- let {
- open = $bindable(false),
- userToEdit = $bindable<User | null>(null),
- roles = [],
- isLoading = $bindable(false),
- onSubmit = $bindable(() => {}),
- allowUsernameEdit = false
- }: {
- open?: boolean;
- userToEdit?: User | null;
- roles: { id: string; name: string }[];
- isLoading?: boolean;
- onSubmit?: (data: {
- user: Partial<User> & { password?: string };
- isEditMode: boolean;
- userId?: string;
- }) => void;
- allowUsernameEdit?: boolean;
- } = $props();
-
- let username = $state('');
- let password = $state('');
- let displayName = $state('');
- let email = $state('');
- let selectedRole = $state('user');
- let error = $state<string | null>(null);
-
- let isEditMode = $derived(!!userToEdit);
- let dialogTitle = $derived(isEditMode ? 'Edit User' : 'Create User');
- let submitButtonText = $derived(isEditMode ? 'Save Changes' : 'Create User');
- let SubmitIcon = $derived(isEditMode ? Save : UserPlus);
- let canEditUsername = $derived(!isEditMode || allowUsernameEdit);
-
- $effect(() => {
- if (open) {
- error = null;
- if (userToEdit) {
- username = userToEdit.username;
- password = '';
- displayName = userToEdit.displayName || '';
- email = userToEdit.email || '';
- selectedRole = userToEdit.roles?.[0] || 'admin';
- } else {
- username = '';
- password = '';
- displayName = '';
- email = '';
- selectedRole = 'admin';
- }
- }
- });
-
- async function handleSubmit() {
- if (isLoading) return;
- error = null;
-
- const userData: Partial<User> & { password?: string } = {
- username,
- displayName,
- email,
- roles: [selectedRole]
- };
-
- if (!isEditMode || (isEditMode && password)) {
- userData.password = password;
- }
-
- try {
- onSubmit({ user: userData, isEditMode, userId: userToEdit?.id });
- } catch (err: unknown) {
- const errorMessage = err instanceof Error ? err.message : 'An unexpected error occurred.';
- error = errorMessage;
- }
- }
-</script>
-
-<Dialog.Root bind:open>
- <Dialog.Content class="sm:max-w-[425px]">
- <Dialog.Header>
- <Dialog.Title>{dialogTitle}</Dialog.Title>
- {#if !isEditMode}
- <Dialog.Description>Enter the details for the new user.</Dialog.Description>
- {/if}
- </Dialog.Header>
-
- <form class="grid gap-4 py-4" onsubmit={preventDefault(handleSubmit)} autocomplete="off">
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="username" class="text-right">Username</Label>
- <Input
- autocomplete="off"
- id="username"
- bind:value={username}
- required
- class="col-span-3"
- disabled={!canEditUsername}
- />
- </div>
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="password" class="text-right">Password</Label>
- <Input
- autocomplete="off"
- id="password"
- type="password"
- bind:value={password}
- required={!isEditMode}
- placeholder={isEditMode ? 'Leave blank to keep current' : 'Required'}
- class="col-span-3"
- />
- </div>
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="displayName" class="text-right">Display Name</Label>
- <Input autocomplete="off" id="displayName" bind:value={displayName} class="col-span-3" />
- </div>
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="email" class="text-right">Email</Label>
- <Input autocomplete="off" id="email" type="email" bind:value={email} class="col-span-3" />
- </div>
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="role" class="text-right">Role</Label>
- <Select.Root name="role" type="single" bind:value={selectedRole} disabled={true}>
- <Select.Trigger class="col-span-3">
- <span>{roles.find((r) => r.id === selectedRole)?.name || 'Select a role'}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Group>
- {#each roles as role (role.id)}
- <Select.Item value={role.id}>{role.name}</Select.Item>
- {/each}
- </Select.Group>
- </Select.Content>
- </Select.Root>
- </div>
-
- {#if error}
- <p class="text-destructive col-span-4 text-center text-sm">{error}</p>
- {/if}
-
- <Dialog.Footer>
- <Button
- type="button"
- class="arcane-button-cancel"
- variant="outline"
- onclick={() => (open = false)}
- disabled={isLoading}>Cancel</Button
- >
- <Button type="submit" class="arcane-button-create" disabled={isLoading}>
- {#if isLoading}
- <Loader2 class="size-4 animate-spin" />
- Creating...
- {:else}
- <SubmitIcon class="size-4" />
- {submitButtonText}
- {/if}
- </Button>
- </Dialog.Footer>
- </form>
- </Dialog.Content>
-</Dialog.Root>
diff --git a/frontend/src/lib/components/dropdown-card.svelte b/frontend/src/lib/components/dropdown-card.svelte
index 45b007d06..e05355d9d 100644
--- a/frontend/src/lib/components/dropdown-card.svelte
+++ b/frontend/src/lib/components/dropdown-card.svelte
@@ -63,9 +63,7 @@
{/if}
</div>
<Button class="ml-10 h-8 p-3" variant="ghost" aria-label="Expand Card">
- <LucideChevronDown
- class={cn('size-5 transition-transform duration-200', expanded && 'rotate-180 transform')}
- />
+ <LucideChevronDown class={cn('size-5 transition-transform duration-200', expanded && 'rotate-180 transform')} />
</Button>
</div>
</Card.Header>
diff --git a/frontend/src/lib/components/env-editor.svelte b/frontend/src/lib/components/env-editor.svelte
index 86a49c0d6..679506ca2 100644
--- a/frontend/src/lib/components/env-editor.svelte
+++ b/frontend/src/lib/components/env-editor.svelte
@@ -5,11 +5,7 @@
import { StreamLanguage } from '@codemirror/language';
import { properties } from '@codemirror/legacy-modes/mode/properties';
- let {
- value = $bindable(''),
- placeholder = '# Add environment variables here',
- readOnly = false
- } = $props();
+ let { value = $bindable(''), placeholder = '# Add environment variables here', readOnly = false } = $props();
</script>
{#if browser}
diff --git a/frontend/src/lib/components/form/form-input.svelte b/frontend/src/lib/components/form/form-input.svelte
index 0002e2ff6..ba1986f3c 100644
--- a/frontend/src/lib/components/form/form-input.svelte
+++ b/frontend/src/lib/components/form/form-input.svelte
@@ -6,7 +6,7 @@
import { Label } from '$lib/components/ui/label';
import type { Snippet } from 'svelte';
import type { HTMLAttributes } from 'svelte/elements';
- import type { FormInput } from '$lib/types/form.type';
+ import type { FormInput } from '$lib/utils/form.utils';
let {
input = $bindable(),
@@ -19,6 +19,7 @@
type = 'text',
rows = 3,
children,
+ autocomplete = 'off',
...restProps
}: HTMLAttributes<HTMLDivElement> & {
input?: FormInput<string | boolean | number | Date | undefined>;
@@ -31,6 +32,7 @@
type?: 'text' | 'password' | 'email' | 'number' | 'checkbox' | 'date' | 'switch' | 'textarea';
rows?: number;
children?: Snippet;
+ autocomplete?: HTMLInputElement['autocomplete'];
} = $props();
const id = label?.toLowerCase().replace(/ /g, '-');
@@ -52,7 +54,7 @@
{:else if type === 'textarea'}
<Textarea {id} {placeholder} {rows} bind:value={input.value as string} {disabled} />
{:else}
- <Input {id} {placeholder} {type} bind:value={input.value} {disabled} />
+ <Input {id} {placeholder} {type} bind:value={input.value} {disabled} {autocomplete} />
{/if}
{/if}
{#if input?.error}
diff --git a/frontend/src/lib/components/form/labeled-switch.svelte b/frontend/src/lib/components/form/labeled-switch.svelte
new file mode 100644
index 000000000..2a93c47d2
--- /dev/null
+++ b/frontend/src/lib/components/form/labeled-switch.svelte
@@ -0,0 +1,34 @@
+<script lang="ts">
+ import { Label } from '$lib/components/ui/label';
+ import { Switch } from '$lib/components/ui/switch/index.js';
+
+ let {
+ id,
+ checked = $bindable(),
+ label,
+ description,
+ disabled = false,
+ onCheckedChange
+ }: {
+ id: string;
+ checked: boolean;
+ label: string;
+ description?: string;
+ disabled?: boolean;
+ onCheckedChange?: (checked: boolean) => void;
+ } = $props();
+</script>
+
+<div class="items-top flex space-x-2">
+ <Switch {id} {disabled} onCheckedChange={(v) => onCheckedChange && onCheckedChange(v == true)} bind:checked />
+ <div class="grid gap-1.5 leading-none">
+ <Label for={id} class="mb-0 text-sm font-medium leading-none">
+ {label}
+ </Label>
+ {#if description}
+ <p class="text-muted-foreground text-[0.8rem]">
+ {description}
+ </p>
+ {/if}
+ </div>
+</div>
diff --git a/frontend/src/lib/components/form/select-with-label.svelte b/frontend/src/lib/components/form/select-with-label.svelte
new file mode 100644
index 000000000..5979920e4
--- /dev/null
+++ b/frontend/src/lib/components/form/select-with-label.svelte
@@ -0,0 +1,47 @@
+<script lang="ts">
+ import { Label } from '$lib/components/ui/label';
+ import * as Select from '$lib/components/ui/select/index.js';
+
+ let {
+ id,
+ value = $bindable(),
+ label,
+ description,
+ disabled = false,
+ placeholder = 'Select an option',
+ options = [],
+ onValueChange
+ }: {
+ id: string;
+ value: string;
+ label: string;
+ description?: string;
+ disabled?: boolean;
+ placeholder?: string;
+ options: { label: string; value: string }[];
+ onValueChange?: (value: string) => void;
+ } = $props();
+</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.Trigger class="w-full" {id}>
+ <span>{options.find((option) => option.value === value)?.label || placeholder}</span>
+ </Select.Trigger>
+ <Select.Content>
+ {#each options as option (option.value)}
+ <Select.Item value={option.value}>
+ {option.label}
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ {#if description}
+ <p class="text-muted-foreground text-[0.8rem]">
+ {description}
+ </p>
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/forms/ImagePullForm.svelte b/frontend/src/lib/components/forms/ImagePullForm.svelte
index 00fac2951..71107a55a 100644
--- a/frontend/src/lib/components/forms/ImagePullForm.svelte
+++ b/frontend/src/lib/components/forms/ImagePullForm.svelte
@@ -66,25 +66,13 @@
<div class="space-y-4">
<div class="space-y-2">
<Label for="imageRef">Image Name</Label>
- <Input
- id="imageRef"
- bind:value={imageRef}
- placeholder="nginx, redis, ubuntu, etc."
- disabled={pulling}
- onkeypress={handleKeyPress}
- />
+ <Input id="imageRef" bind:value={imageRef} placeholder="nginx, redis, ubuntu, etc." disabled={pulling} onkeypress={handleKeyPress} />
<p class="text-muted-foreground text-xs">Enter the image name (e.g., nginx, redis, ubuntu)</p>
</div>
<div class="space-y-2">
<Label for="tag">Tag (Optional)</Label>
- <Input
- id="tag"
- bind:value={tag}
- placeholder="latest"
- disabled={pulling}
- onkeypress={handleKeyPress}
- />
+ <Input id="tag" bind:value={tag} placeholder="latest" disabled={pulling} onkeypress={handleKeyPress} />
<p class="text-muted-foreground text-xs">Specify a tag version (defaults to 'latest')</p>
</div>
diff --git a/frontend/src/lib/components/forms/QuickContainerForm.svelte b/frontend/src/lib/components/forms/QuickContainerForm.svelte
index d43c226c5..83c6edabb 100644
--- a/frontend/src/lib/components/forms/QuickContainerForm.svelte
+++ b/frontend/src/lib/components/forms/QuickContainerForm.svelte
@@ -85,9 +85,7 @@
if (containerName.trim()) {
const containerNameRegex = /^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/;
if (!containerNameRegex.test(containerName.trim())) {
- toast.error(
- 'Container name must start with alphanumeric character and can only contain letters, numbers, underscores, periods, and hyphens'
- );
+ toast.error('Container name must start with alphanumeric character and can only contain letters, numbers, underscores, periods, and hyphens');
return;
}
}
@@ -150,35 +148,27 @@
// Basic path validation (should start with / on Unix systems or contain : on Windows)
const hostPath = volume.host.trim();
if (!hostPath.startsWith('/') && !hostPath.match(/^[a-zA-Z]:/)) {
- toast.error(
- `Volume mapping ${i + 1}: Host path should be an absolute path (e.g., /path/to/dir or C:/path/to/dir)`
- );
+ toast.error(`Volume mapping ${i + 1}: Host path should be an absolute path (e.g., /path/to/dir or C:/path/to/dir)`);
return;
}
// Validate container path format
const containerPath = volume.container.trim();
if (!containerPath.startsWith('/')) {
- toast.error(
- `Volume mapping ${i + 1}: Container path must be an absolute path starting with /`
- );
+ toast.error(`Volume mapping ${i + 1}: Container path must be an absolute path starting with /`);
return;
}
// Check for reserved container paths
const reservedPaths = ['/proc', '/sys', '/dev'];
if (reservedPaths.some((reserved) => containerPath.startsWith(reserved))) {
- toast.error(
- `Volume mapping ${i + 1}: Cannot mount to reserved system path ${containerPath}`
- );
+ toast.error(`Volume mapping ${i + 1}: Cannot mount to reserved system path ${containerPath}`);
return;
}
}
// Check for duplicate container mount points
- const containerPaths = volumes
- .filter((v) => v.host && v.container)
- .map((v) => v.container.trim());
+ const containerPaths = volumes.filter((v) => v.host && v.container).map((v) => v.container.trim());
const uniqueContainerPaths = new Set(containerPaths);
if (containerPaths.length !== uniqueContainerPaths.size) {
toast.error('Duplicate container mount points are not allowed');
@@ -201,18 +191,14 @@
// Validate environment variable key format
const envKeyRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
if (!envKeyRegex.test(envVar.key.trim())) {
- toast.error(
- `Environment variable ${i + 1}: Key must start with letter or underscore and contain only letters, numbers, and underscores`
- );
+ toast.error(`Environment variable ${i + 1}: Key must start with letter or underscore and contain only letters, numbers, and underscores`);
return;
}
// Check for reserved environment variables
const reservedEnvVars = ['PATH', 'HOME', 'USER', 'SHELL'];
if (reservedEnvVars.includes(envVar.key.trim().toUpperCase())) {
- toast.error(
- `Environment variable ${i + 1}: Cannot override reserved variable ${envVar.key}`
- );
+ toast.error(`Environment variable ${i + 1}: Cannot override reserved variable ${envVar.key}`);
return;
}
}
@@ -260,12 +246,7 @@
<div class="space-y-2">
<Label for="containerName">Container Name (Optional)</Label>
- <Input
- id="containerName"
- bind:value={containerName}
- placeholder="my-container"
- disabled={running}
- />
+ <Input id="containerName" bind:value={containerName} placeholder="my-container" disabled={running} />
</div>
</div>
@@ -301,19 +282,9 @@
</div>
{#each volumes as volume, index}
<div class="flex items-center gap-2">
- <Input
- bind:value={volume.host}
- placeholder="/host/path"
- disabled={running}
- class="flex-1"
- />
+ <Input bind:value={volume.host} placeholder="/host/path" disabled={running} class="flex-1" />
<span class="text-muted-foreground">:</span>
- <Input
- bind:value={volume.container}
- placeholder="/container/path"
- disabled={running}
- class="flex-1"
- />
+ <Input bind:value={volume.container} placeholder="/container/path" disabled={running} class="flex-1" />
<Button variant="outline" size="sm" onclick={() => removeVolume(index)} disabled={running}>
<Trash2 class="size-4" />
</Button>
@@ -332,12 +303,7 @@
</div>
{#each envVars as envVar, index}
<div class="flex items-center gap-2">
- <Input
- bind:value={envVar.key}
- placeholder="VARIABLE_NAME"
- disabled={running}
- class="flex-1"
- />
+ <Input bind:value={envVar.key} placeholder="VARIABLE_NAME" disabled={running} class="flex-1" />
<span class="text-muted-foreground">=</span>
<Input bind:value={envVar.value} placeholder="value" disabled={running} class="flex-1" />
<Button variant="outline" size="sm" onclick={() => removeEnvVar(index)} disabled={running}>
@@ -367,12 +333,7 @@
<div class="space-y-2">
<Label for="restartPolicy">Restart Policy</Label>
- <select
- id="restartPolicy"
- bind:value={restartPolicy}
- disabled={running}
- class="border-input bg-background w-full rounded-md border px-3 py-2"
- >
+ <select id="restartPolicy" bind:value={restartPolicy} disabled={running} class="border-input bg-background w-full rounded-md border px-3 py-2">
<option value="no">No</option>
<option value="always">Always</option>
<option value="unless-stopped">Unless Stopped</option>
diff --git a/frontend/src/lib/components/forms/StackDeploymentForm.svelte b/frontend/src/lib/components/forms/StackDeploymentForm.svelte
index 67fbee937..b3ad57797 100644
--- a/frontend/src/lib/components/forms/StackDeploymentForm.svelte
+++ b/frontend/src/lib/components/forms/StackDeploymentForm.svelte
@@ -110,9 +110,7 @@ volumes:
const stackNameRegex = /^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/;
const trimmedStackName = stackName.trim().toLowerCase();
if (!stackNameRegex.test(trimmedStackName)) {
- toast.error(
- 'Stack name must start with a letter, contain only lowercase letters, numbers, and hyphens, and not end with a hyphen'
- );
+ toast.error('Stack name must start with a letter, contain only lowercase letters, numbers, and hyphens, and not end with a hyphen');
return;
}
@@ -163,9 +161,7 @@ volumes:
const servicesMatch = composeContent.match(/services:\s*\n([\s\S]*?)(?=\n\w|\n$|$)/);
if (servicesMatch) {
const servicesSection = servicesMatch[1];
- const serviceLines = servicesSection
- .split('\n')
- .filter((line) => line.trim() && !line.startsWith(' '));
+ const serviceLines = servicesSection.split('\n').filter((line) => line.trim() && !line.startsWith(' '));
if (serviceLines.length === 0) {
toast.error('At least one service must be defined in the services section');
@@ -199,9 +195,7 @@ volumes:
// Validate environment variable key format
const envKeyRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
if (!envKeyRegex.test(key.trim())) {
- toast.error(
- `Environment variable "${key}" must start with letter or underscore and contain only letters, numbers, and underscores`
- );
+ toast.error(`Environment variable "${key}" must start with letter or underscore and contain only letters, numbers, and underscores`);
return;
}
}
@@ -241,102 +235,56 @@ volumes:
const errorMessage = err.message.toLowerCase();
// Network/connectivity errors
- if (
- errorMessage.includes('network') ||
- errorMessage.includes('connection') ||
- errorMessage.includes('timeout')
- ) {
- toast.error(
- 'Network error: Unable to connect to the deployment service. Please check your connection and try again.'
- );
+ if (errorMessage.includes('network') || errorMessage.includes('connection') || errorMessage.includes('timeout')) {
+ toast.error('Network error: Unable to connect to the deployment service. Please check your connection and try again.');
return;
}
// Permission/authentication errors
- if (
- errorMessage.includes('unauthorized') ||
- errorMessage.includes('forbidden') ||
- errorMessage.includes('permission')
- ) {
- toast.error(
- 'Permission denied: You may not have sufficient permissions to deploy stacks.'
- );
+ if (errorMessage.includes('unauthorized') || errorMessage.includes('forbidden') || errorMessage.includes('permission')) {
+ toast.error('Permission denied: You may not have sufficient permissions to deploy stacks.');
return;
}
// Stack already exists
if (errorMessage.includes('already exists') || errorMessage.includes('conflict')) {
- toast.error(
- `Stack "${trimmedStackName}" already exists. Please choose a different name or remove the existing stack first.`
- );
+ toast.error(`Stack "${trimmedStackName}" already exists. Please choose a different name or remove the existing stack first.`);
return;
}
// Docker/compose specific errors
- if (
- errorMessage.includes('yaml') ||
- errorMessage.includes('compose') ||
- errorMessage.includes('invalid')
- ) {
- toast.error(
- 'Invalid Docker Compose configuration. Please check your compose content and try again.'
- );
+ if (errorMessage.includes('yaml') || errorMessage.includes('compose') || errorMessage.includes('invalid')) {
+ toast.error('Invalid Docker Compose configuration. Please check your compose content and try again.');
return;
}
// Resource errors
- if (
- errorMessage.includes('memory') ||
- errorMessage.includes('disk') ||
- errorMessage.includes('resource')
- ) {
- toast.error(
- 'Insufficient resources: The deployment requires more memory, disk space, or other resources than available.'
- );
+ if (errorMessage.includes('memory') || errorMessage.includes('disk') || errorMessage.includes('resource')) {
+ toast.error('Insufficient resources: The deployment requires more memory, disk space, or other resources than available.');
return;
}
// Image pull errors
- if (
- errorMessage.includes('pull') ||
- errorMessage.includes('image') ||
- errorMessage.includes('registry')
- ) {
- toast.error(
- 'Image error: Unable to pull required Docker images. Please check image names and registry availability.'
- );
+ if (errorMessage.includes('pull') || errorMessage.includes('image') || errorMessage.includes('registry')) {
+ toast.error('Image error: Unable to pull required Docker images. Please check image names and registry availability.');
return;
}
// Port binding errors
- if (
- errorMessage.includes('port') ||
- errorMessage.includes('bind') ||
- errorMessage.includes('address already in use')
- ) {
- toast.error(
- 'Port conflict: One or more ports are already in use. Please check your port mappings.'
- );
+ if (errorMessage.includes('port') || errorMessage.includes('bind') || errorMessage.includes('address already in use')) {
+ toast.error('Port conflict: One or more ports are already in use. Please check your port mappings.');
return;
}
// Volume/mount errors
- if (
- errorMessage.includes('volume') ||
- errorMessage.includes('mount') ||
- errorMessage.includes('path')
- ) {
- toast.error(
- 'Volume error: There was an issue with volume mounts or paths. Please check your volume configurations.'
- );
+ if (errorMessage.includes('volume') || errorMessage.includes('mount') || errorMessage.includes('path')) {
+ toast.error('Volume error: There was an issue with volume mounts or paths. Please check your volume configurations.');
return;
}
// Agent-specific errors
if (errorMessage.includes('agent') || errorMessage.includes('offline')) {
- toast.error(
- 'Agent error: The target agent is offline or unavailable. Please try again later.'
- );
+ toast.error('Agent error: The target agent is offline or unavailable. Please try again later.');
return;
}
@@ -358,31 +306,15 @@ volumes:
<div class="space-y-3">
<Label>How would you like to deploy?</Label>
<div class="grid grid-cols-3 gap-2">
- <Button
- variant={deploymentMode === 'compose' ? 'default' : 'outline'}
- size="sm"
- onclick={() => (deploymentMode = 'compose')}
- class="flex h-auto flex-col p-3"
- >
+ <Button variant={deploymentMode === 'compose' ? 'default' : 'outline'} size="sm" onclick={() => (deploymentMode = 'compose')} class="flex h-auto flex-col p-3">
<FileText class="mb-1 size-4" />
<span class="text-xs">Write Compose</span>
</Button>
- <Button
- variant={deploymentMode === 'template' ? 'default' : 'outline'}
- size="sm"
- onclick={() => (deploymentMode = 'template')}
- class="flex h-auto flex-col p-3"
- >
+ <Button variant={deploymentMode === 'template' ? 'default' : 'outline'} size="sm" onclick={() => (deploymentMode = 'template')} class="flex h-auto flex-col p-3">
<Upload class="mb-1 size-4" />
<span class="text-xs">Use Template</span>
</Button>
- <Button
- variant={deploymentMode === 'existing' ? 'default' : 'outline'}
- size="sm"
- onclick={() => (deploymentMode = 'existing')}
- class="flex h-auto flex-col p-3"
- disabled
- >
+ <Button variant={deploymentMode === 'existing' ? 'default' : 'outline'} size="sm" onclick={() => (deploymentMode = 'existing')} class="flex h-auto flex-col p-3" disabled>
<FileText class="mb-1 size-4" />
<span class="text-xs">Existing Stack</span>
</Button>
@@ -395,10 +327,7 @@ volumes:
<Label>Choose a template</Label>
<div class="grid gap-2">
{#each templates as template}
- <button
- class="hover:border-primary/50 rounded-lg border p-3 text-left transition-colors"
- onclick={() => useTemplate(template)}
- >
+ <button class="hover:border-primary/50 rounded-lg border p-3 text-left transition-colors" onclick={() => useTemplate(template)}>
<div class="text-sm font-medium">{template.name}</div>
<div class="text-muted-foreground text-xs">{template.description}</div>
</button>
@@ -410,37 +339,20 @@ volumes:
<!-- Stack Name -->
<div class="space-y-2">
<Label for="stackName">Stack Name</Label>
- <Input
- id="stackName"
- bind:value={stackName}
- placeholder="my-awesome-app"
- disabled={deploying}
- />
+ <Input id="stackName" bind:value={stackName} placeholder="my-awesome-app" disabled={deploying} />
</div>
{#if deploymentMode === 'compose'}
<!-- Compose Content -->
<div class="space-y-2">
<Label for="compose">Docker Compose Content</Label>
- <Textarea
- id="compose"
- bind:value={composeContent}
- placeholder="version: '3.8'&#10;services:&#10; web:&#10; image: nginx:alpine&#10; ports:&#10; - '80:80'"
- class="min-h-[200px] font-mono text-sm"
- disabled={deploying}
- />
+ <Textarea id="compose" bind:value={composeContent} placeholder="version: '3.8'&#10;services:&#10; web:&#10; image: nginx:alpine&#10; ports:&#10; - '80:80'" class="min-h-[200px] font-mono text-sm" disabled={deploying} />
</div>
<!-- Environment Variables (Optional) -->
<div class="space-y-2">
<Label for="env">Environment Variables (Optional)</Label>
- <Textarea
- id="env"
- bind:value={envContent}
- placeholder="DATABASE_URL=postgres://user:pass@db:5432/myapp&#10;REDIS_URL=redis://redis:6379"
- class="min-h-[80px] font-mono text-sm"
- disabled={deploying}
- />
+ <Textarea id="env" bind:value={envContent} placeholder="DATABASE_URL=postgres://user:pass@db:5432/myapp&#10;REDIS_URL=redis://redis:6379" class="min-h-[80px] font-mono text-sm" disabled={deploying} />
</div>
{/if}
diff --git a/frontend/src/lib/components/maturity-item.svelte b/frontend/src/lib/components/maturity-item.svelte
index 17e91c930..f85227e94 100644
--- a/frontend/src/lib/components/maturity-item.svelte
+++ b/frontend/src/lib/components/maturity-item.svelte
@@ -1,17 +1,6 @@
<script lang="ts">
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
- import {
- CircleCheck,
- CircleFadingArrowUp,
- CircleArrowUp,
- Loader2,
- Clock,
- Package,
- Calendar,
- AlertTriangle,
- RefreshCw,
- ArrowRight
- } from '@lucide/svelte';
+ import { CircleCheck, CircleFadingArrowUp, CircleArrowUp, Loader2, Clock, Package, Calendar, AlertTriangle, RefreshCw, ArrowRight } from '@lucide/svelte';
import ImageMaturityAPIService from '$lib/services/api/image-maturity-api-service';
import { toast } from 'svelte-sonner';
import { invalidateAll } from '$app/navigation';
@@ -21,7 +10,7 @@
status: string;
version?: string;
date?: string;
- latestVersion?: string; // Add this property
+ latestVersion?: string;
}
interface Props {
@@ -152,9 +141,7 @@
return {
level: 'Optional',
color: 'text-yellow-500',
- description: maturity.latestVersion
- ? `${maturity.latestVersion} available, but not yet matured`
- : 'Recent update, may be unstable'
+ description: maturity.latestVersion ? `${maturity.latestVersion} available, but not yet matured` : 'Recent update, may be unstable'
};
}
@@ -169,62 +156,29 @@
<Tooltip.Trigger>
<span class="mr-2 inline-flex size-4 items-center justify-center align-middle">
{#if !maturity.updatesAvailable}
- <CircleCheck
- class="size-4 text-green-500"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- />
+ <CircleCheck class="size-4 text-green-500" fill="none" stroke="currentColor" strokeWidth="2" />
{:else if maturity.status === 'Not Matured'}
- <CircleFadingArrowUp
- class="size-4 text-yellow-500"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- />
+ <CircleFadingArrowUp class="size-4 text-yellow-500" fill="none" stroke="currentColor" stroke-width="2" />
{:else}
- <CircleArrowUp
- class="size-4 text-blue-500"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- />
+ <CircleArrowUp class="size-4 text-blue-500" fill="none" stroke="currentColor" stroke-width="2" />
{/if}
</span>
</Tooltip.Trigger>
- <Tooltip.Content
- side="right"
- class="bg-popover text-popover-foreground border-border tooltip-with-arrow maturity-tooltip relative max-w-[280px] border p-4 shadow-lg"
- align="center"
- >
+ <Tooltip.Content side="right" class="bg-popover text-popover-foreground border-border tooltip-with-arrow maturity-tooltip relative max-w-[280px] border p-4 shadow-lg" align="center">
<div class="space-y-3">
<!-- Header with icon and status -->
<div class="border-border flex items-center gap-3 border-b pb-2">
{#if !maturity.updatesAvailable}
- <div
- class="flex h-8 w-8 items-center justify-center rounded-full border border-green-500/20 bg-green-500/10"
- >
- <CircleCheck
- class="size-5 text-green-500"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- />
+ <div class="flex h-8 w-8 items-center justify-center rounded-full border border-green-500/20 bg-green-500/10">
+ <CircleCheck class="size-5 text-green-500" fill="none" stroke="currentColor" strokeWidth="2" />
</div>
<div>
<div class="text-sm font-semibold">Up to Date</div>
<div class="text-muted-foreground text-xs">No updates available</div>
</div>
{:else if maturity.status === 'Not Matured'}
- <div
- class="flex h-8 w-8 items-center justify-center rounded-full border border-yellow-500/20 bg-yellow-500/10"
- >
- <CircleFadingArrowUp
- class="size-5 text-yellow-500"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- />
+ <div class="flex h-8 w-8 items-center justify-center rounded-full border border-yellow-500/20 bg-yellow-500/10">
+ <CircleFadingArrowUp class="size-5 text-yellow-500" fill="none" stroke="currentColor" stroke-width="2" />
</div>
<div>
<div class="text-sm font-semibold">Update Available</div>
@@ -234,15 +188,8 @@
</div>
</div>
{:else}
- <div
- class="flex h-8 w-8 items-center justify-center rounded-full border border-blue-500/20 bg-blue-500/10"
- >
- <CircleArrowUp
- class="size-5 text-blue-500"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- />
+ <div class="flex h-8 w-8 items-center justify-center rounded-full border border-blue-500/20 bg-blue-500/10">
+ <CircleArrowUp class="size-5 text-blue-500" fill="none" stroke="currentColor" stroke-width="2" />
</div>
<div>
<div class="text-sm font-semibold">Stable Update</div>
@@ -268,9 +215,7 @@
<ArrowRight class="size-3" />
<span>Latest</span>
</div>
- <span class="font-mono font-medium text-blue-600 dark:text-blue-400"
- >{maturity.latestVersion}</span
- >
+ <span class="font-mono font-medium text-blue-600 dark:text-blue-400">{maturity.latestVersion}</span>
</div>
{/if}
@@ -312,11 +257,7 @@
<!-- Re-check button -->
{#if canCheckMaturity}
<div class="border-border border-t pt-2">
- <button
- onclick={checkImageMaturity}
- disabled={isChecking}
- class="flex items-center gap-1.5 text-xs text-blue-600 hover:text-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-blue-400 dark:hover:text-blue-300"
- >
+ <button onclick={checkImageMaturity} disabled={isChecking} class="flex items-center gap-1.5 text-xs text-blue-600 hover:text-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-blue-400 dark:hover:text-blue-300">
{#if isChecking}
<Loader2 class="size-3 animate-spin" />
Checking...
@@ -339,11 +280,7 @@
<Loader2 class="size-4 animate-spin text-blue-400" />
</span>
</Tooltip.Trigger>
- <Tooltip.Content
- side="right"
- class="bg-popover text-popover-foreground border-border tooltip-with-arrow relative max-w-[220px] border p-3 shadow-lg"
- align="center"
- >
+ <Tooltip.Content side="right" class="bg-popover text-popover-foreground border-border tooltip-with-arrow relative max-w-[220px] border p-3 shadow-lg" align="center">
<div class="flex items-center gap-2">
<Loader2 class="size-4 animate-spin text-blue-400" />
<div>
@@ -360,37 +297,23 @@
<Tooltip.Trigger>
<span class="mr-2 inline-flex size-4 items-center justify-center">
{#if canCheckMaturity}
- <button
- onclick={checkImageMaturity}
- disabled={isChecking}
- class="group flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 transition-colors hover:border-blue-400 hover:bg-blue-50 disabled:cursor-not-allowed dark:hover:bg-blue-950"
- >
+ <button onclick={checkImageMaturity} disabled={isChecking} class="group flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 transition-colors hover:border-blue-400 hover:bg-blue-50 disabled:cursor-not-allowed dark:hover:bg-blue-950">
{#if isChecking}
<Loader2 class="h-2 w-2 animate-spin text-blue-400" />
{:else}
- <div
- class="h-1.5 w-1.5 rounded-full bg-gray-400 transition-colors group-hover:bg-blue-400"
- ></div>
+ <div class="h-1.5 w-1.5 rounded-full bg-gray-400 transition-colors group-hover:bg-blue-400"></div>
{/if}
</button>
{:else}
- <div
- class="flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 opacity-30"
- >
+ <div class="flex h-4 w-4 items-center justify-center rounded-full border-2 border-dashed border-gray-400 opacity-30">
<div class="h-1.5 w-1.5 rounded-full bg-gray-400"></div>
</div>
{/if}
</span>
</Tooltip.Trigger>
- <Tooltip.Content
- side="right"
- class="bg-popover text-popover-foreground border-border tooltip-with-arrow relative max-w-[240px] border p-3 shadow-lg"
- align="center"
- >
+ <Tooltip.Content side="right" class="bg-popover text-popover-foreground border-border tooltip-with-arrow relative max-w-[240px] border p-3 shadow-lg" align="center">
<div class="flex items-center gap-2">
- <div
- class="bg-muted border-border flex h-6 w-6 items-center justify-center rounded-full border"
- >
+ <div class="bg-muted border-border flex h-6 w-6 items-center justify-center rounded-full border">
<AlertTriangle class="text-muted-foreground size-3" />
</div>
<div>
diff --git a/frontend/src/lib/components/meter.svelte b/frontend/src/lib/components/meter.svelte
index e17a32e42..efcdd0e51 100644
--- a/frontend/src/lib/components/meter.svelte
+++ b/frontend/src/lib/components/meter.svelte
@@ -54,28 +54,8 @@
</div>
{/if}
-<div
- class={cn(
- 'bg-secondary relative w-full overflow-hidden rounded-full',
- sizeStyles[size],
- className
- )}
->
- <Meter.Root
- aria-labelledby={label ? labelId : undefined}
- aria-valuetext={valueLabel}
- {value}
- {min}
- {max}
- class="h-full w-full"
- {...restProps}
- >
- <div
- class={cn(
- 'h-full rounded-full transition-all duration-300 ease-in-out',
- variantStyles[variant]
- )}
- style="width: {percentage}%"
- ></div>
+<div class={cn('bg-secondary relative w-full overflow-hidden rounded-full', sizeStyles[size], className)}>
+ <Meter.Root aria-labelledby={label ? labelId : undefined} aria-valuetext={valueLabel} {value} {min} {max} class="h-full w-full" {...restProps}>
+ <div class={cn('h-full rounded-full transition-all duration-300 ease-in-out', variantStyles[variant])} style="width: {percentage}%"></div>
</Meter.Root>
</div>
diff --git a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
new file mode 100644
index 000000000..2b33665f4
--- /dev/null
+++ b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
@@ -0,0 +1,186 @@
+<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import { Loader2, Globe, RefreshCw, CheckCircle, AlertCircle } from '@lucide/svelte';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import { templateAPI } from '$lib/services/api';
+ import * as Alert from '$lib/components/ui/alert/index.js';
+
+ type TemplateRegistryFormProps = {
+ open: boolean;
+ onSubmit: (registry: { name: string; url: string; description?: string; enabled: boolean }) => void;
+ isLoading: boolean;
+ };
+
+ let { open = $bindable(false), onSubmit, isLoading }: TemplateRegistryFormProps = $props();
+
+ const formSchema = z.object({
+ url: z.url().min(1, 'Registry URL is required'),
+ description: z.string().default(''),
+ enabled: z.boolean().default(true)
+ });
+
+ let formData = $derived({
+ url: '',
+ description: '',
+ enabled: true
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+
+ // Validation state
+ let validationState = $state<{
+ isValidating: boolean;
+ result: {
+ valid: boolean;
+ name?: string;
+ errors: string[];
+ warnings: string[];
+ } | null;
+ }>({
+ isValidating: false,
+ result: null
+ });
+
+ // Validate registry URL
+ async function validateRegistryUrl(url: string) {
+ if (!url.trim()) {
+ validationState.result = null;
+ return;
+ }
+
+ validationState.isValidating = true;
+ try {
+ new URL(url);
+
+ const data = await templateAPI.fetchRegistry(url);
+
+ if (!data.name || !data.templates || !Array.isArray(data.templates)) {
+ throw new Error('Invalid registry format: missing required fields (name, templates)');
+ }
+
+ validationState.result = {
+ valid: true,
+ name: data.name,
+ errors: [],
+ warnings: data.templates.length === 0 ? ['Registry contains no templates'] : []
+ };
+ } catch (error) {
+ validationState.result = {
+ valid: false,
+ errors: [error instanceof Error ? error.message : 'Invalid registry URL'],
+ warnings: []
+ };
+ } finally {
+ validationState.isValidating = false;
+ }
+ }
+
+ function handleSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ console.log(validationState);
+ if (!validationState.result || !validationState.result.valid || !validationState.result.name) {
+ return;
+ }
+
+ // Include the name from the JSON validation
+ const registryData = {
+ name: validationState.result.name,
+ url: data.url,
+ description: data.description ? data.description : undefined,
+ enabled: data.enabled
+ };
+
+ onSubmit(registryData);
+ }
+
+ function handleOpenChange(newOpenState: boolean) {
+ open = newOpenState;
+ }
+
+ // Watch URL changes for validation with debounce
+ $effect(() => {
+ if ($inputs.url.value) {
+ const timeoutId = setTimeout(() => {
+ validateRegistryUrl($inputs.url.value);
+ }, 500);
+
+ return () => clearTimeout(timeoutId);
+ } else {
+ validationState.result = null;
+ }
+ });
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content class="p-6">
+ <Sheet.Header class="space-y-3 pb-6 border-b">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <Globe class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">Add Template Registry</Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">Add a remote template registry to access community templates.</Sheet.Description>
+ </div>
+ </div>
+ </Sheet.Header>
+ <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
+ <div class="space-y-1">
+ <FormInput label="Registry URL *" type="text" placeholder="https://templates.arcane.ofkm.dev/registry.json" description="URL to the registry JSON manifest" bind:input={$inputs.url} />
+
+ {#if validationState.isValidating}
+ <div class="flex items-center gap-2 text-sm text-muted-foreground">
+ <RefreshCw class="size-3 animate-spin" />
+ Validating registry...
+ </div>
+ {:else if validationState.result}
+ {#if validationState.result.valid}
+ <div class="flex items-center gap-2 text-sm text-green-600">
+ <CheckCircle class="size-3" />
+ Valid registry found: <strong>{validationState.result.name}</strong>
+ </div>
+ {:else}
+ <div class="flex items-center gap-2 text-sm text-red-600">
+ <AlertCircle class="size-3" />
+ {validationState.result.errors[0]}
+ </div>
+ {/if}
+ {/if}
+ </div>
+
+ <FormInput label="Description" type="text" placeholder="A collection of useful Docker Compose templates" description="Optional description for this registry" bind:input={$inputs.description} />
+
+ <SwitchWithLabel id="enabledSwitch" label="Enable Registry" description="Enable this registry to fetch templates" bind:checked={$inputs.enabled.value} />
+
+ {#if validationState.result && validationState.result.warnings.length > 0}
+ <Alert.Root class="border-yellow-200 bg-yellow-50 dark:border-yellow-800 dark:bg-yellow-950">
+ <AlertCircle class="size-4" />
+ <Alert.Title>Warnings</Alert.Title>
+ <Alert.Description>
+ <ul class="list-inside list-disc space-y-1">
+ {#each validationState.result.warnings as warning}
+ <li class="text-sm">{warning}</li>
+ {/each}
+ </ul>
+ </Alert.Description>
+ </Alert.Root>
+ {/if}
+
+ <Sheet.Footer class="flex flex-row gap-2">
+ <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Loader2 class="mr-2 size-4 animate-spin" />
+ {/if}
+ Add Registry
+ </Button>
+ </Sheet.Footer>
+ </form>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/lib/components/sheets/container-registry-sheet.svelte b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
new file mode 100644
index 000000000..f2a2fd506
--- /dev/null
+++ b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
@@ -0,0 +1,94 @@
+<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import { Loader2, PackagePlusIcon } from '@lucide/svelte';
+ import type { ContainerRegistry } from '$lib/models/container-registry';
+ import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/dto/container-registry-dto';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+
+ type ContainerRegistryFormProps = {
+ open: boolean;
+ registryToEdit: ContainerRegistry | null;
+ onSubmit: (detail: { registry: ContainerRegistryCreateDto | ContainerRegistryUpdateDto; isEditMode: boolean }) => void;
+ isLoading: boolean;
+ };
+
+ let { open = $bindable(false), registryToEdit = $bindable(), onSubmit, isLoading }: ContainerRegistryFormProps = $props();
+
+ let isEditMode = $derived(!!registryToEdit);
+
+ const formSchema = z.object({
+ url: z.string().min(1, 'Registry URL is required'),
+ username: z.string().min(1, 'Username is required'),
+ token: z.string().optional(),
+ description: z.string().optional(),
+ insecure: z.boolean().default(false),
+ enabled: z.boolean().default(true)
+ });
+
+ let formData = $derived({
+ url: registryToEdit?.url || '',
+ username: registryToEdit?.username || '',
+ token: '',
+ description: registryToEdit?.description || '',
+ insecure: registryToEdit?.insecure ?? false,
+ enabled: registryToEdit?.enabled ?? true
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+
+ function handleSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ onSubmit({ registry: data, isEditMode });
+ }
+
+ function handleOpenChange(newOpenState: boolean) {
+ open = newOpenState;
+ if (!newOpenState) {
+ registryToEdit = null;
+ }
+ }
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content class="p-6">
+ <Sheet.Header class="space-y-3 pb-6 border-b">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <PackagePlusIcon class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">
+ {isEditMode ? 'Edit' : 'Add'} Container Registry
+ </Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">
+ {isEditMode ? 'Update the details for this container registry.' : 'Enter the details for the new container registry.'}
+ </Sheet.Description>
+ </div>
+ </div>
+ </Sheet.Header>
+ <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
+ <FormInput label="Registry URL *" type="text" placeholder="e.g., docker.io, ghcr.io, gcr.io, quay.io" description="Leave empty or use 'docker.io' for Docker Hub" bind:input={$inputs.url} />
+ <FormInput label="Username *" type="text" description="Your registry username" bind:input={$inputs.username} />
+ <FormInput label="Token *" type="password" placeholder={isEditMode ? 'Leave empty to keep current token' : 'Your registry password or token'} description="Use a Personal Access Token or your password if the registry supports it. " bind:input={$inputs.token} />
+ <FormInput label="Description" type="text" placeholder="Optional description for this registry" bind:input={$inputs.description} />
+ <SwitchWithLabel id="isEnabledSwitch" label="Enabled" description="Enable this registry for authentication" bind:checked={$inputs.enabled.value} />
+ <SwitchWithLabel id="insecureSwitch" label="Allow Insecure Connection" description="Allow HTTP connections" bind:checked={$inputs.insecure.value} />
+
+ <Sheet.Footer class="flex flex-row gap-2">
+ <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Loader2 class="mr-2 size-4 animate-spin" />
+ {/if}
+ {isEditMode ? 'Save Changes' : 'Add Registry'}
+ </Button>
+ </Sheet.Footer>
+ </form>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/lib/components/sheets/create-container-sheet.svelte b/frontend/src/lib/components/sheets/create-container-sheet.svelte
new file mode 100644
index 000000000..d98f148de
--- /dev/null
+++ b/frontend/src/lib/components/sheets/create-container-sheet.svelte
@@ -0,0 +1,606 @@
+<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
+ import * as Tabs from '$lib/components/ui/tabs/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import { Checkbox } from '$lib/components/ui/checkbox/index.js';
+ import { Label } from '$lib/components/ui/label/index.js';
+ import { Input } from '$lib/components/ui/input/index.js';
+ import { Textarea } from '$lib/components/ui/textarea/index.js';
+ import { Loader2, Container, X, Plus } from '@lucide/svelte';
+ import type { ContainerCreateOptions } from 'dockerode';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import SelectWithLabel from '../form/select-with-label.svelte';
+
+ type CreateContainerFormProps = {
+ open: boolean;
+ onSubmit: (data: ContainerCreateOptions) => void;
+ isLoading: boolean;
+ availableImages?: string[];
+ availableNetworks?: string[];
+ availableVolumes?: string[];
+ };
+
+ let { open = $bindable(false), onSubmit, isLoading, availableImages = [], availableNetworks = [], availableVolumes = [] }: CreateContainerFormProps = $props();
+
+ const restartPolicies = [
+ { value: 'no', label: 'No' },
+ { value: 'always', label: 'Always' },
+ { value: 'unless-stopped', label: 'Unless Stopped' },
+ { value: 'on-failure', label: 'On Failure' }
+ ];
+
+ const formSchema = z.object({
+ containerName: z.string().min(1, 'Container name is required'),
+ image: z.string().min(1, 'Image is required'),
+ command: z.string().optional().default(''),
+ workingDir: z.string().optional().default(''),
+ user: z.string().optional().default(''),
+ hostname: z.string().optional().default(''),
+ domainname: z.string().optional().default(''),
+ attachStdout: z.boolean().default(true),
+ attachStderr: z.boolean().default(true),
+ attachStdin: z.boolean().default(false),
+ tty: z.boolean().default(false),
+ openStdin: z.boolean().default(false),
+ stdinOnce: z.boolean().default(false),
+ networkDisabled: z.boolean().default(false),
+ publishAllPorts: z.boolean().default(false),
+ privileged: z.boolean().default(false),
+ readonlyRootfs: z.boolean().default(false),
+ autoRemove: z.boolean().default(false),
+ restartPolicy: z.string().default('no'),
+ restartMaxRetries: z.number().min(0).optional().default(0),
+ environmentVars: z.string().optional().default(''),
+ labels: z.string().optional().default(''),
+ exposedPorts: z.string().optional().default(''),
+ portBindings: z.string().optional().default(''),
+ volumes: z.string().optional().default('')
+ });
+
+ let formData = $derived({
+ containerName: '',
+ image: '',
+ command: '',
+ workingDir: '',
+ user: '',
+ hostname: '',
+ domainname: '',
+ attachStdout: true,
+ attachStderr: true,
+ attachStdin: false,
+ tty: false,
+ openStdin: false,
+ stdinOnce: false,
+ networkDisabled: false,
+ publishAllPorts: false,
+ privileged: false,
+ readonlyRootfs: false,
+ autoRemove: false,
+ restartPolicy: 'no',
+ restartMaxRetries: 0,
+ environmentVars: '',
+ labels: '',
+ exposedPorts: '',
+ portBindings: '',
+ volumes: ''
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+
+ // Dynamic states for complex inputs
+ let envVars = $state<{ key: string; value: string }[]>([{ key: '', value: '' }]);
+ let portMappings = $state<{ container: string; host: string; protocol: string }[]>([{ container: '', host: '', protocol: 'tcp' }]);
+ let volumeMounts = $state<{ source: string; destination: string; readonly: boolean }[]>([{ source: '', destination: '', readonly: false }]);
+
+ function parseKeyValuePairs(text: string): Record<string, string> {
+ if (!text?.trim()) return {};
+
+ const result: Record<string, string> = {};
+ const lines = text.split('\n');
+
+ for (const line of lines) {
+ const trimmed = line.trim();
+ if (!trimmed || !trimmed.includes('=')) continue;
+
+ const [key, ...valueParts] = trimmed.split('=');
+ const value = valueParts.join('=');
+
+ if (key.trim()) {
+ result[key.trim()] = value.trim();
+ }
+ }
+
+ return result;
+ }
+
+ function parsePortList(text: string): Record<string, {}> {
+ if (!text?.trim()) return {};
+
+ const result: Record<string, {}> = {};
+ const ports = text
+ .split(',')
+ .map((p) => p.trim())
+ .filter(Boolean);
+
+ for (const port of ports) {
+ if (port.includes('/')) {
+ result[port] = {};
+ } else {
+ result[`${port}/tcp`] = {};
+ }
+ }
+
+ return result;
+ }
+
+ function addEnvVar() {
+ envVars = [...envVars, { key: '', value: '' }];
+ }
+
+ function removeEnvVar(index: number) {
+ envVars = envVars.filter((_, i) => i !== index);
+ }
+
+ function addPortMapping() {
+ portMappings = [...portMappings, { container: '', host: '', protocol: 'tcp' }];
+ }
+
+ function removePortMapping(index: number) {
+ portMappings = portMappings.filter((_, i) => i !== index);
+ }
+
+ function addVolumeMount() {
+ volumeMounts = [...volumeMounts, { source: '', destination: '', readonly: false }];
+ }
+
+ function removeVolumeMount(index: number) {
+ volumeMounts = volumeMounts.filter((_, i) => i !== index);
+ }
+
+ function handleSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ // Parse environment variables
+ const textEnvVars = parseKeyValuePairs(data.environmentVars || '');
+ const dynamicEnvVars: string[] = [];
+
+ envVars.forEach((env) => {
+ if (env.key.trim()) {
+ dynamicEnvVars.push(`${env.key.trim()}=${env.value.trim()}`);
+ }
+ });
+
+ Object.entries(textEnvVars).forEach(([key, value]) => {
+ dynamicEnvVars.push(`${key}=${value}`);
+ });
+
+ // Parse port bindings
+ const dynamicPortBindings: Record<string, Array<{ HostPort: string }>> = {};
+ portMappings.forEach((mapping) => {
+ if (mapping.container.trim() && mapping.host.trim()) {
+ const containerPort = `${mapping.container.trim()}/${mapping.protocol}`;
+ dynamicPortBindings[containerPort] = [{ HostPort: mapping.host.trim() }];
+ }
+ });
+
+ // Parse volume bindings
+ const dynamicBinds: string[] = [];
+ volumeMounts.forEach((mount) => {
+ if (mount.source.trim() && mount.destination.trim()) {
+ const bind = mount.readonly ? `${mount.source.trim()}:${mount.destination.trim()}:ro` : `${mount.source.trim()}:${mount.destination.trim()}`;
+ dynamicBinds.push(bind);
+ }
+ });
+
+ // Parse volume text input
+ const textVolumes =
+ data.volumes
+ ?.split('\n')
+ .map((v) => v.trim())
+ .filter(Boolean) || [];
+ const allBinds = [...dynamicBinds, ...textVolumes];
+
+ const labels = parseKeyValuePairs(data.labels || '');
+ const exposedPorts = parsePortList(data.exposedPorts || '');
+
+ const options: ContainerCreateOptions = {
+ name: data.containerName.trim(),
+ Image: data.image.trim(),
+ Cmd: data.command.trim() ? data.command.trim().split(' ') : undefined,
+ WorkingDir: data.workingDir.trim() || undefined,
+ User: data.user.trim() || undefined,
+ Hostname: data.hostname.trim() || undefined,
+ Domainname: data.domainname.trim() || undefined,
+ AttachStdout: data.attachStdout,
+ AttachStderr: data.attachStderr,
+ AttachStdin: data.attachStdin,
+ Tty: data.tty,
+ OpenStdin: data.openStdin,
+ StdinOnce: data.stdinOnce,
+ Env: dynamicEnvVars.length > 0 ? dynamicEnvVars : undefined,
+ Labels: Object.keys(labels).length > 0 ? labels : undefined,
+ ExposedPorts: Object.keys(exposedPorts).length > 0 ? exposedPorts : undefined,
+ HostConfig: {
+ Binds: allBinds.length > 0 ? allBinds : undefined,
+ PortBindings: Object.keys(dynamicPortBindings).length > 0 ? dynamicPortBindings : undefined,
+ NetworkMode: data.networkDisabled ? 'none' : undefined,
+ PublishAllPorts: data.publishAllPorts,
+ Privileged: data.privileged,
+ ReadonlyRootfs: data.readonlyRootfs,
+ AutoRemove: data.autoRemove,
+ RestartPolicy: {
+ Name: data.restartPolicy,
+ MaximumRetryCount: data.restartPolicy === 'on-failure' ? data.restartMaxRetries : undefined
+ }
+ }
+ };
+
+ onSubmit(options);
+ }
+
+ function handleOpenChange(newOpenState: boolean) {
+ open = newOpenState;
+ if (!newOpenState) {
+ // Reset form data
+ Object.keys($inputs).forEach((key) => {
+ const input = $inputs[key as keyof typeof $inputs];
+ if (typeof input.value === 'boolean') {
+ input.value = formData[key as keyof typeof formData] as boolean;
+ } else if (typeof input.value === 'number') {
+ input.value = formData[key as keyof typeof formData] as number;
+ } else {
+ input.value = formData[key as keyof typeof formData] as string;
+ }
+ });
+ envVars = [{ key: '', value: '' }];
+ portMappings = [{ container: '', host: '', protocol: 'tcp' }];
+ volumeMounts = [{ source: '', destination: '', readonly: false }];
+ }
+ }
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content side="top" class="p-5 max-h-[90vh]">
+ <div class="flex flex-col h-full">
+ <!-- Header -->
+ <div class="px-6 py-4 border-b bg-background shrink-0">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <Container class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">Create New Container</Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">Configure and create a new Docker container.</Sheet.Description>
+ </div>
+ </div>
+ </div>
+
+ <!-- Content with Tabs -->
+ <div class="flex-1">
+ <Tabs.Root value="basic" class="flex flex-col h-full">
+ <Tabs.List class="grid w-full grid-cols-6 border-b bg-muted/30 shrink-0">
+ <Tabs.Trigger value="basic" class="py-3">Basic</Tabs.Trigger>
+ <Tabs.Trigger value="environment" class="py-3">Environment</Tabs.Trigger>
+ <Tabs.Trigger value="ports" class="py-3">Ports</Tabs.Trigger>
+ <Tabs.Trigger value="volumes" class="py-3">Volumes</Tabs.Trigger>
+ <Tabs.Trigger value="network" class="py-3">Network & Security</Tabs.Trigger>
+ <Tabs.Trigger value="advanced" class="py-3">Advanced</Tabs.Trigger>
+ </Tabs.List>
+
+ <div class="flex-1 overflow-y-auto">
+ <form onsubmit={preventDefault(handleSubmit)} class="h-full flex flex-col">
+ <div class="flex-1">
+ <!-- Basic Tab -->
+ <Tabs.Content value="basic" class="p-6 space-y-8 mt-0">
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+ <div class="space-y-3">
+ <Label for="container-name" class="text-sm font-medium">Container Name *</Label>
+ <Input id="container-name" type="text" placeholder="e.g., my-app-container" disabled={isLoading} bind:value={$inputs.containerName.value} class={$inputs.containerName.error ? 'border-destructive' : ''} />
+ {#if $inputs.containerName.error}
+ <p class="text-xs text-destructive mt-1">{$inputs.containerName.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Unique name for the container</p>
+ </div>
+
+ <div class="space-y-3">
+ <Label for="image" class="text-sm font-medium">Image *</Label>
+ <Input id="image" type="text" placeholder="e.g., nginx:latest" disabled={isLoading} bind:value={$inputs.image.value} class={$inputs.image.error ? 'border-destructive' : ''} />
+ {#if $inputs.image.error}
+ <p class="text-xs text-destructive mt-1">{$inputs.image.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Docker image to use for the container</p>
+ </div>
+ </div>
+
+ <div class="space-y-3">
+ <FormInput label="Command" type="text" placeholder="e.g., /bin/bash -c 'echo hello'" description="Command to run in the container" disabled={isLoading} bind:input={$inputs.command} />
+ </div>
+
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
+ <div class="space-y-3">
+ <FormInput label="Working Directory" type="text" placeholder="/app" description="Working directory inside the container" disabled={isLoading} bind:input={$inputs.workingDir} />
+ </div>
+
+ <div class="space-y-3">
+ <FormInput label="User" type="text" placeholder="1000:1000" description="User to run the container as" disabled={isLoading} bind:input={$inputs.user} />
+ </div>
+
+ <div class="space-y-3">
+ <FormInput label="Hostname" type="text" placeholder="my-container" disabled={isLoading} bind:input={$inputs.hostname} />
+ </div>
+
+ <div class="space-y-3">
+ <FormInput label="Domain Name" type="text" placeholder="example.com" disabled={isLoading} bind:input={$inputs.domainname} />
+ </div>
+ </div>
+
+ <div class="border rounded-lg p-6 space-y-4">
+ <h4 class="text-sm font-semibold">I/O Settings</h4>
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
+ <div class="flex items-center space-x-2">
+ <Checkbox id="attach-stdout" bind:checked={$inputs.attachStdout.value} disabled={isLoading} />
+ <Label for="attach-stdout" class="text-sm font-normal">Attach Stdout</Label>
+ </div>
+ <div class="flex items-center space-x-2">
+ <Checkbox id="attach-stderr" bind:checked={$inputs.attachStderr.value} disabled={isLoading} />
+ <Label for="attach-stderr" class="text-sm font-normal">Attach Stderr</Label>
+ </div>
+ <div class="flex items-center space-x-2">
+ <Checkbox id="attach-stdin" bind:checked={$inputs.attachStdin.value} disabled={isLoading} />
+ <Label for="attach-stdin" class="text-sm font-normal">Attach Stdin</Label>
+ </div>
+ <div class="flex items-center space-x-2">
+ <Checkbox id="tty" bind:checked={$inputs.tty.value} disabled={isLoading} />
+ <Label for="tty" class="text-sm font-normal">Allocate TTY</Label>
+ </div>
+ <div class="flex items-center space-x-2">
+ <Checkbox id="open-stdin" bind:checked={$inputs.openStdin.value} disabled={isLoading} />
+ <Label for="open-stdin" class="text-sm font-normal">Open Stdin</Label>
+ </div>
+ <div class="flex items-center space-x-2">
+ <Checkbox id="stdin-once" bind:checked={$inputs.stdinOnce.value} disabled={isLoading} />
+ <Label for="stdin-once" class="text-sm font-normal">Stdin Once</Label>
+ </div>
+ </div>
+ </div>
+ </Tabs.Content>
+
+ <!-- Environment Tab -->
+ <Tabs.Content value="environment" class="p-6 space-y-8 mt-0">
+ <div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
+ <div class="space-y-6">
+ <div>
+ <h3 class="text-lg font-semibold mb-4">Dynamic Environment Variables</h3>
+ <div class="space-y-3">
+ {#each envVars as env, index (index)}
+ <div class="flex items-center gap-3">
+ <Input type="text" placeholder="KEY" bind:value={env.key} disabled={isLoading} class="flex-1" />
+ <span class="text-muted-foreground font-mono">=</span>
+ <Input type="text" placeholder="value" bind:value={env.value} disabled={isLoading} class="flex-1" />
+ <Button type="button" variant="ghost" size="icon" onclick={() => removeEnvVar(index)} disabled={isLoading || envVars.length <= 1} class="text-destructive hover:text-destructive shrink-0">
+ <X class="size-4" />
+ </Button>
+ </div>
+ {/each}
+ <Button type="button" variant="outline" size="sm" onclick={addEnvVar} disabled={isLoading} class="w-full">
+ <Plus class="size-4 mr-2" />
+ Add Environment Variable
+ </Button>
+ </div>
+ </div>
+ </div>
+
+ <div class="space-y-6">
+ <div>
+ <h3 class="text-lg font-semibold mb-4">Text Format Environment Variables</h3>
+ <div class="space-y-3">
+ <Textarea placeholder="NODE_ENV=production&#10;PORT=3000&#10;DEBUG=true" disabled={isLoading} rows={12} bind:value={$inputs.environmentVars.value} class={$inputs.environmentVars.error ? 'border-destructive' : ''} />
+ {#if $inputs.environmentVars.error}
+ <p class="text-xs text-destructive">{$inputs.environmentVars.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Enter environment variables as KEY=value pairs, one per line</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Tabs.Content>
+
+ <!-- Ports Tab -->
+ <Tabs.Content value="ports" class="p-6 space-y-8 mt-0">
+ <div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
+ <div class="space-y-6">
+ <div>
+ <h3 class="text-lg font-semibold mb-4">Port Mappings</h3>
+ <div class="space-y-3">
+ {#each portMappings as mapping, index (index)}
+ <div class="flex items-center gap-3">
+ <div class="flex items-center gap-2 flex-1">
+ <div class="text-sm text-muted-foreground whitespace-nowrap min-w-12">Host:</div>
+ <Input type="text" placeholder="8080" bind:value={mapping.host} disabled={isLoading} class="flex-1" />
+ </div>
+ <span class="text-muted-foreground">→</span>
+ <div class="flex items-center gap-2 flex-1">
+ <div class="text-sm text-muted-foreground whitespace-nowrap min-w-20">Container:</div>
+ <Input type="text" placeholder="80" bind:value={mapping.container} disabled={isLoading} class="flex-1" />
+ </div>
+ <select bind:value={mapping.protocol} disabled={isLoading} class="px-3 py-2 border rounded-md text-sm min-w-16">
+ <option value="tcp">TCP</option>
+ <option value="udp">UDP</option>
+ </select>
+ <Button type="button" variant="ghost" size="icon" onclick={() => removePortMapping(index)} disabled={isLoading || portMappings.length <= 1} class="text-destructive hover:text-destructive shrink-0">
+ <X class="size-4" />
+ </Button>
+ </div>
+ {/each}
+ <Button type="button" variant="outline" size="sm" onclick={addPortMapping} disabled={isLoading} class="w-full">
+ <Plus class="size-4 mr-2" />
+ Add Port Mapping
+ </Button>
+ </div>
+ </div>
+ </div>
+
+ <div class="space-y-6">
+ <div>
+ <h3 class="text-lg font-semibold mb-4">Port Configuration</h3>
+ <div class="space-y-4">
+ <FormInput label="Exposed Ports" type="text" placeholder="80,443,8080/tcp" description="Comma-separated list of ports to expose" disabled={isLoading} bind:input={$inputs.exposedPorts} />
+
+ <div class="flex items-center space-x-2 pt-2">
+ <Checkbox id="publish-all" bind:checked={$inputs.publishAllPorts.value} disabled={isLoading} />
+ <Label for="publish-all" class="text-sm font-normal">Publish All Ports</Label>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Tabs.Content>
+
+ <!-- Volumes Tab -->
+ <Tabs.Content value="volumes" class="p-6 space-y-8 mt-0">
+ <div class="grid grid-cols-1 xl:grid-cols-2 gap-8">
+ <div class="space-y-6">
+ <div>
+ <h3 class="text-lg font-semibold mb-4">Volume Mounts</h3>
+ <div class="space-y-3">
+ {#each volumeMounts as mount, index (index)}
+ <div class="space-y-2">
+ <div class="flex items-center gap-3">
+ <Input type="text" placeholder="Source path or volume name" bind:value={mount.source} disabled={isLoading} class="flex-1" />
+ <span class="text-muted-foreground">:</span>
+ <Input type="text" placeholder="Container path" bind:value={mount.destination} disabled={isLoading} class="flex-1" />
+ <Button type="button" variant="ghost" size="icon" onclick={() => removeVolumeMount(index)} disabled={isLoading || volumeMounts.length <= 1} class="text-destructive hover:text-destructive shrink-0">
+ <X class="size-4" />
+ </Button>
+ </div>
+ <div class="flex items-center space-x-2 pl-3">
+ <Checkbox bind:checked={mount.readonly} disabled={isLoading} />
+ <Label class="text-sm font-normal">Read Only</Label>
+ </div>
+ </div>
+ {/each}
+ <Button type="button" variant="outline" size="sm" onclick={addVolumeMount} disabled={isLoading} class="w-full">
+ <Plus class="size-4 mr-2" />
+ Add Volume Mount
+ </Button>
+ </div>
+ </div>
+ </div>
+
+ <div class="space-y-6">
+ <div>
+ <h3 class="text-lg font-semibold mb-4">Text Format Volume Binds</h3>
+ <div class="space-y-3">
+ <Textarea placeholder="/host/path:/container/path&#10;/host/path2:/container/path2:ro&#10;myvolume:/app/data" disabled={isLoading} rows={12} bind:value={$inputs.volumes.value} class={$inputs.volumes.error ? 'border-destructive' : ''} />
+ {#if $inputs.volumes.error}
+ <p class="text-xs text-destructive">{$inputs.volumes.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Enter volume binds as source:destination[:options], one per line</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Tabs.Content>
+
+ <!-- Network & Security Tab -->
+ <Tabs.Content value="network" class="p-6 space-y-8 mt-0">
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
+ <div class="space-y-6">
+ <div class="border rounded-lg p-6">
+ <h3 class="text-lg font-semibold mb-4">Network Settings</h3>
+ <div class="space-y-4">
+ <div class="flex items-center space-x-3">
+ <Checkbox id="network-disabled" bind:checked={$inputs.networkDisabled.value} disabled={isLoading} />
+ <Label for="network-disabled" class="text-sm font-normal">Disable Network</Label>
+ </div>
+ <div class="flex items-center space-x-3">
+ <Checkbox id="publish-all-ports-net" bind:checked={$inputs.publishAllPorts.value} disabled={isLoading} />
+ <Label for="publish-all-ports-net" class="text-sm font-normal">Publish All Ports</Label>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="space-y-6">
+ <div class="border rounded-lg p-6">
+ <h3 class="text-lg font-semibold mb-4">Security Settings</h3>
+ <div class="space-y-4">
+ <div class="flex items-center space-x-3">
+ <Checkbox id="privileged" bind:checked={$inputs.privileged.value} disabled={isLoading} />
+ <Label for="privileged" class="text-sm font-normal">Privileged</Label>
+ </div>
+ <div class="flex items-center space-x-3">
+ <Checkbox id="readonly-rootfs" bind:checked={$inputs.readonlyRootfs.value} disabled={isLoading} />
+ <Label for="readonly-rootfs" class="text-sm font-normal">Read-only Root Filesystem</Label>
+ </div>
+ <div class="flex items-center space-x-3">
+ <Checkbox id="auto-remove" bind:checked={$inputs.autoRemove.value} disabled={isLoading} />
+ <Label for="auto-remove" class="text-sm font-normal">Auto Remove</Label>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Tabs.Content>
+
+ <!-- Advanced Tab -->
+ <Tabs.Content value="advanced" class="p-6 space-y-8 mt-0">
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
+ <div class="space-y-6">
+ <div class="border rounded-lg p-6">
+ <h3 class="text-lg font-semibold mb-4">Restart Policy</h3>
+ <div class="space-y-4">
+ <SelectWithLabel id="restart-policy" bind:value={$inputs.restartPolicy.value} label="Restart Policy" description="Container restart behavior" options={restartPolicies} placeholder="Select restart policy" />
+
+ {#if $inputs.restartPolicy.value === 'on-failure'}
+ <div class="space-y-3">
+ <Label for="max-retries" class="text-sm font-medium">Maximum Retry Count</Label>
+ <Input id="max-retries" type="number" min="0" placeholder="5" disabled={isLoading} bind:value={$inputs.restartMaxRetries.value} />
+ <p class="text-xs text-muted-foreground">Maximum number of restart attempts</p>
+ </div>
+ {/if}
+ </div>
+ </div>
+ </div>
+
+ <div class="space-y-6">
+ <div class="border rounded-lg p-6">
+ <h3 class="text-lg font-semibold mb-4">Labels</h3>
+ <div class="space-y-3">
+ <Textarea placeholder="com.example.description=My application&#10;com.example.version=1.0.0&#10;[email protected]" disabled={isLoading} rows={8} bind:value={$inputs.labels.value} class={$inputs.labels.error ? 'border-destructive' : ''} />
+ {#if $inputs.labels.error}
+ <p class="text-xs text-destructive">{$inputs.labels.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Enter metadata labels as key=value pairs, one per line</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Tabs.Content>
+ </div>
+
+ <!-- Footer -->
+ <div class="border-t p-6 bg-background shrink-0">
+ <div class="flex flex-row gap-3 justify-end">
+ <Button type="button" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" disabled={isLoading}>
+ {#if isLoading}
+ <Loader2 class="mr-2 size-4 animate-spin" />
+ Creating...
+ {:else}
+ <Container class="mr-2 size-4" />
+ Create Container
+ {/if}
+ </Button>
+ </div>
+ </div>
+ </form>
+ </div>
+ </Tabs.Root>
+ </div>
+ </div>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/lib/components/sheets/create-network-sheet.svelte b/frontend/src/lib/components/sheets/create-network-sheet.svelte
new file mode 100644
index 000000000..afd990eca
--- /dev/null
+++ b/frontend/src/lib/components/sheets/create-network-sheet.svelte
@@ -0,0 +1,270 @@
+<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import * as Accordion from '$lib/components/ui/accordion/index.js';
+ import { Checkbox } from '$lib/components/ui/checkbox/index.js';
+ import { Label } from '$lib/components/ui/label/index.js';
+ import { Input } from '$lib/components/ui/input/index.js';
+ import { Textarea } from '$lib/components/ui/textarea/index.js';
+ import { Loader2, Network, X } from '@lucide/svelte';
+ import type { NetworkCreateOptions } from 'dockerode';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import SelectWithLabel from '../form/select-with-label.svelte';
+
+ type CreateNetworkFormProps = {
+ open: boolean;
+ onSubmit: (data: NetworkCreateOptions) => void;
+ isLoading: boolean;
+ };
+
+ let { open = $bindable(false), onSubmit, isLoading }: CreateNetworkFormProps = $props();
+
+ const drivers = [
+ { value: 'bridge', label: 'Bridge' },
+ { value: 'overlay', label: 'Overlay' },
+ { value: 'macvlan', label: 'Macvlan' },
+ { value: 'ipvlan', label: 'IPvlan' },
+ { value: 'none', label: 'None' }
+ ];
+
+ const formSchema = z.object({
+ networkName: z.string().min(1, 'Network name is required'),
+ networkDriver: z.string().min(1, 'Driver is required'),
+ checkDuplicate: z.boolean().default(true),
+ internal: z.boolean().default(false),
+ networkLabels: z.string().optional().default(''),
+ enableIpam: z.boolean().default(false),
+ subnet: z.string().optional().default(''),
+ gateway: z.string().optional().default('')
+ });
+
+ let formData = $derived({
+ networkName: '',
+ networkDriver: 'bridge',
+ checkDuplicate: true,
+ internal: false,
+ networkLabels: '',
+ enableIpam: false,
+ subnet: '',
+ gateway: ''
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+
+ // Dynamic labels state for the key-value pairs
+ let labels = $state<{ key: string; value: string }[]>([{ key: '', value: '' }]);
+
+ function parseKeyValuePairs(text: string): Record<string, string> {
+ if (!text?.trim()) return {};
+
+ const result: Record<string, string> = {};
+ const lines = text.split('\n');
+
+ for (const line of lines) {
+ const trimmed = line.trim();
+ if (!trimmed || !trimmed.includes('=')) continue;
+
+ const [key, ...valueParts] = trimmed.split('=');
+ const value = valueParts.join('=');
+
+ if (key.trim()) {
+ result[key.trim()] = value.trim();
+ }
+ }
+
+ return result;
+ }
+
+ function addLabel() {
+ labels = [...labels, { key: '', value: '' }];
+ }
+
+ function removeLabel(index: number) {
+ labels = labels.filter((_, i) => i !== index);
+ }
+
+ function handleSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ // Combine textarea labels with dynamic labels
+ const textareaLabels = parseKeyValuePairs(data.networkLabels || '');
+ const dynamicLabels: Record<string, string> = {};
+
+ labels.forEach((label) => {
+ if (label.key.trim()) {
+ dynamicLabels[label.key.trim()] = label.value.trim();
+ }
+ });
+
+ const finalLabels = { ...textareaLabels, ...dynamicLabels };
+
+ const options: NetworkCreateOptions = {
+ Name: data.networkName.trim(),
+ Driver: data.networkDriver,
+ CheckDuplicate: data.checkDuplicate,
+ Internal: data.internal,
+ Labels: Object.keys(finalLabels).length > 0 ? finalLabels : undefined
+ };
+
+ // Add IPAM configuration if enabled
+ if (data.enableIpam && (data.subnet?.trim() || data.gateway?.trim())) {
+ const ipamConfig: { Subnet?: string; Gateway?: string } = {};
+
+ if (data.subnet?.trim()) {
+ ipamConfig.Subnet = data.subnet.trim();
+ }
+ if (data.gateway?.trim()) {
+ ipamConfig.Gateway = data.gateway.trim();
+ }
+
+ if (Object.keys(ipamConfig).length > 0) {
+ options.IPAM = {
+ Driver: 'default',
+ Config: [ipamConfig]
+ };
+ }
+ }
+
+ onSubmit(options);
+ }
+
+ function handleOpenChange(newOpenState: boolean) {
+ open = newOpenState;
+ if (!newOpenState) {
+ // Reset form data
+ $inputs.networkName.value = '';
+ $inputs.networkDriver.value = 'bridge';
+ $inputs.checkDuplicate.value = true;
+ $inputs.internal.value = false;
+ $inputs.networkLabels.value = '';
+ $inputs.enableIpam.value = false;
+ $inputs.subnet.value = '';
+ $inputs.gateway.value = '';
+ labels = [{ key: '', value: '' }];
+ }
+ }
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content class="p-6">
+ <Sheet.Header class="space-y-3 pb-6 border-b">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <Network class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">Create New Network</Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">Configure and create a new Docker network.</Sheet.Description>
+ </div>
+ </div>
+ </Sheet.Header>
+
+ <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
+ <div class="space-y-2">
+ <Label for="network-name" class="text-sm font-medium">Network Name *</Label>
+ <Input id="network-name" type="text" placeholder="e.g., my-app-network" disabled={isLoading} bind:value={$inputs.networkName.value} class={$inputs.networkName.error ? 'border-destructive' : ''} />
+ {#if $inputs.networkName.error}
+ <p class="text-xs text-destructive">{$inputs.networkName.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Unique name for the network</p>
+ </div>
+
+ <SelectWithLabel id="driver-select" bind:value={$inputs.networkDriver.value} label="Network Driver" description="Choose the network driver type" options={drivers} placeholder="Select a driver" />
+
+ <div class="space-y-4">
+ <div class="flex items-center space-x-4">
+ <div class="flex items-center space-x-2">
+ <Checkbox id="check-duplicate" bind:checked={$inputs.checkDuplicate.value} disabled={isLoading} />
+ <Label for="check-duplicate" class="text-sm font-normal">Check Duplicate</Label>
+ </div>
+ <div class="flex items-center space-x-2">
+ <Checkbox id="internal" bind:checked={$inputs.internal.value} disabled={isLoading} />
+ <Label for="internal" class="text-sm font-normal">Internal Network</Label>
+ </div>
+ </div>
+ </div>
+
+ <Accordion.Root type="single" class="w-full">
+ <Accordion.Item value="labels">
+ <Accordion.Trigger class="text-sm font-medium">Labels</Accordion.Trigger>
+ <Accordion.Content class="pt-4">
+ <div class="space-y-4">
+ <div class="space-y-2">
+ <Label class="text-sm font-medium">Key-Value Labels</Label>
+ {#each labels as label, index (index)}
+ <div class="flex items-center gap-2">
+ <Input type="text" placeholder="Key" bind:value={label.key} disabled={isLoading} class="flex-1" />
+ <Input type="text" placeholder="Value" bind:value={label.value} disabled={isLoading} class="flex-1" />
+ <Button type="button" variant="ghost" size="icon" onclick={() => removeLabel(index)} disabled={isLoading || labels.length <= 1} class="text-destructive hover:text-destructive" title="Remove Label">
+ <X class="size-4" />
+ </Button>
+ </div>
+ {/each}
+ <Button type="button" variant="outline" size="sm" onclick={addLabel} disabled={isLoading}>Add Label</Button>
+ </div>
+
+ <div class="space-y-2">
+ <Label for="network-labels" class="text-sm font-medium">Additional Labels (Text Format)</Label>
+ <Textarea id="network-labels" placeholder="com.example.description=Production network&#10;com.example.department=Backend" disabled={isLoading} rows={3} bind:value={$inputs.networkLabels.value} class={$inputs.networkLabels.error ? 'border-destructive' : ''} />
+ {#if $inputs.networkLabels.error}
+ <p class="text-xs text-destructive">{$inputs.networkLabels.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Enter additional labels as key=value pairs, one per line</p>
+ </div>
+ </div>
+ </Accordion.Content>
+ </Accordion.Item>
+
+ <Accordion.Item value="ipam">
+ <Accordion.Trigger class="text-sm font-medium">IPAM Configuration</Accordion.Trigger>
+ <Accordion.Content class="pt-4">
+ <div class="space-y-4">
+ <div class="flex items-center space-x-2">
+ <Checkbox id="enable-ipam" bind:checked={$inputs.enableIpam.value} disabled={isLoading} />
+ <Label for="enable-ipam" class="text-sm font-medium">Enable IPAM Configuration</Label>
+ </div>
+
+ {#if $inputs.enableIpam.value}
+ <div class="space-y-4 pl-6 border-l-2 border-muted">
+ <div class="space-y-2">
+ <Label for="subnet" class="text-sm font-medium">Subnet</Label>
+ <Input id="subnet" type="text" placeholder="e.g., 172.20.0.0/16" disabled={isLoading} bind:value={$inputs.subnet.value} class={$inputs.subnet.error ? 'border-destructive' : ''} />
+ {#if $inputs.subnet.error}
+ <p class="text-xs text-destructive">{$inputs.subnet.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Network subnet in CIDR notation</p>
+ </div>
+
+ <div class="space-y-2">
+ <Label for="gateway" class="text-sm font-medium">Gateway</Label>
+ <Input id="gateway" type="text" placeholder="e.g., 172.20.0.1" disabled={isLoading} bind:value={$inputs.gateway.value} class={$inputs.gateway.error ? 'border-destructive' : ''} />
+ {#if $inputs.gateway.error}
+ <p class="text-xs text-destructive">{$inputs.gateway.error}</p>
+ {/if}
+ <p class="text-xs text-muted-foreground">Gateway IP address for the network</p>
+ </div>
+ </div>
+ {/if}
+ </div>
+ </Accordion.Content>
+ </Accordion.Item>
+ </Accordion.Root>
+
+ <Sheet.Footer class="flex flex-row gap-2">
+ <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Loader2 class="mr-2 size-4 animate-spin" />
+ Creating...
+ {:else}
+ <Network class="mr-2 size-4" />
+ Create Network
+ {/if}
+ </Button>
+ </Sheet.Footer>
+ </form>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/lib/components/sheets/create-volume-sheet.svelte b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
new file mode 100644
index 000000000..b204ad223
--- /dev/null
+++ b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
@@ -0,0 +1,139 @@
+<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import * as Accordion from '$lib/components/ui/accordion/index.js';
+ import { Loader2, HardDrive } from '@lucide/svelte';
+ import type { VolumeCreateOptions } from 'dockerode';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+ import SelectWithLabel from '../form/select-with-label.svelte';
+
+ type CreateVolumeFormProps = {
+ open: boolean;
+ onSubmit: (data: VolumeCreateOptions) => void;
+ isLoading: boolean;
+ };
+
+ let { open = $bindable(false), onSubmit, isLoading }: CreateVolumeFormProps = $props();
+
+ const drivers = [
+ { value: 'local', label: 'Local' },
+ { value: 'nfs', label: 'NFS' },
+ { value: 'awsElasticBlockStore', label: 'AWS EBS' },
+ { value: 'azure_disk', label: 'Azure Disk' },
+ { value: 'gcePersistentDisk', label: 'GCE Persistent Disk' }
+ ];
+
+ const formSchema = z.object({
+ volumeName: z.string().min(1, 'Volume name is required'),
+ volumeDriver: z.string().min(1, 'Driver is required'),
+ volumeOptText: z.string().optional().default(''),
+ volumeLabels: z.string().optional().default('')
+ });
+
+ let formData = $derived({
+ volumeName: '',
+ volumeDriver: 'local',
+ volumeOptText: '',
+ volumeLabels: ''
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+
+ function parseKeyValuePairs(text: string): Record<string, string> {
+ if (!text?.trim()) return {};
+
+ const result: Record<string, string> = {};
+ const lines = text.split('\n');
+
+ for (const line of lines) {
+ const trimmed = line.trim();
+ if (!trimmed || !trimmed.includes('=')) continue;
+
+ const [key, ...valueParts] = trimmed.split('=');
+ const value = valueParts.join('=');
+
+ if (key.trim()) {
+ result[key.trim()] = value.trim();
+ }
+ }
+
+ return result;
+ }
+
+ function handleSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ const driverOpts = parseKeyValuePairs(data.volumeOptText || '');
+ const labels = parseKeyValuePairs(data.volumeLabels || '');
+
+ const volumeOptions: VolumeCreateOptions = {
+ Name: data.volumeName.trim(),
+ Driver: data.volumeDriver,
+ DriverOpts: Object.keys(driverOpts).length ? driverOpts : undefined,
+ Labels: Object.keys(labels).length ? labels : undefined
+ };
+
+ onSubmit(volumeOptions);
+ }
+
+ function handleOpenChange(newOpenState: boolean) {
+ open = newOpenState;
+ if (!newOpenState) {
+ $inputs.volumeName.value = '';
+ $inputs.volumeDriver.value = 'local';
+ $inputs.volumeOptText.value = '';
+ $inputs.volumeLabels.value = '';
+ }
+ }
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content class="p-6">
+ <Sheet.Header class="space-y-3 pb-6 border-b">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <HardDrive class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">Create New Volume</Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">Enter the details for the new Docker volume.</Sheet.Description>
+ </div>
+ </div>
+ </Sheet.Header>
+
+ <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
+ <FormInput label="Volume Name *" type="text" placeholder="e.g., my-app-data" description="Unique name for the volume" disabled={isLoading} bind:input={$inputs.volumeName} />
+
+ <SelectWithLabel id="driver-select" bind:value={$inputs.volumeDriver.value} label="Volume Driver" description="Choose the storage driver for your volume" options={drivers} placeholder="Select a driver" />
+
+ <Accordion.Root type="single" class="w-full">
+ <Accordion.Item value="advanced">
+ <Accordion.Trigger class="text-sm font-medium">Advanced Settings</Accordion.Trigger>
+ <Accordion.Content class="pt-4">
+ <div class="space-y-4">
+ <FormInput label="Driver Options" type="textarea" placeholder="key=value&#10;key2=value2" description="Enter driver-specific options as key=value pairs, one per line" disabled={isLoading} rows={3} bind:input={$inputs.volumeOptText} />
+
+ <FormInput label="Labels" type="textarea" placeholder="com.example.description=Production data&#10;com.example.department=Finance" description="Enter metadata labels as key=value pairs, one per line" disabled={isLoading} rows={3} bind:input={$inputs.volumeLabels} />
+ </div>
+ </Accordion.Content>
+ </Accordion.Item>
+ </Accordion.Root>
+
+ <Sheet.Footer class="flex flex-row gap-2">
+ <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Loader2 class="mr-2 size-4 animate-spin" />
+ Creating...
+ {:else}
+ <HardDrive class="mr-2 size-4" />
+ Create Volume
+ {/if}
+ </Button>
+ </Sheet.Footer>
+ </form>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/routes/images/pull-image-dialog.svelte b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
similarity index 56%
rename from frontend/src/routes/images/pull-image-dialog.svelte
rename to frontend/src/lib/components/sheets/image-pull-sheet.svelte
index fe024e9e2..7535dfdea 100644
--- a/frontend/src/routes/images/pull-image-dialog.svelte
+++ b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
@@ -1,44 +1,36 @@
<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
import { Button } from '$lib/components/ui/button/index.js';
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import { Loader2 } from '@lucide/svelte';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import { Loader2, Download } from '@lucide/svelte';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
import { toast } from 'svelte-sonner';
- function preventDefault(handler: (event: SubmitEvent) => void) {
- return (event: SubmitEvent) => {
- event.preventDefault();
- handler(event);
- };
- }
-
- interface Props {
- open?: boolean;
+ type ImagePullFormProps = {
+ open: boolean;
onPullFinished?: (success: boolean, imageName?: string, error?: string) => void;
- }
+ };
+
+ let { open = $bindable(false), onPullFinished = () => {} }: ImagePullFormProps = $props();
- let { open = $bindable(false), onPullFinished = () => {} }: Props = $props();
+ const formSchema = z.object({
+ imageRef: z.string().min(1, 'Image name is required'),
+ tag: z.string().optional().default('latest')
+ });
- let imageRef = $state('');
- let tag = $state('latest');
+ let formData = $derived({
+ imageRef: '',
+ tag: 'latest'
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
let isPulling = $state(false);
let pullProgress = $state(0);
let pullStatusText = $state('');
let pullError = $state('');
- let layerProgress = $state<Record<string, { current: number; total: number; status: string }>>(
- {}
- );
-
- export function onClose() {
- if (isPulling) {
- toast.info('Pull operation is in progress.');
- return;
- }
- resetState();
- open = false;
- }
+ let layerProgress = $state<Record<string, { current: number; total: number; status: string }>>({});
function resetState() {
isPulling = false;
@@ -59,11 +51,6 @@
totalCurrentBytes += layer.current;
totalExpectedBytes += layer.total;
activeLayers++;
- } else if (
- layer.status &&
- (layer.status.toLowerCase().includes('pull complete') ||
- layer.status.toLowerCase().includes('already exists'))
- ) {
}
}
@@ -72,28 +59,21 @@
} else if (activeLayers > 0 && totalCurrentBytes > 0) {
pullProgress = 5;
} else if (Object.keys(layerProgress).length > 0 && activeLayers === 0) {
- const allDone = Object.values(layerProgress).every(
- (l) =>
- l.status &&
- (l.status.toLowerCase().includes('pull complete') ||
- l.status.toLowerCase().includes('already exists'))
- );
+ const allDone = Object.values(layerProgress).every((l) => l.status && (l.status.toLowerCase().includes('pull complete') || l.status.toLowerCase().includes('already exists')));
if (allDone) pullProgress = 100;
}
}
async function handleSubmit() {
- if (!imageRef.trim()) {
- pullError = 'Image name cannot be empty.';
- return;
- }
+ const data = form.validate();
+ if (!data) return;
resetState();
isPulling = true;
pullStatusText = 'Initiating pull...';
- let imageName = imageRef.trim();
- let imageTag = tag.trim() || 'latest';
+ let imageName = data.imageRef.trim();
+ let imageTag = data.tag?.trim() || 'latest';
if (imageName.includes(':')) {
const parts = imageName.split(':');
@@ -102,6 +82,7 @@
imageTag = parts[1].trim();
}
}
+
const fullImageName = `${imageName}:${imageTag}`;
pullStatusText = `Pulling ${fullImageName}...`;
@@ -115,13 +96,10 @@
});
if (!response.ok || !response.body) {
- const errorData = await response
- .json()
- .catch(() => ({ error: 'Failed to pull image. Server returned an error.' }));
- const errorMessage =
- typeof errorData.error === 'string'
- ? errorData.error
- : errorData.message || `HTTP error ${response.status}`;
+ const errorData = await response.json().catch(() => ({
+ error: 'Failed to pull image. Server returned an error.'
+ }));
+ const errorMessage = typeof errorData.error === 'string' ? errorData.error : errorData.message || `HTTP error ${response.status}`;
throw new Error(errorMessage);
}
@@ -147,10 +125,7 @@
if (data.error) {
console.error('Error in stream:', data.error);
- pullError =
- typeof data.error === 'string'
- ? data.error
- : data.error.message || 'An error occurred during pull.';
+ pullError = typeof data.error === 'string' ? data.error : data.error.message || 'An error occurred during pull.';
pullStatusText = `Error: ${pullError}`;
continue;
}
@@ -175,13 +150,7 @@
calculateOverallProgress();
if (!pullError && pullProgress < 100) {
- const allLayersCompleteOrExisting = Object.values(layerProgress).every(
- (l) =>
- l.status &&
- (l.status.toLowerCase().includes('complete') ||
- l.status.toLowerCase().includes('already exists') ||
- l.status.toLowerCase().includes('downloaded newer image'))
- );
+ const allLayersCompleteOrExisting = Object.values(layerProgress).every((l) => l.status && (l.status.toLowerCase().includes('complete') || l.status.toLowerCase().includes('already exists') || l.status.toLowerCase().includes('downloaded newer image')));
if (allLayersCompleteOrExisting && Object.keys(layerProgress).length > 0) {
pullProgress = 100;
}
@@ -194,6 +163,10 @@
pullStatusText = `Image ${fullImageName} pulled successfully.`;
toast.success(pullStatusText);
onPullFinished(true, fullImageName);
+
+ // Reset form and close sheet
+ $inputs.imageRef.value = '';
+ $inputs.tag.value = 'latest';
open = false;
} catch (error: any) {
console.error('Pull image error:', error);
@@ -206,47 +179,45 @@
isPulling = false;
}
}
-</script>
-<Dialog.Root
- bind:open
- onOpenChange={(o) => {
- if (!o && !isPulling) resetState();
- else if (!o && isPulling) open = true;
- }}
->
- <Dialog.Content class="sm:max-w-[500px]">
- <Dialog.Header data-testid="pull-docker-image-header">
- <Dialog.Title>Pull Docker Image</Dialog.Title>
- <Dialog.Description>
- Enter the image reference you want to pull from a registry.
- {#if pullError}
- <p class="text-destructive mt-2 text-sm">{pullError}</p>
- {/if}
- </Dialog.Description>
- </Dialog.Header>
+ function handleOpenChange(newOpenState: boolean) {
+ if (!newOpenState && isPulling) {
+ toast.info('Pull operation is in progress.');
+ open = true; // Keep it open
+ return;
+ }
- <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <div class="flex flex-col gap-2">
- <Label for="image-ref">Image</Label>
- <div class="flex items-center gap-2">
- <div class="flex-1">
- <Input
- id="image-ref"
- bind:value={imageRef}
- placeholder="e.g., nginx or myregistry.com/ubuntu"
- required
- disabled={isPulling}
- />
- </div>
- <div class="flex items-center">
- <span class="text-muted-foreground text-lg font-medium">:</span>
- </div>
- <div class="w-1/3">
- <Input id="image-tag" bind:value={tag} placeholder="latest" disabled={isPulling} />
- </div>
+ open = newOpenState;
+ if (!newOpenState && !isPulling) {
+ resetState();
+ $inputs.imageRef.value = '';
+ $inputs.tag.value = 'latest';
+ }
+ }
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content class="p-6">
+ <Sheet.Header class="space-y-3 pb-6 border-b">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <Download class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">Pull Docker Image</Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">
+ Enter the image reference you want to pull from a registry.
+ {#if pullError}
+ <p class="text-destructive mt-2 text-sm">{pullError}</p>
+ {/if}
+ </Sheet.Description>
</div>
</div>
+ </Sheet.Header>
+
+ <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
+ <FormInput label="Image Name *" type="text" placeholder="nginx, redis, ubuntu, etc." description="Enter the image name from Docker Hub or other registries" disabled={isPulling} bind:input={$inputs.imageRef} />
+ <FormInput label="Tag" type="text" placeholder="latest" description="Specify a tag version (defaults to 'latest')" disabled={isPulling} bind:input={$inputs.tag} />
{#if isPulling || pullStatusText}
<div class="mt-4">
@@ -256,40 +227,29 @@
<span>{Math.round(pullProgress)}%</span>
</div>
<div class="bg-secondary h-2 w-full overflow-hidden rounded-full">
- <div
- class="bg-primary h-full transition-all duration-150 ease-linear"
- style="width: {pullProgress}%"
- ></div>
+ <div class="bg-primary h-full transition-all duration-150 ease-linear" style="width: {pullProgress}%"></div>
</div>
{:else if pullStatusText && !pullError}
<p class="mt-1 text-xs text-green-600">{pullStatusText}</p>
{/if}
- {#if !isPulling && pullError}{/if}
{#if isPulling}
- <p class="text-muted-foreground mt-1 text-xs">
- This may take a while depending on the image size and your internet connection.
- </p>
+ <p class="text-muted-foreground mt-1 text-xs">This may take a while depending on the image size and your internet connection.</p>
{/if}
</div>
{/if}
- <Dialog.Footer>
- <Button variant="outline" onclick={onClose} disabled={isPulling}>Cancel</Button>
- <Button
- type="submit"
- disabled={isPulling || !imageRef.trim()}
- class="relative min-w-[100px]"
- >
+ <Sheet.Footer class="flex flex-row gap-2">
+ <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isPulling}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create flex-1" disabled={isPulling}>
{#if isPulling}
- <div class="absolute inset-0 flex items-center justify-center">
- <Loader2 class="size-4 animate-spin" />
- </div>
+ <Loader2 class="mr-2 size-4 animate-spin" />
<span class="opacity-0">Pull Image</span>
{:else}
+ <Download class="mr-2 size-4" />
Pull Image
{/if}
</Button>
- </Dialog.Footer>
+ </Sheet.Footer>
</form>
- </Dialog.Content>
-</Dialog.Root>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/lib/components/sheets/user-form-sheet.svelte b/frontend/src/lib/components/sheets/user-form-sheet.svelte
new file mode 100644
index 000000000..c530b001a
--- /dev/null
+++ b/frontend/src/lib/components/sheets/user-form-sheet.svelte
@@ -0,0 +1,108 @@
+<script lang="ts">
+ import * as Sheet from '$lib/components/ui/sheet/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
+ import { Loader2, UserPlus, Save } from '@lucide/svelte';
+ import type { User } from '$lib/types/user.type';
+ import { z } from 'zod/v4';
+ import { createForm, preventDefault } from '$lib/utils/form.utils';
+
+ type UserFormProps = {
+ open: boolean;
+ userToEdit: User | null;
+ roles: { id: string; name: string }[];
+ onSubmit: (data: { user: Partial<User> & { password?: string }; isEditMode: boolean; userId?: string }) => void;
+ isLoading: boolean;
+ allowUsernameEdit?: boolean;
+ };
+
+ let { open = $bindable(false), userToEdit = $bindable(), roles, onSubmit, isLoading, allowUsernameEdit = false }: UserFormProps = $props();
+
+ let isEditMode = $derived(!!userToEdit);
+ let canEditUsername = $derived(!isEditMode || allowUsernameEdit);
+ let SubmitIcon = $derived(isEditMode ? Save : UserPlus);
+
+ const formSchema = z.object({
+ username: z.string().min(1, 'Username is required'),
+ password: z.string().optional(),
+ displayName: z.string().optional(),
+ email: z.string().email('Invalid email format').optional().or(z.literal('')),
+ isAdmin: z.boolean().default(false)
+ });
+
+ let formData = $derived({
+ username: userToEdit?.username || '',
+ password: '',
+ displayName: userToEdit?.displayName || '',
+ email: userToEdit?.email || '',
+ isAdmin: Boolean(userToEdit?.roles?.includes('admin'))
+ });
+
+ let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
+
+ function handleSubmit() {
+ const data = form.validate();
+ if (!data) return;
+
+ const userData: Partial<User> & { password?: string } = {
+ username: data.username,
+ displayName: data.displayName,
+ email: data.email,
+ roles: [data.isAdmin ? 'admin' : 'user']
+ };
+
+ // Only include password if it's provided (for create) or if editing and password is not empty
+ if (!isEditMode || (isEditMode && data.password)) {
+ userData.password = data.password;
+ }
+
+ onSubmit({ user: userData, isEditMode, userId: userToEdit?.id });
+ }
+
+ function handleOpenChange(newOpenState: boolean) {
+ open = newOpenState;
+ if (!newOpenState) {
+ userToEdit = null;
+ }
+ }
+</script>
+
+<Sheet.Root bind:open onOpenChange={handleOpenChange}>
+ <Sheet.Content class="p-6">
+ <Sheet.Header class="space-y-3 pb-6 border-b">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-primary/10 shrink-0">
+ <SubmitIcon class="size-5 text-primary" />
+ </div>
+ <div>
+ <Sheet.Title class="text-xl font-semibold">
+ {isEditMode ? 'Edit User' : 'Create New User'}
+ </Sheet.Title>
+ <Sheet.Description class="text-sm text-muted-foreground mt-1">
+ {isEditMode ? `Update the details for ${userToEdit?.username || 'this user'}` : 'Add a new user to your system with the required permissions'}
+ </Sheet.Description>
+ </div>
+ </div>
+ </Sheet.Header>
+
+ <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-6">
+ <FormInput label="Username *" type="text" description="Unique username for the user" disabled={!canEditUsername} bind:input={$inputs.username} />
+ <FormInput label={isEditMode ? 'Password' : 'Password *'} type="password" placeholder={isEditMode ? 'Leave empty to keep current password' : 'Enter password'} description={isEditMode ? 'Leave empty to keep current password' : 'Password for the user account'} bind:input={$inputs.password} />
+ <FormInput label="Display Name" type="text" placeholder="Full name or display name" description="Optional display name for the user" bind:input={$inputs.displayName} />
+ <FormInput label="Email" type="email" placeholder="[email protected]" description="Email address for the user" bind:input={$inputs.email} />
+ <SwitchWithLabel id="isAdminSwitch" label="Administrator" description="Grant administrator privileges to this user" bind:checked={$inputs.isAdmin.value} />
+
+ <Sheet.Footer class="flex flex-row gap-2">
+ <Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Loader2 class="mr-2 size-4 animate-spin" />
+ {/if}
+ <SubmitIcon class="mr-2 size-4" />
+ {isEditMode ? 'Save Changes' : 'Create User'}
+ </Button>
+ </Sheet.Footer>
+ </form>
+ </Sheet.Content>
+</Sheet.Root>
diff --git a/frontend/src/lib/components/sidebar/sidebar-agent-switcher.svelte b/frontend/src/lib/components/sidebar/sidebar-agent-switcher.svelte
index 49e3b080b..39b348017 100644
--- a/frontend/src/lib/components/sidebar/sidebar-agent-switcher.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-agent-switcher.svelte
@@ -27,9 +27,7 @@
isLocal: true
};
- const allAgents: ExtendedAgent[] = $derived(
- hasLocalDocker ? [localDockerAgent, ...agents] : agents
- );
+ const allAgents: ExtendedAgent[] = $derived(hasLocalDocker ? [localDockerAgent, ...agents] : agents);
let activeAgent = $derived(allAgents[0]);
</script>
@@ -38,14 +36,8 @@
<DropdownMenu.Root>
<DropdownMenu.Trigger>
{#snippet child({ props })}
- <Sidebar.MenuButton
- {...props}
- size="lg"
- class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
- >
- <div
- class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
- >
+ <Sidebar.MenuButton {...props} size="lg" class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground">
+ <div class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
{#if activeAgent?.isLocal}
<ServerIcon class="size-4" />
{:else}
@@ -64,15 +56,8 @@
</Sidebar.MenuButton>
{/snippet}
</DropdownMenu.Trigger>
- <DropdownMenu.Content
- class="w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg"
- align="start"
- side={sidebar.isMobile ? 'bottom' : 'right'}
- sideOffset={4}
- >
- <DropdownMenu.Label class="text-muted-foreground text-xs"
- >Docker Instances</DropdownMenu.Label
- >
+ <DropdownMenu.Content class="w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg" align="start" side={sidebar.isMobile ? 'bottom' : 'right'} sideOffset={4}>
+ <DropdownMenu.Label class="text-muted-foreground text-xs">Docker Instances</DropdownMenu.Label>
{#each allAgents as agent, index (agent.id)}
<DropdownMenu.Item onSelect={() => (activeAgent = agent)} class="gap-2 p-2">
<div class="flex size-6 items-center justify-center rounded-md border">
diff --git a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
index 8675bb27a..e02b79251 100644
--- a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
@@ -62,18 +62,12 @@
<Collapsible.Trigger>
{#snippet child({ props })}
{@const Icon = item.icon}
- <Sidebar.MenuButton
- {...props}
- tooltipContent={item.title}
- isActive={item.isActive}
- >
+ <Sidebar.MenuButton {...props} tooltipContent={item.title} isActive={item.isActive}>
{#if item.icon}
<Icon />
{/if}
<span>{item.title}</span>
- <ChevronRightIcon
- class="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
- />
+ <ChevronRightIcon class="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
</Sidebar.MenuButton>
{/snippet}
</Collapsible.Trigger>
diff --git a/frontend/src/lib/components/sidebar/sidebar-logo.svelte b/frontend/src/lib/components/sidebar/sidebar-logo.svelte
index 5165c2721..afabda708 100644
--- a/frontend/src/lib/components/sidebar/sidebar-logo.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-logo.svelte
@@ -2,46 +2,19 @@
import type { AppVersionInformation } from '$lib/types/application-configuration';
import { cn } from '$lib/utils';
- let {
- isCollapsed,
- versionInformation
- }: { isCollapsed: boolean; versionInformation: AppVersionInformation } = $props();
+ let { isCollapsed, versionInformation }: { isCollapsed: boolean; versionInformation: AppVersionInformation } = $props();
</script>
-<div
- class={cn(
- 'border-border/30 flex h-16 items-center border-b transition-all duration-300',
- isCollapsed ? 'justify-center px-2' : 'gap-3 px-6'
- )}
->
+<div class={cn('border-border/30 flex h-16 items-center border-b transition-all duration-300', isCollapsed ? 'justify-center px-2' : 'gap-3 px-6')}>
<div class="relative flex shrink-0 items-center justify-center">
- <div
- class={cn(
- 'from-primary/20 to-primary/10 text-primary border-primary/20 flex items-center justify-center rounded-full border bg-gradient-to-br font-semibold transition-all duration-300',
- isCollapsed ? 'size-8' : 'size-10'
- )}
- >
- <img
- src="/img/arcane.svg"
- alt="Arcane"
- class={cn('drop-shadow-sm transition-all duration-300', isCollapsed ? 'size-5' : 'size-7')}
- width={isCollapsed ? '20' : '28'}
- height={isCollapsed ? '20' : '28'}
- />
+ <div class={cn('from-primary/20 to-primary/10 text-primary border-primary/20 flex items-center justify-center rounded-full border bg-gradient-to-br font-semibold transition-all duration-300', isCollapsed ? 'size-8' : 'size-10')}>
+ <img src="/img/arcane.svg" alt="Arcane" class={cn('drop-shadow-sm transition-all duration-300', isCollapsed ? 'size-5' : 'size-7')} width={isCollapsed ? '20' : '28'} height={isCollapsed ? '20' : '28'} />
</div>
- <div
- class={cn(
- 'bg-primary/10 absolute inset-0 rounded-full opacity-60 blur-xl transition-all duration-300',
- isCollapsed ? 'scale-75' : 'scale-100'
- )}
- ></div>
+ <div class={cn('bg-primary/10 absolute inset-0 rounded-full opacity-60 blur-xl transition-all duration-300', isCollapsed ? 'scale-75' : 'scale-100')}></div>
</div>
{#if !isCollapsed}
<div class="flex min-w-0 flex-col justify-center">
- <span
- class="from-foreground to-foreground/80 bg-gradient-to-r bg-clip-text text-lg leading-none font-bold tracking-tight text-transparent"
- >Arcane</span
- >
+ <span class="from-foreground to-foreground/80 bg-gradient-to-r bg-clip-text text-lg leading-none font-bold tracking-tight text-transparent">Arcane</span>
<span class="text-muted-foreground/80 text-xs font-medium">
v{versionInformation?.currentVersion}
</span>
diff --git a/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte b/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte
index 9242cf24b..9b9a6f9b2 100644
--- a/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte
@@ -24,15 +24,8 @@
<Separator.Root class="mb-3 opacity-30" />
{#if !isCollapsed}
- <div
- class="rounded-xl border border-blue-500/20 bg-gradient-to-br from-blue-500/10 to-blue-600/5 p-3 transition-all hover:scale-[1.02] hover:from-blue-500/15 hover:to-blue-600/10 hover:shadow-md"
- >
- <a
- href={versionInformation?.releaseUrl}
- target="_blank"
- rel="noopener noreferrer"
- class="group flex items-center justify-between text-blue-600 transition-colors duration-200 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"
- >
+ <div class="rounded-xl border border-blue-500/20 bg-gradient-to-br from-blue-500/10 to-blue-600/5 p-3 transition-all hover:scale-[1.02] hover:from-blue-500/15 hover:to-blue-600/10 hover:shadow-md">
+ <a href={versionInformation?.releaseUrl} target="_blank" rel="noopener noreferrer" class="group flex items-center justify-between text-blue-600 transition-colors duration-200 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300">
<div class="flex flex-col gap-1">
<span class="text-sm font-semibold">Update available</span>
<span class="text-xs text-blue-500/80">v{versionInformation?.newestVersion}</span>
@@ -45,26 +38,14 @@
<Tooltip.Root>
<Tooltip.Trigger>
{#snippet child({ props })}
- <div
- class="flex h-8 w-8 items-center justify-center rounded-lg border border-blue-500/20 bg-gradient-to-br from-blue-500/10 to-blue-600/5 transition-all hover:scale-[1.02] hover:from-blue-500/15 hover:to-blue-600/10 hover:shadow-md"
- {...props}
- >
- <a
- href={versionInformation?.releaseUrl}
- target="_blank"
- rel="noopener noreferrer"
- class="flex h-full w-full items-center justify-center text-blue-600 transition-all duration-200 hover:scale-110 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"
- >
+ <div class="flex h-8 w-8 items-center justify-center rounded-lg border border-blue-500/20 bg-gradient-to-br from-blue-500/10 to-blue-600/5 transition-all hover:scale-[1.02] hover:from-blue-500/15 hover:to-blue-600/10 hover:shadow-md" {...props}>
+ <a href={versionInformation?.releaseUrl} target="_blank" rel="noopener noreferrer" class="flex h-full w-full items-center justify-center text-blue-600 transition-all duration-200 hover:scale-110 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300">
<ExternalLink size={14} />
</a>
</div>
{/snippet}
</Tooltip.Trigger>
- <Tooltip.Content
- side="right"
- align="center"
- hidden={sidebar.state !== 'collapsed' || sidebar.isMobile}
- >
+ <Tooltip.Content side="right" align="center" hidden={sidebar.state !== 'collapsed' || sidebar.isMobile}>
Update available: v{versionInformation?.newestVersion}
</Tooltip.Content>
</Tooltip.Root>
diff --git a/frontend/src/lib/components/sidebar/sidebar-user.svelte b/frontend/src/lib/components/sidebar/sidebar-user.svelte
index 62da8b42a..c2359e14a 100644
--- a/frontend/src/lib/components/sidebar/sidebar-user.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-user.svelte
@@ -46,17 +46,11 @@
<DropdownMenu.Root>
<DropdownMenu.Trigger>
{#snippet child({ props })}
- <Sidebar.MenuButton
- size="lg"
- class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
- {...props}
- >
+ <Sidebar.MenuButton size="lg" class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground" {...props}>
{#if user && user.displayName}
<Avatar.Root class="size-8 rounded-lg">
<Avatar.Image src={gravatarUrl} alt={user.displayName} />
- <Avatar.Fallback
- class="from-primary/20 to-primary/10 text-primary border-primary/20 rounded-lg border bg-gradient-to-br"
- >
+ <Avatar.Fallback class="from-primary/20 to-primary/10 text-primary border-primary/20 rounded-lg border bg-gradient-to-br">
{user.displayName?.charAt(0).toUpperCase()}
</Avatar.Fallback>
</Avatar.Root>
@@ -71,19 +65,12 @@
</Sidebar.MenuButton>
{/snippet}
</DropdownMenu.Trigger>
- <DropdownMenu.Content
- class="w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg"
- side={sidebar.isMobile ? 'bottom' : 'right'}
- align="end"
- sideOffset={4}
- >
+ <DropdownMenu.Content class="w-(--bits-dropdown-menu-anchor-width) min-w-56 rounded-lg" side={sidebar.isMobile ? 'bottom' : 'right'} align="end" sideOffset={4}>
<DropdownMenu.Label class="p-0 font-normal">
<div class="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
<Avatar.Root class="size-8 rounded-lg">
<Avatar.Image src={gravatarUrl} alt={user.displayName} />
- <Avatar.Fallback
- class="from-primary/20 to-primary/10 text-primary border-primary/20 rounded-lg border bg-gradient-to-br"
- >
+ <Avatar.Fallback class="from-primary/20 to-primary/10 text-primary border-primary/20 rounded-lg border bg-gradient-to-br">
{user.displayName?.charAt(0).toUpperCase()}
</Avatar.Fallback>
</Avatar.Root>
@@ -105,9 +92,7 @@
title={isCollapsed ? 'Toggle theme' : undefined}
onclick={toggleMode}
>
- <div
- class="group-hover:bg-muted-foreground/10 rounded-lg bg-transparent p-1 transition-colors duration-200"
- >
+ <div class="group-hover:bg-muted-foreground/10 rounded-lg bg-transparent p-1 transition-colors duration-200">
{#if mode.current === 'dark'}
<Sun size={16} class="transition-transform duration-200" />
{:else}
@@ -131,9 +116,7 @@
title={isCollapsed ? 'Logout' : undefined}
type="submit"
>
- <div
- class="group-hover:bg-destructive/10 rounded-lg bg-transparent p-1 transition-colors duration-200"
- >
+ <div class="group-hover:bg-destructive/10 rounded-lg bg-transparent p-1 transition-colors duration-200">
<LogOutIcon size={16} class="transition-transform duration-200" />
</div>
{#if !isCollapsed}
diff --git a/frontend/src/lib/components/sidebar/sidebar.svelte b/frontend/src/lib/components/sidebar/sidebar.svelte
index 56d24711a..5bee6aa5d 100644
--- a/frontend/src/lib/components/sidebar/sidebar.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar.svelte
@@ -1,19 +1,5 @@
<script lang="ts" module>
- import {
- FileStack,
- HardDrive,
- Home,
- Network,
- Container,
- ImageIcon,
- SettingsIcon,
- DatabaseIcon,
- LayoutTemplate,
- UserIcon,
- Shield,
- ComputerIcon,
- LockKeyholeIcon
- } from '@lucide/svelte';
+ import { FileStack, HardDrive, Home, Network, Container, ImageIcon, SettingsIcon, DatabaseIcon, LayoutTemplate, UserIcon, Shield, ComputerIcon, LockKeyholeIcon } from '@lucide/svelte';
const staticData = {
settingsItems: [
@@ -98,11 +84,7 @@
<SidebarItemGroup label="Administration" items={staticData.settingsItems} />
</Sidebar.Content>
<Sidebar.Footer>
- <SidebarUpdatebanner
- {isCollapsed}
- {versionInformation}
- updateAvailable={versionInformation.updateAvailable}
- />
+ <SidebarUpdatebanner {isCollapsed} {versionInformation} updateAvailable={versionInformation.updateAvailable} />
{#if user}
<SidebarUser {isCollapsed} {user} />
{/if}
diff --git a/frontend/src/lib/components/stat-card.svelte b/frontend/src/lib/components/stat-card.svelte
index 280970e9c..aabda3623 100644
--- a/frontend/src/lib/components/stat-card.svelte
+++ b/frontend/src/lib/components/stat-card.svelte
@@ -13,15 +13,7 @@
class?: string;
}
- let {
- title,
- value,
- icon: Icon,
- iconColor = 'text-primary',
- bgColor = 'bg-primary/10',
- subtitle,
- class: className
- }: Props = $props();
+ let { title, value, icon: Icon, iconColor = 'text-primary', bgColor = 'bg-primary/10', subtitle, class: className }: Props = $props();
</script>
<Card.Root class={cn('', className)}>
diff --git a/frontend/src/lib/components/template-selection-dialog.svelte b/frontend/src/lib/components/template-selection-dialog.svelte
index 06c22dbd4..d0b84f35f 100644
--- a/frontend/src/lib/components/template-selection-dialog.svelte
+++ b/frontend/src/lib/components/template-selection-dialog.svelte
@@ -5,24 +5,22 @@
import { Badge } from '$lib/components/ui/badge/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
import { FileText, Globe, FolderOpen, Settings, Download, Loader2 } from '@lucide/svelte';
- import type { ComposeTemplate } from '$lib/services/template-service';
- import TemplateAPIService from '$lib/services/api/template-api-service';
+ import { templateAPI } from '$lib/services/api';
+ import type { TemplateRegistry, Template } from '$lib/types/template.type';
import { toast } from 'svelte-sonner';
interface Props {
open: boolean;
- templates: ComposeTemplate[];
- onSelect: (template: ComposeTemplate) => void;
+ templates: Template[];
+ onSelect: (template: Template) => void;
}
let { open = $bindable(), templates, onSelect }: Props = $props();
- const templateAPI = new TemplateAPIService();
-
// Loading states for individual templates
let loadingStates = $state(new Map<string, boolean>());
- async function handleSelect(template: ComposeTemplate) {
+ async function handleSelect(template: Template) {
// Set loading state
loadingStates.set(template.id, true);
loadingStates = new Map(loadingStates);
@@ -30,9 +28,8 @@
try {
let finalTemplate = template;
- // If it's a remote template, fetch the actual content via API
if (template.isRemote) {
- const templateContent = await templateAPI.getContent(template.id);
+ const templateContent = await templateAPI.getById(template.id);
if (!templateContent.content) {
toast.error('Failed to load template content');
@@ -60,7 +57,7 @@
}
}
- async function handleDownload(template: ComposeTemplate) {
+ async function handleDownload(template: Template) {
if (!template.isRemote) return;
const templateId = template.id;
@@ -104,10 +101,7 @@
<FileText class="size-5" />
Choose a Template
</Dialog.Title>
- <Dialog.Description
- >Select a Docker Compose template to get started quickly, or download remote templates for
- local use.</Dialog.Description
- >
+ <Dialog.Description>Select a Docker Compose template to get started quickly, or download remote templates for local use.</Dialog.Description>
</Dialog.Header>
<div class="space-y-6 py-4">
@@ -116,10 +110,7 @@
<FileText class="mx-auto mb-4 size-12 opacity-50" />
<p class="mb-2">No templates available</p>
<p class="text-sm">
- Configure remote registries in <a
- href="/settings/templates"
- class="text-primary hover:underline">Template Settings</a
- > to access community templates
+ Configure remote registries in <a href="/settings/templates" class="text-primary hover:underline">Template Settings</a> to access community templates
</p>
</div>
{:else}
@@ -132,9 +123,7 @@
</h3>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
{#each localTemplates as template}
- <Card
- class="hover:bg-muted/50 hover:border-primary/20 cursor-pointer border-2 transition-colors"
- >
+ <Card class="hover:bg-muted/50 hover:border-primary/20 cursor-pointer border-2 transition-colors">
<div class="p-4">
<div class="mb-2 flex items-start justify-between">
<h4 class="truncate pr-2 font-semibold">{template.name}</h4>
@@ -158,11 +147,7 @@
<div class="text-muted-foreground text-xs">
{template.envContent ? 'Includes environment variables' : 'Ready to use'}
</div>
- <Button
- size="sm"
- onclick={() => handleSelect(template)}
- disabled={loadingStates.get(template.id)}
- >
+ <Button size="sm" onclick={() => handleSelect(template)} disabled={loadingStates.get(template.id)}>
{#if loadingStates.get(template.id)}
<Loader2 class="mr-1 size-3 animate-spin" />
Loading...
@@ -194,7 +179,7 @@
<div class="ml-2 flex flex-shrink-0 gap-1">
<Badge variant="secondary" class="text-xs">
<Globe class="mr-1 size-3" />
- {template.metadata?.registry || 'Remote'}
+ {template.metadata?.author || 'Remote'}
</Badge>
{#if template.metadata?.envUrl}
<Badge variant="secondary" class="text-xs">
@@ -221,12 +206,7 @@
{/if}
</div>
<div class="flex gap-2">
- <Button
- variant="outline"
- size="sm"
- onclick={() => handleDownload(template)}
- disabled={loadingStates.get(`download-${template.id}`)}
- >
+ <Button variant="outline" size="sm" onclick={() => handleDownload(template)} disabled={loadingStates.get(`download-${template.id}`)}>
{#if loadingStates.get(`download-${template.id}`)}
<Loader2 class="mr-1 size-3 animate-spin" />
Downloading...
@@ -235,11 +215,7 @@
Download
{/if}
</Button>
- <Button
- size="sm"
- onclick={() => handleSelect(template)}
- disabled={loadingStates.get(template.id)}
- >
+ <Button size="sm" onclick={() => handleSelect(template)} disabled={loadingStates.get(template.id)}>
{#if loadingStates.get(template.id)}
<Loader2 class="mr-1 size-3 animate-spin" />
Loading...
diff --git a/frontend/src/lib/components/ui/accordion/accordion-content.svelte b/frontend/src/lib/components/ui/accordion/accordion-content.svelte
index e46957e42..629c9696f 100644
--- a/frontend/src/lib/components/ui/accordion/accordion-content.svelte
+++ b/frontend/src/lib/components/ui/accordion/accordion-content.svelte
@@ -2,22 +2,10 @@
import { Accordion as AccordionPrimitive, type WithoutChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithoutChild<AccordionPrimitive.ContentProps> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithoutChild<AccordionPrimitive.ContentProps> = $props();
</script>
-<AccordionPrimitive.Content
- bind:ref
- class={cn(
- 'data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all',
- className
- )}
- {...restProps}
->
+<AccordionPrimitive.Content bind:ref class={cn('data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm transition-all', className)} {...restProps}>
<div class="pt-0 pb-4">
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/accordion/accordion-item.svelte b/frontend/src/lib/components/ui/accordion/accordion-item.svelte
index 640a466c9..a11a6af13 100644
--- a/frontend/src/lib/components/ui/accordion/accordion-item.svelte
+++ b/frontend/src/lib/components/ui/accordion/accordion-item.svelte
@@ -2,11 +2,7 @@
import { Accordion as AccordionPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: AccordionPrimitive.ItemProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: AccordionPrimitive.ItemProps = $props();
</script>
<AccordionPrimitive.Item bind:ref class={cn('border-b', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/accordion/accordion-trigger.svelte b/frontend/src/lib/components/ui/accordion/accordion-trigger.svelte
index df2a61944..51d51e29c 100644
--- a/frontend/src/lib/components/ui/accordion/accordion-trigger.svelte
+++ b/frontend/src/lib/components/ui/accordion/accordion-trigger.svelte
@@ -15,14 +15,7 @@
</script>
<AccordionPrimitive.Header {level} class="flex">
- <AccordionPrimitive.Trigger
- bind:ref
- class={cn(
- 'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
- className
- )}
- {...restProps}
- >
+ <AccordionPrimitive.Trigger bind:ref class={cn('flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180', className)} {...restProps}>
{@render children?.()}
<ChevronDown class="size-4 shrink-0 transition-transform duration-200" />
</AccordionPrimitive.Trigger>
diff --git a/frontend/src/lib/components/ui/alert/alert-description.svelte b/frontend/src/lib/components/ui/alert/alert-description.svelte
index 8d98ca116..a47e9ebdc 100644
--- a/frontend/src/lib/components/ui/alert/alert-description.svelte
+++ b/frontend/src/lib/components/ui/alert/alert-description.svelte
@@ -3,12 +3,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div bind:this={ref} class={cn('text-sm [&_p]:leading-relaxed', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/alert/alert-title.svelte b/frontend/src/lib/components/ui/alert/alert-title.svelte
index 3e947df2b..c05eca987 100644
--- a/frontend/src/lib/components/ui/alert/alert-title.svelte
+++ b/frontend/src/lib/components/ui/alert/alert-title.svelte
@@ -14,12 +14,6 @@
} = $props();
</script>
-<div
- role="heading"
- aria-level={level}
- bind:this={ref}
- class={cn('mb-1 leading-none font-medium tracking-tight', className)}
- {...restProps}
->
+<div role="heading" aria-level={level} bind:this={ref} class={cn('mb-1 leading-none font-medium tracking-tight', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/alert/alert.svelte b/frontend/src/lib/components/ui/alert/alert.svelte
index 85d6631a4..2804a8bdf 100644
--- a/frontend/src/lib/components/ui/alert/alert.svelte
+++ b/frontend/src/lib/components/ui/alert/alert.svelte
@@ -7,8 +7,7 @@
variant: {
default: 'bg-background text-foreground',
warning: 'border-amber-600/50 text-amber-300 dark:border-amber-600 [&>svg]:text-amber-300',
- destructive:
- 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive'
+ destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive'
}
},
defaultVariants: {
diff --git a/frontend/src/lib/components/ui/avatar/avatar-fallback.svelte b/frontend/src/lib/components/ui/avatar/avatar-fallback.svelte
index b911baf94..1c184235e 100644
--- a/frontend/src/lib/components/ui/avatar/avatar-fallback.svelte
+++ b/frontend/src/lib/components/ui/avatar/avatar-fallback.svelte
@@ -2,16 +2,7 @@
import { Avatar as AvatarPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: AvatarPrimitive.FallbackProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: AvatarPrimitive.FallbackProps = $props();
</script>
-<AvatarPrimitive.Fallback
- bind:ref
- data-slot="avatar-fallback"
- class={cn('bg-muted flex size-full items-center justify-center rounded-full', className)}
- {...restProps}
-/>
+<AvatarPrimitive.Fallback bind:ref data-slot="avatar-fallback" class={cn('bg-muted flex size-full items-center justify-center rounded-full', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/avatar/avatar-image.svelte b/frontend/src/lib/components/ui/avatar/avatar-image.svelte
index 7ccc3ce38..719803bf0 100644
--- a/frontend/src/lib/components/ui/avatar/avatar-image.svelte
+++ b/frontend/src/lib/components/ui/avatar/avatar-image.svelte
@@ -2,16 +2,7 @@
import { Avatar as AvatarPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: AvatarPrimitive.ImageProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: AvatarPrimitive.ImageProps = $props();
</script>
-<AvatarPrimitive.Image
- bind:ref
- data-slot="avatar-image"
- class={cn('aspect-square size-full', className)}
- {...restProps}
-/>
+<AvatarPrimitive.Image bind:ref data-slot="avatar-image" class={cn('aspect-square size-full', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/avatar/avatar.svelte b/frontend/src/lib/components/ui/avatar/avatar.svelte
index 40feecd1c..04d601eb0 100644
--- a/frontend/src/lib/components/ui/avatar/avatar.svelte
+++ b/frontend/src/lib/components/ui/avatar/avatar.svelte
@@ -2,16 +2,7 @@
import { Avatar as AvatarPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: AvatarPrimitive.RootProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: AvatarPrimitive.RootProps = $props();
</script>
-<AvatarPrimitive.Root
- bind:ref
- data-slot="avatar"
- class={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}
- {...restProps}
-/>
+<AvatarPrimitive.Root bind:ref data-slot="avatar" class={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/badge/badge.svelte b/frontend/src/lib/components/ui/badge/badge.svelte
index cdfe1193b..0488589a7 100644
--- a/frontend/src/lib/components/ui/badge/badge.svelte
+++ b/frontend/src/lib/components/ui/badge/badge.svelte
@@ -6,10 +6,8 @@
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/80 border-transparent',
- secondary:
- 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent',
- destructive:
- 'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent',
+ secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent',
+ destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent',
outline: 'text-foreground'
}
},
@@ -38,12 +36,6 @@
} = $props();
</script>
-<svelte:element
- this={href ? 'a' : 'span'}
- bind:this={ref}
- {href}
- class={cn(badgeVariants({ variant }), className)}
- {...restProps}
->
+<svelte:element this={href ? 'a' : 'span'} bind:this={ref} {href} class={cn(badgeVariants({ variant }), className)} {...restProps}>
{@render children?.()}
</svelte:element>
diff --git a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte
index f40df5be1..6fdf6a7fd 100644
--- a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte
+++ b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte
@@ -4,20 +4,10 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
</script>
-<span
- bind:this={ref}
- role="presentation"
- aria-hidden="true"
- class={cn('flex size-9 items-center justify-center', className)}
- {...restProps}
->
+<span bind:this={ref} role="presentation" aria-hidden="true" class={cn('flex size-9 items-center justify-center', className)} {...restProps}>
<Ellipsis class="size-4" />
<span class="sr-only">More</span>
</span>
diff --git a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte
index 82a612949..f08ea6d2b 100644
--- a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte
+++ b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte
@@ -3,12 +3,7 @@
import type { HTMLLiAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLLiAttributes> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLLiAttributes> = $props();
</script>
<li bind:this={ref} class={cn('inline-flex items-center gap-1.5', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte
index efbdd65f2..17fd0a4d6 100644
--- a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte
+++ b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte
@@ -3,21 +3,9 @@
import type { HTMLOlAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLOlAttributes> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLOlAttributes> = $props();
</script>
-<ol
- bind:this={ref}
- class={cn(
- 'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
- className
- )}
- {...restProps}
->
+<ol bind:this={ref} class={cn('text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5', className)} {...restProps}>
{@render children?.()}
</ol>
diff --git a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte
index 6ee61fbf1..c2a203d7d 100644
--- a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte
+++ b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte
@@ -3,21 +3,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
</script>
-<span
- bind:this={ref}
- role="link"
- aria-disabled="true"
- aria-current="page"
- class={cn('text-foreground font-normal', className)}
- {...restProps}
->
+<span bind:this={ref} role="link" aria-disabled="true" aria-current="page" class={cn('text-foreground font-normal', className)} {...restProps}>
{@render children?.()}
</span>
diff --git a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte
index df82aa019..b5ce55402 100644
--- a/frontend/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte
+++ b/frontend/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte
@@ -4,21 +4,10 @@
import type { HTMLLiAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLLiAttributes> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLLiAttributes> = $props();
</script>
-<li
- role="presentation"
- aria-hidden="true"
- class={cn('[&>svg]:size-3.5', className)}
- bind:this={ref}
- {...restProps}
->
+<li role="presentation" aria-hidden="true" class={cn('[&>svg]:size-3.5', className)} bind:this={ref} {...restProps}>
{#if children}
{@render children?.()}
{:else}
diff --git a/frontend/src/lib/components/ui/breadcrumb/breadcrumb.svelte b/frontend/src/lib/components/ui/breadcrumb/breadcrumb.svelte
index dd406d77d..89be45e20 100644
--- a/frontend/src/lib/components/ui/breadcrumb/breadcrumb.svelte
+++ b/frontend/src/lib/components/ui/breadcrumb/breadcrumb.svelte
@@ -2,12 +2,7 @@
import type { WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
<nav bind:this={ref} class={className} aria-label="breadcrumb" {...restProps}>
diff --git a/frontend/src/lib/components/ui/button/button.svelte b/frontend/src/lib/components/ui/button/button.svelte
index 16f1a3ccb..6fa70709c 100644
--- a/frontend/src/lib/components/ui/button/button.svelte
+++ b/frontend/src/lib/components/ui/button/button.svelte
@@ -8,10 +8,8 @@
variants: {
variant: {
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
- destructive:
- 'bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white',
- outline:
- 'bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border',
+ destructive: 'bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white',
+ outline: 'bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border',
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
link: 'text-primary underline-offset-4 hover:underline'
@@ -40,41 +38,15 @@
</script>
<script lang="ts">
- let {
- class: className,
- variant = 'default',
- size = 'default',
- ref = $bindable(null),
- href = undefined,
- type = 'button',
- disabled,
- children,
- ...restProps
- }: ButtonProps = $props();
+ let { class: className, variant = 'default', size = 'default', ref = $bindable(null), href = undefined, type = 'button', disabled, children, ...restProps }: ButtonProps = $props();
</script>
{#if href}
- <a
- bind:this={ref}
- data-slot="button"
- class={cn(buttonVariants({ variant, size }), className)}
- href={disabled ? undefined : href}
- aria-disabled={disabled}
- role={disabled ? 'link' : undefined}
- tabindex={disabled ? -1 : undefined}
- {...restProps}
- >
+ <a bind:this={ref} data-slot="button" class={cn(buttonVariants({ variant, size }), className)} href={disabled ? undefined : href} aria-disabled={disabled} role={disabled ? 'link' : undefined} tabindex={disabled ? -1 : undefined} {...restProps}>
{@render children?.()}
</a>
{:else}
- <button
- bind:this={ref}
- data-slot="button"
- class={cn(buttonVariants({ variant, size }), className)}
- {type}
- {disabled}
- {...restProps}
- >
+ <button bind:this={ref} data-slot="button" class={cn(buttonVariants({ variant, size }), className)} {type} {disabled} {...restProps}>
{@render children?.()}
</button>
{/if}
diff --git a/frontend/src/lib/components/ui/button/index.ts b/frontend/src/lib/components/ui/button/index.ts
index 5414d9d34..3fd7e24ba 100644
--- a/frontend/src/lib/components/ui/button/index.ts
+++ b/frontend/src/lib/components/ui/button/index.ts
@@ -1,9 +1,4 @@
-import Root, {
- type ButtonProps,
- type ButtonSize,
- type ButtonVariant,
- buttonVariants
-} from './button.svelte';
+import Root, { type ButtonProps, type ButtonSize, type ButtonVariant, buttonVariants } from './button.svelte';
export {
Root,
diff --git a/frontend/src/lib/components/ui/card/card-content.svelte b/frontend/src/lib/components/ui/card/card-content.svelte
index ff7e85870..7c37e9180 100644
--- a/frontend/src/lib/components/ui/card/card-content.svelte
+++ b/frontend/src/lib/components/ui/card/card-content.svelte
@@ -3,12 +3,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div bind:this={ref} class={cn('p-6', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/card/card-description.svelte b/frontend/src/lib/components/ui/card/card-description.svelte
index b78f436b9..471bf175f 100644
--- a/frontend/src/lib/components/ui/card/card-description.svelte
+++ b/frontend/src/lib/components/ui/card/card-description.svelte
@@ -3,12 +3,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
</script>
<p bind:this={ref} class={cn('text-muted-foreground text-sm', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/card/card-footer.svelte b/frontend/src/lib/components/ui/card/card-footer.svelte
index ee3a681dc..bea56fdf0 100644
--- a/frontend/src/lib/components/ui/card/card-footer.svelte
+++ b/frontend/src/lib/components/ui/card/card-footer.svelte
@@ -3,12 +3,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div bind:this={ref} class={cn('flex items-center p-6 pt-0', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/card/card-header.svelte b/frontend/src/lib/components/ui/card/card-header.svelte
index 014a3aec9..972b59d4f 100644
--- a/frontend/src/lib/components/ui/card/card-header.svelte
+++ b/frontend/src/lib/components/ui/card/card-header.svelte
@@ -3,12 +3,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div bind:this={ref} class={cn('flex flex-col space-y-1.5 p-6 pb-0', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/card/card-title.svelte b/frontend/src/lib/components/ui/card/card-title.svelte
index ee758b44c..57d0627bc 100644
--- a/frontend/src/lib/components/ui/card/card-title.svelte
+++ b/frontend/src/lib/components/ui/card/card-title.svelte
@@ -14,12 +14,6 @@
} = $props();
</script>
-<div
- role="heading"
- aria-level={level}
- bind:this={ref}
- class={cn('text-2xl leading-none font-semibold tracking-tight', className)}
- {...restProps}
->
+<div role="heading" aria-level={level} bind:this={ref} class={cn('text-2xl leading-none font-semibold tracking-tight', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/card.svelte b/frontend/src/lib/components/ui/card/card.svelte
index 0f26bc938..cb3596a14 100644
--- a/frontend/src/lib/components/ui/card/card.svelte
+++ b/frontend/src/lib/components/ui/card/card.svelte
@@ -3,18 +3,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div
- bind:this={ref}
- class={cn('bg-card text-card-foreground rounded-lg border shadow-sm', className)}
- {...restProps}
->
+<div bind:this={ref} class={cn('bg-card text-card-foreground rounded-lg border shadow-sm', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/checkbox/checkbox.svelte b/frontend/src/lib/components/ui/checkbox/checkbox.svelte
index cc3cd93b3..c3ad54f7c 100644
--- a/frontend/src/lib/components/ui/checkbox/checkbox.svelte
+++ b/frontend/src/lib/components/ui/checkbox/checkbox.svelte
@@ -4,13 +4,7 @@
import Minus from '@lucide/svelte/icons/minus';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- checked = $bindable(false),
- indeterminate = $bindable(false),
- class: className,
- ...restProps
- }: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
+ let { ref = $bindable(null), checked = $bindable(false), indeterminate = $bindable(false), class: className, ...restProps }: WithoutChildrenOrChild<CheckboxPrimitive.RootProps> = $props();
</script>
<CheckboxPrimitive.Root
diff --git a/frontend/src/lib/components/ui/collapsible/collapsible.svelte b/frontend/src/lib/components/ui/collapsible/collapsible.svelte
index 9588b32f8..a3aafeb8a 100644
--- a/frontend/src/lib/components/ui/collapsible/collapsible.svelte
+++ b/frontend/src/lib/components/ui/collapsible/collapsible.svelte
@@ -1,11 +1,7 @@
<script lang="ts">
import { Collapsible as CollapsiblePrimitive } from 'bits-ui';
- let {
- ref = $bindable(null),
- open = $bindable(false),
- ...restProps
- }: CollapsiblePrimitive.RootProps = $props();
+ let { ref = $bindable(null), open = $bindable(false), ...restProps }: CollapsiblePrimitive.RootProps = $props();
</script>
<CollapsiblePrimitive.Root bind:ref data-slot="collapsible" {...restProps} />
diff --git a/frontend/src/lib/components/ui/data-table/data-table.svelte.ts b/frontend/src/lib/components/ui/data-table/data-table.svelte.ts
index 27593301c..4c1aee773 100644
--- a/frontend/src/lib/components/ui/data-table/data-table.svelte.ts
+++ b/frontend/src/lib/components/ui/data-table/data-table.svelte.ts
@@ -1,10 +1,4 @@
-import {
- type RowData,
- type TableOptions,
- type TableOptionsResolved,
- type TableState,
- createTable
-} from '@tanstack/table-core';
+import { type RowData, type TableOptions, type TableOptionsResolved, type TableState, createTable } from '@tanstack/table-core';
/**
* Creates a reactive TanStack table object for Svelte.
@@ -38,10 +32,7 @@ export function createSvelteTable<TData extends RowData>(options: TableOptions<T
state: {},
onStateChange() {},
renderFallbackValue: null,
- mergeOptions: (
- defaultOptions: TableOptions<TData>,
- options: Partial<TableOptions<TData>>
- ) => {
+ mergeOptions: (defaultOptions: TableOptions<TData>, options: Partial<TableOptions<TData>>) => {
return mergeObjects(defaultOptions, options);
}
},
diff --git a/frontend/src/lib/components/ui/data-table/flex-render.svelte b/frontend/src/lib/components/ui/data-table/flex-render.svelte
index bd5dc1b5d..ff24a89ee 100644
--- a/frontend/src/lib/components/ui/data-table/flex-render.svelte
+++ b/frontend/src/lib/components/ui/data-table/flex-render.svelte
@@ -6,18 +6,11 @@
type TContext = unknown;
</script>
-<script
- lang="ts"
- generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>"
->
+<script lang="ts" generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>">
import { RenderComponentConfig, RenderSnippetConfig } from './render-helpers.js';
type Props = {
/** The cell or header field of the current cell's column definition. */
- content?: TContext extends HeaderContext<TData, TValue>
- ? ColumnDefTemplate<HeaderContext<TData, TValue>>
- : TContext extends CellContext<TData, TValue>
- ? ColumnDefTemplate<CellContext<TData, TValue>>
- : never;
+ content?: TContext extends HeaderContext<TData, TValue> ? ColumnDefTemplate<HeaderContext<TData, TValue>> : TContext extends CellContext<TData, TValue> ? ColumnDefTemplate<CellContext<TData, TValue>> : never;
/** The result of the `getContext()` function of the header or cell */
context: TContext;
};
diff --git a/frontend/src/lib/components/ui/data-table/render-helpers.ts b/frontend/src/lib/components/ui/data-table/render-helpers.ts
index 3f05b4972..853e14799 100644
--- a/frontend/src/lib/components/ui/data-table/render-helpers.ts
+++ b/frontend/src/lib/components/ui/data-table/render-helpers.ts
@@ -19,10 +19,7 @@ import type { Component, ComponentProps, Snippet } from 'svelte';
export class RenderComponentConfig<TComponent extends Component> {
component: TComponent;
props: ComponentProps<TComponent> | Record<string, never>;
- constructor(
- component: TComponent,
- props: ComponentProps<TComponent> | Record<string, never> = {}
- ) {
+ constructor(component: TComponent, props: ComponentProps<TComponent> | Record<string, never> = {}) {
this.component = component;
this.props = props;
}
diff --git a/frontend/src/lib/components/ui/dialog/dialog-description.svelte b/frontend/src/lib/components/ui/dialog/dialog-description.svelte
index c658420e1..a20bc38e8 100644
--- a/frontend/src/lib/components/ui/dialog/dialog-description.svelte
+++ b/frontend/src/lib/components/ui/dialog/dialog-description.svelte
@@ -2,16 +2,7 @@
import { Dialog as DialogPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DialogPrimitive.DescriptionProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DialogPrimitive.DescriptionProps = $props();
</script>
-<DialogPrimitive.Description
- bind:ref
- data-slot="dialog-description"
- class={cn('text-muted-foreground text-sm', className)}
- {...restProps}
-/>
+<DialogPrimitive.Description bind:ref data-slot="dialog-description" class={cn('text-muted-foreground text-sm', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dialog/dialog-footer.svelte b/frontend/src/lib/components/ui/dialog/dialog-footer.svelte
index c457d5632..a7789619a 100644
--- a/frontend/src/lib/components/ui/dialog/dialog-footer.svelte
+++ b/frontend/src/lib/components/ui/dialog/dialog-footer.svelte
@@ -2,19 +2,9 @@
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();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="dialog-footer"
- class={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="dialog-footer" class={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/dialog/dialog-header.svelte b/frontend/src/lib/components/ui/dialog/dialog-header.svelte
index 5fe41452b..f6038a838 100644
--- a/frontend/src/lib/components/ui/dialog/dialog-header.svelte
+++ b/frontend/src/lib/components/ui/dialog/dialog-header.svelte
@@ -2,19 +2,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn, type WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="dialog-header"
- class={cn('flex flex-col gap-2 text-center sm:text-left', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="dialog-header" class={cn('flex flex-col gap-2 text-center sm:text-left', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/dialog/dialog-overlay.svelte b/frontend/src/lib/components/ui/dialog/dialog-overlay.svelte
index 938ab1e44..8c04b04b2 100644
--- a/frontend/src/lib/components/ui/dialog/dialog-overlay.svelte
+++ b/frontend/src/lib/components/ui/dialog/dialog-overlay.svelte
@@ -2,19 +2,7 @@
import { Dialog as DialogPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DialogPrimitive.OverlayProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DialogPrimitive.OverlayProps = $props();
</script>
-<DialogPrimitive.Overlay
- bind:ref
- data-slot="dialog-overlay"
- class={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
- className
- )}
- {...restProps}
-/>
+<DialogPrimitive.Overlay bind:ref data-slot="dialog-overlay" class={cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dialog/dialog-title.svelte b/frontend/src/lib/components/ui/dialog/dialog-title.svelte
index 7073699d6..29baf09ac 100644
--- a/frontend/src/lib/components/ui/dialog/dialog-title.svelte
+++ b/frontend/src/lib/components/ui/dialog/dialog-title.svelte
@@ -2,16 +2,7 @@
import { Dialog as DialogPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DialogPrimitive.TitleProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DialogPrimitive.TitleProps = $props();
</script>
-<DialogPrimitive.Title
- bind:ref
- data-slot="dialog-title"
- class={cn('text-lg leading-none font-semibold', className)}
- {...restProps}
-/>
+<DialogPrimitive.Title bind:ref data-slot="dialog-title" class={cn('text-lg leading-none font-semibold', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-item.svelte b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-item.svelte
index 554290446..9d51edccb 100644
--- a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-item.svelte
+++ b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-item.svelte
@@ -2,11 +2,7 @@
import { cn } from '$lib/utils.js';
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DropdownMenuPrimitive.ItemProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.ItemProps = $props();
</script>
<DropdownMenuPrimitive.Item
diff --git a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-main.svelte b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-main.svelte
index 872e7a8a5..be84e5143 100644
--- a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-main.svelte
+++ b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-main.svelte
@@ -1,11 +1,7 @@
<script lang="ts" module>
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLButtonAttributes } from 'svelte/elements';
- import {
- buttonVariants,
- type ButtonVariant,
- type ButtonSize
- } from '$lib/components/ui/button/button.svelte';
+ import { buttonVariants, type ButtonVariant, type ButtonSize } from '$lib/components/ui/button/button.svelte';
export type DropdownButtonMainProps = WithElementRef<HTMLButtonAttributes> & {
variant?: ButtonVariant;
@@ -14,25 +10,9 @@
</script>
<script lang="ts">
- let {
- class: className,
- variant = 'default',
- size = 'default',
- ref = $bindable(null),
- type = 'button',
- disabled,
- children,
- ...restProps
- }: DropdownButtonMainProps = $props();
+ let { class: className, variant = 'default', size = 'default', ref = $bindable(null), type = 'button', disabled, children, ...restProps }: DropdownButtonMainProps = $props();
</script>
-<button
- bind:this={ref}
- data-slot="dropdown-button-main"
- class={cn(buttonVariants({ variant, size }), 'rounded-r-none border-r-0', className)}
- {type}
- {disabled}
- {...restProps}
->
+<button bind:this={ref} data-slot="dropdown-button-main" class={cn(buttonVariants({ variant, size }), 'rounded-r-none border-r-0', className)} {type} {disabled} {...restProps}>
{@render children?.()}
</button>
diff --git a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-separator.svelte b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-separator.svelte
index 0f43a4219..a80137d96 100644
--- a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-separator.svelte
+++ b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-separator.svelte
@@ -7,15 +7,7 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DropdownMenuPrimitive.SeparatorProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.SeparatorProps = $props();
</script>
-<DropdownMenuPrimitive.Separator
- bind:ref
- class={cn('bg-muted -mx-1 my-1 h-px', className)}
- {...restProps}
-/>
+<DropdownMenuPrimitive.Separator bind:ref class={cn('bg-muted -mx-1 my-1 h-px', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-trigger.svelte b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-trigger.svelte
index 35628f2dc..473660c03 100644
--- a/frontend/src/lib/components/ui/dropdown-button/dropdown-button-trigger.svelte
+++ b/frontend/src/lib/components/ui/dropdown-button/dropdown-button-trigger.svelte
@@ -1,11 +1,7 @@
<script lang="ts" module>
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLButtonAttributes } from 'svelte/elements';
- import {
- buttonVariants,
- type ButtonVariant,
- type ButtonSize
- } from '$lib/components/ui/button/button.svelte';
+ import { buttonVariants, type ButtonVariant, type ButtonSize } from '$lib/components/ui/button/button.svelte';
export type DropdownButtonTriggerProps = WithElementRef<HTMLButtonAttributes> & {
variant?: ButtonVariant;
@@ -17,32 +13,10 @@
<script lang="ts">
import { ChevronDown } from '@lucide/svelte';
- let {
- class: className,
- variant = 'default',
- size = 'default',
- ref = $bindable(null),
- type = 'button',
- disabled,
- builders = [],
- children,
- ...restProps
- }: DropdownButtonTriggerProps = $props();
+ let { class: className, variant = 'default', size = 'default', ref = $bindable(null), type = 'button', disabled, builders = [], children, ...restProps }: DropdownButtonTriggerProps = $props();
</script>
-<button
- bind:this={ref}
- use:builders[0]
- data-slot="dropdown-button-trigger"
- class={cn(
- buttonVariants({ variant, size }),
- 'border-l-background/20 rounded-l-none border-l px-2',
- className
- )}
- {type}
- {disabled}
- {...restProps}
->
+<button bind:this={ref} use:builders[0] data-slot="dropdown-button-trigger" class={cn(buttonVariants({ variant, size }), 'border-l-background/20 rounded-l-none border-l px-2', className)} {type} {disabled} {...restProps}>
{#if children}
{@render children()}
{:else}
diff --git a/frontend/src/lib/components/ui/dropdown-button/dropdown-button.svelte b/frontend/src/lib/components/ui/dropdown-button/dropdown-button.svelte
index 436652e15..de378a57d 100644
--- a/frontend/src/lib/components/ui/dropdown-button/dropdown-button.svelte
+++ b/frontend/src/lib/components/ui/dropdown-button/dropdown-button.svelte
@@ -6,12 +6,7 @@
</script>
<script lang="ts">
- let {
- class: className,
- ref = $bindable(null),
- children,
- ...restProps
- }: DropdownButtonProps = $props();
+ let { class: className, ref = $bindable(null), children, ...restProps }: DropdownButtonProps = $props();
</script>
<div bind:this={ref} data-slot="dropdown-button" class={cn('flex', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte
index ef3d936dd..2eb7c5b84 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte
@@ -21,10 +21,7 @@
bind:ref
bind:checked
bind:indeterminate
- class={cn(
- 'data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex 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
- )}
+ class={cn('data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex 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)}
{...restProps}
>
{#snippet children({ checked, indeterminate })}
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte
index f9769a66c..5adebb428 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte
@@ -12,8 +12,4 @@
} = $props();
</script>
-<DropdownMenuPrimitive.GroupHeading
- bind:ref
- class={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
- {...restProps}
-/>
+<DropdownMenuPrimitive.GroupHeading bind:ref class={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte
index 523f7ee80..b337da672 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte
@@ -14,10 +14,6 @@
} = $props();
</script>
-<div
- bind:this={ref}
- class={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
- {...restProps}
->
+<div bind:this={ref} class={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte
index 53bd3c099..19d71d774 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte
@@ -3,20 +3,12 @@
import Circle from '@lucide/svelte/icons/circle';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children: childrenProp,
- ...restProps
- }: WithoutChild<DropdownMenuPrimitive.RadioItemProps> = $props();
+ let { ref = $bindable(null), class: className, children: childrenProp, ...restProps }: WithoutChild<DropdownMenuPrimitive.RadioItemProps> = $props();
</script>
<DropdownMenuPrimitive.RadioItem
bind:ref
- class={cn(
- 'data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex 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
- )}
+ class={cn('data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex 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)}
{...restProps}
>
{#snippet children({ checked })}
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte
index 53f69c8f6..a61157161 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte
@@ -2,15 +2,7 @@
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DropdownMenuPrimitive.SeparatorProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.SeparatorProps = $props();
</script>
-<DropdownMenuPrimitive.Separator
- bind:ref
- class={cn('bg-muted -mx-1 my-1 h-px', className)}
- {...restProps}
-/>
+<DropdownMenuPrimitive.Separator bind:ref class={cn('bg-muted -mx-1 my-1 h-px', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte
index c75006239..a47a6a837 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte
@@ -3,18 +3,9 @@
import { type WithElementRef } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
</script>
-<span
- bind:this={ref}
- class={cn('ml-auto text-xs tracking-widest opacity-60', className)}
- {...restProps}
->
+<span bind:this={ref} class={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...restProps}>
{@render children?.()}
</span>
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte
index 9110240a9..e53b55529 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte
@@ -2,18 +2,7 @@
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: DropdownMenuPrimitive.SubContentProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.SubContentProps = $props();
</script>
-<DropdownMenuPrimitive.SubContent
- bind:ref
- class={cn(
- 'bg-popover text-popover-foreground z-50 min-w-32 rounded-md border p-1 shadow-lg focus:outline-none',
- className
- )}
- {...restProps}
-/>
+<DropdownMenuPrimitive.SubContent bind:ref class={cn('bg-popover text-popover-foreground z-50 min-w-32 rounded-md border p-1 shadow-lg focus:outline-none', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte
index 143a269cf..df1be36ad 100644
--- a/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte
+++ b/frontend/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte
@@ -16,11 +16,7 @@
<DropdownMenuPrimitive.SubTrigger
bind:ref
- class={cn(
- 'data-highlighted:bg-accent data-[state=open]:bg-accent flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
- inset && 'pl-8',
- className
- )}
+ class={cn('data-highlighted:bg-accent data-[state=open]:bg-accent flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', inset && 'pl-8', className)}
{...restProps}
>
{@render children?.()}
diff --git a/frontend/src/lib/components/ui/form/form-description.svelte b/frontend/src/lib/components/ui/form/form-description.svelte
index 54d3dbff0..21a46be84 100644
--- a/frontend/src/lib/components/ui/form/form-description.svelte
+++ b/frontend/src/lib/components/ui/form/form-description.svelte
@@ -3,15 +3,7 @@
import type { WithoutChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: WithoutChild<FormPrimitive.DescriptionProps> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: WithoutChild<FormPrimitive.DescriptionProps> = $props();
</script>
-<FormPrimitive.Description
- bind:ref
- class={cn('text-muted-foreground text-sm', className)}
- {...restProps}
-/>
+<FormPrimitive.Description bind:ref class={cn('text-muted-foreground text-sm', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/form/form-element-field.svelte b/frontend/src/lib/components/ui/form/form-element-field.svelte
index 5f2d30823..1c33df665 100644
--- a/frontend/src/lib/components/ui/form/form-element-field.svelte
+++ b/frontend/src/lib/components/ui/form/form-element-field.svelte
@@ -10,15 +10,7 @@
import type { WithElementRef, WithoutChildren } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- form,
- name,
- children: childrenProp,
- ...restProps
- }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> &
- FormPrimitive.ElementFieldProps<T, U> = $props();
+ let { ref = $bindable(null), class: className, form, name, children: childrenProp, ...restProps }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> & FormPrimitive.ElementFieldProps<T, U> = $props();
</script>
<FormPrimitive.ElementField {form} {name}>
diff --git a/frontend/src/lib/components/ui/form/form-field-errors.svelte b/frontend/src/lib/components/ui/form/form-field-errors.svelte
index 93f4a806b..ac19775c0 100644
--- a/frontend/src/lib/components/ui/form/form-field-errors.svelte
+++ b/frontend/src/lib/components/ui/form/form-field-errors.svelte
@@ -14,11 +14,7 @@
} = $props();
</script>
-<FormPrimitive.FieldErrors
- bind:ref
- class={cn('text-destructive text-sm font-medium', className)}
- {...restProps}
->
+<FormPrimitive.FieldErrors bind:ref class={cn('text-destructive text-sm font-medium', className)} {...restProps}>
{#snippet children({ errors, errorProps })}
{#if childrenProp}
{@render childrenProp({ errors, errorProps })}
diff --git a/frontend/src/lib/components/ui/form/form-field.svelte b/frontend/src/lib/components/ui/form/form-field.svelte
index 192d39c6a..af9470df6 100644
--- a/frontend/src/lib/components/ui/form/form-field.svelte
+++ b/frontend/src/lib/components/ui/form/form-field.svelte
@@ -10,15 +10,7 @@
import { cn } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- form,
- name,
- children: childrenProp,
- ...restProps
- }: FormPrimitive.FieldProps<T, U> &
- WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
+ let { ref = $bindable(null), class: className, form, name, children: childrenProp, ...restProps }: FormPrimitive.FieldProps<T, U> & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
</script>
<FormPrimitive.Field {form} {name}>
diff --git a/frontend/src/lib/components/ui/form/form-fieldset.svelte b/frontend/src/lib/components/ui/form/form-fieldset.svelte
index 02d0ab5ac..568aeefc3 100644
--- a/frontend/src/lib/components/ui/form/form-fieldset.svelte
+++ b/frontend/src/lib/components/ui/form/form-fieldset.svelte
@@ -9,13 +9,7 @@
import type { WithoutChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- form,
- name,
- ...restProps
- }: WithoutChild<FormPrimitive.FieldsetProps<T, U>> = $props();
+ let { ref = $bindable(null), class: className, form, name, ...restProps }: WithoutChild<FormPrimitive.FieldsetProps<T, U>> = $props();
</script>
<FormPrimitive.Fieldset bind:ref {form} {name} class={cn('space-y-2', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/form/form-label.svelte b/frontend/src/lib/components/ui/form/form-label.svelte
index f0e4f84bc..894edd94e 100644
--- a/frontend/src/lib/components/ui/form/form-label.svelte
+++ b/frontend/src/lib/components/ui/form/form-label.svelte
@@ -4,12 +4,7 @@
import { Label } from '$lib/components/ui/label/index.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- children,
- class: className,
- ...restProps
- }: WithoutChild<FormPrimitive.LabelProps> = $props();
+ let { ref = $bindable(null), children, class: className, ...restProps }: WithoutChild<FormPrimitive.LabelProps> = $props();
</script>
<FormPrimitive.Label {...restProps} bind:ref>
diff --git a/frontend/src/lib/components/ui/form/form-legend.svelte b/frontend/src/lib/components/ui/form/form-legend.svelte
index a8f48f7b4..fd7444241 100644
--- a/frontend/src/lib/components/ui/form/form-legend.svelte
+++ b/frontend/src/lib/components/ui/form/form-legend.svelte
@@ -3,15 +3,7 @@
import type { WithoutChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: WithoutChild<FormPrimitive.LegendProps> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: WithoutChild<FormPrimitive.LegendProps> = $props();
</script>
-<FormPrimitive.Legend
- bind:ref
- class={cn('data-fs-error:text-destructive text-sm leading-none font-medium', className)}
- {...restProps}
-/>
+<FormPrimitive.Legend bind:ref class={cn('data-fs-error:text-destructive text-sm leading-none font-medium', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/input/input.svelte b/frontend/src/lib/components/ui/input/input.svelte
index 77a507a5d..18fae946c 100644
--- a/frontend/src/lib/components/ui/input/input.svelte
+++ b/frontend/src/lib/components/ui/input/input.svelte
@@ -4,19 +4,9 @@
type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
- type Props = WithElementRef<
- Omit<HTMLInputAttributes, 'type'> &
- ({ type: 'file'; files?: FileList } | { type?: InputType; files?: undefined })
- >;
+ type Props = WithElementRef<Omit<HTMLInputAttributes, 'type'> & ({ type: 'file'; files?: FileList } | { type?: InputType; files?: undefined })>;
- let {
- ref = $bindable(null),
- value = $bindable(),
- type,
- files = $bindable(),
- class: className,
- ...restProps
- }: Props = $props();
+ let { ref = $bindable(null), value = $bindable(), type, files = $bindable(), class: className, ...restProps }: Props = $props();
</script>
{#if type === 'file'}
diff --git a/frontend/src/lib/components/ui/label/label.svelte b/frontend/src/lib/components/ui/label/label.svelte
index dc852687a..a1a513484 100644
--- a/frontend/src/lib/components/ui/label/label.svelte
+++ b/frontend/src/lib/components/ui/label/label.svelte
@@ -2,18 +2,7 @@
import { Label as LabelPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: LabelPrimitive.RootProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: LabelPrimitive.RootProps = $props();
</script>
-<LabelPrimitive.Root
- bind:ref
- class={cn(
- 'text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
- className
- )}
- {...restProps}
-/>
+<LabelPrimitive.Root bind:ref class={cn('text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/pagination/pagination-content.svelte b/frontend/src/lib/components/ui/pagination/pagination-content.svelte
index 62e5cca6e..e2a771ecc 100644
--- a/frontend/src/lib/components/ui/pagination/pagination-content.svelte
+++ b/frontend/src/lib/components/ui/pagination/pagination-content.svelte
@@ -3,12 +3,7 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLUListElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLUListElement>> = $props();
</script>
<ul bind:this={ref} class={cn('flex flex-row items-center gap-1', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/pagination/pagination-ellipsis.svelte b/frontend/src/lib/components/ui/pagination/pagination-ellipsis.svelte
index f680e6507..4a4af71c1 100644
--- a/frontend/src/lib/components/ui/pagination/pagination-ellipsis.svelte
+++ b/frontend/src/lib/components/ui/pagination/pagination-ellipsis.svelte
@@ -4,19 +4,10 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
</script>
-<span
- bind:this={ref}
- aria-hidden="true"
- class={cn('flex size-9 items-center justify-center', className)}
- {...restProps}
->
+<span bind:this={ref} aria-hidden="true" class={cn('flex size-9 items-center justify-center', className)} {...restProps}>
<Ellipsis class="size-4" />
<span class="sr-only">More pages</span>
</span>
diff --git a/frontend/src/lib/components/ui/pagination/pagination-item.svelte b/frontend/src/lib/components/ui/pagination/pagination-item.svelte
index 803fb7ddf..4848ebebc 100644
--- a/frontend/src/lib/components/ui/pagination/pagination-item.svelte
+++ b/frontend/src/lib/components/ui/pagination/pagination-item.svelte
@@ -2,11 +2,7 @@
import type { HTMLLiAttributes } from 'svelte/elements';
import type { WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- children,
- ...restProps
- }: WithElementRef<HTMLLiAttributes> = $props();
+ let { ref = $bindable(null), children, ...restProps }: WithElementRef<HTMLLiAttributes> = $props();
</script>
<li bind:this={ref} {...restProps}>
diff --git a/frontend/src/lib/components/ui/pagination/pagination-next-button.svelte b/frontend/src/lib/components/ui/pagination/pagination-next-button.svelte
index 4b07cbcdb..2dfb2f966 100644
--- a/frontend/src/lib/components/ui/pagination/pagination-next-button.svelte
+++ b/frontend/src/lib/components/ui/pagination/pagination-next-button.svelte
@@ -4,12 +4,7 @@
import { buttonVariants } from '$lib/components/ui/button/index.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: PaginationPrimitive.NextButtonProps = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: PaginationPrimitive.NextButtonProps = $props();
</script>
{#snippet Fallback()}
diff --git a/frontend/src/lib/components/ui/pagination/pagination-prev-button.svelte b/frontend/src/lib/components/ui/pagination/pagination-prev-button.svelte
index 3aabbd71e..ffa8c6fc3 100644
--- a/frontend/src/lib/components/ui/pagination/pagination-prev-button.svelte
+++ b/frontend/src/lib/components/ui/pagination/pagination-prev-button.svelte
@@ -4,12 +4,7 @@
import { buttonVariants } from '$lib/components/ui/button/index.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: PaginationPrimitive.PrevButtonProps = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: PaginationPrimitive.PrevButtonProps = $props();
</script>
{#snippet Fallback()}
diff --git a/frontend/src/lib/components/ui/pagination/pagination.svelte b/frontend/src/lib/components/ui/pagination/pagination.svelte
index dde9bd332..c0eda3e6c 100644
--- a/frontend/src/lib/components/ui/pagination/pagination.svelte
+++ b/frontend/src/lib/components/ui/pagination/pagination.svelte
@@ -3,23 +3,7 @@
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- count = 0,
- perPage = 10,
- page = $bindable(1),
- siblingCount = 1,
- ...restProps
- }: PaginationPrimitive.RootProps = $props();
+ let { ref = $bindable(null), class: className, count = 0, perPage = 10, page = $bindable(1), siblingCount = 1, ...restProps }: PaginationPrimitive.RootProps = $props();
</script>
-<PaginationPrimitive.Root
- bind:ref
- class={cn('mx-auto flex w-full flex-col items-center', className)}
- {count}
- {perPage}
- {siblingCount}
- bind:page
- {...restProps}
-/>
+<PaginationPrimitive.Root bind:ref class={cn('mx-auto flex w-full flex-col items-center', className)} {count} {perPage} {siblingCount} bind:page {...restProps} />
diff --git a/frontend/src/lib/components/ui/progress/progress.svelte b/frontend/src/lib/components/ui/progress/progress.svelte
index 9440050d1..79303786a 100644
--- a/frontend/src/lib/components/ui/progress/progress.svelte
+++ b/frontend/src/lib/components/ui/progress/progress.svelte
@@ -2,24 +2,9 @@
import { Progress as ProgressPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- max = 100,
- value,
- ...restProps
- }: WithoutChildrenOrChild<ProgressPrimitive.RootProps> = $props();
+ let { ref = $bindable(null), class: className, max = 100, value, ...restProps }: WithoutChildrenOrChild<ProgressPrimitive.RootProps> = $props();
</script>
-<ProgressPrimitive.Root
- bind:ref
- class={cn('bg-secondary relative h-4 w-full overflow-hidden rounded-full', className)}
- {value}
- {max}
- {...restProps}
->
- <div
- class="bg-primary h-full w-full flex-1 transition-all"
- style={`transform: translateX(-${100 - (100 * (value ?? 0)) / (max ?? 1)}%)`}
- ></div>
+<ProgressPrimitive.Root bind:ref class={cn('bg-secondary relative h-4 w-full overflow-hidden rounded-full', className)} {value} {max} {...restProps}>
+ <div class="bg-primary h-full w-full flex-1 transition-all" style={`transform: translateX(-${100 - (100 * (value ?? 0)) / (max ?? 1)}%)`}></div>
</ProgressPrimitive.Root>
diff --git a/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte b/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte
index e557a24a6..65ac11420 100644
--- a/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte
+++ b/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte
@@ -3,19 +3,12 @@
import Circle from '@lucide/svelte/icons/circle';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> = $props();
</script>
<RadioGroupPrimitive.Item
bind:ref
- class={cn(
- 'border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square size-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
- className
- )}
+ class={cn('border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square size-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', className)}
{...restProps}
>
{#snippet children({ checked })}
diff --git a/frontend/src/lib/components/ui/radio-group/radio-group.svelte b/frontend/src/lib/components/ui/radio-group/radio-group.svelte
index 73cd7afed..89b1d2cac 100644
--- a/frontend/src/lib/components/ui/radio-group/radio-group.svelte
+++ b/frontend/src/lib/components/ui/radio-group/radio-group.svelte
@@ -2,12 +2,7 @@
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- value = $bindable(''),
- ...restProps
- }: RadioGroupPrimitive.RootProps = $props();
+ let { ref = $bindable(null), class: className, value = $bindable(''), ...restProps }: RadioGroupPrimitive.RootProps = $props();
</script>
<RadioGroupPrimitive.Root bind:ref bind:value class={cn('grid gap-2', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte b/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte
index c706d3299..40c49e99e 100644
--- a/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte
+++ b/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte
@@ -12,9 +12,4 @@
} = $props();
</script>
-<ResizablePrimitive.PaneGroup
- bind:this={paneGroup}
- data-slot="resizable-pane-group"
- class={cn('flex h-full w-full data-[direction=vertical]:flex-col', className)}
- {...restProps}
-/>
+<ResizablePrimitive.PaneGroup bind:this={paneGroup} data-slot="resizable-pane-group" class={cn('flex h-full w-full data-[direction=vertical]:flex-col', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/select/select-content.svelte b/frontend/src/lib/components/ui/select/select-content.svelte
index 65ec5deb7..796c425b5 100644
--- a/frontend/src/lib/components/ui/select/select-content.svelte
+++ b/frontend/src/lib/components/ui/select/select-content.svelte
@@ -27,9 +27,7 @@
{...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) w-full min-w-(--bits-select-anchor-width) 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 b0d5e0458..32b9ec92f 100644
--- a/frontend/src/lib/components/ui/select/select-group-heading.svelte
+++ b/frontend/src/lib/components/ui/select/select-group-heading.svelte
@@ -2,15 +2,7 @@
import { Select as SelectPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: SelectPrimitive.GroupHeadingProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: SelectPrimitive.GroupHeadingProps = $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 class={cn('py-1.5 pr-2 pl-8 text-sm font-semibold', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/select/select-item.svelte b/frontend/src/lib/components/ui/select/select-item.svelte
index a26718f4c..f72954447 100644
--- a/frontend/src/lib/components/ui/select/select-item.svelte
+++ b/frontend/src/lib/components/ui/select/select-item.svelte
@@ -3,23 +3,13 @@
import { Select as SelectPrimitive, type WithoutChild } from 'bits-ui';
import { cn } 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
- )}
+ 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)}
{...restProps}
>
{#snippet children({ selected, highlighted })}
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 b3fc67453..aaabf723c 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
@@ -3,17 +3,9 @@
import { Select as SelectPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
import { cn } 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}
->
+<SelectPrimitive.ScrollDownButton bind:ref class={cn('flex cursor-default items-center justify-center py-1', className)} {...restProps}>
<ChevronDown 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 dbe8fd637..567ef3cf3 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
@@ -3,17 +3,9 @@
import { Select as SelectPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
import { cn } 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}
->
+<SelectPrimitive.ScrollUpButton bind:ref class={cn('flex cursor-default items-center justify-center py-1', className)} {...restProps}>
<ChevronUp 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 281e9ddb9..b5d11e5b8 100644
--- a/frontend/src/lib/components/ui/select/select-separator.svelte
+++ b/frontend/src/lib/components/ui/select/select-separator.svelte
@@ -3,11 +3,7 @@
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} />
diff --git a/frontend/src/lib/components/ui/select/select-trigger.svelte b/frontend/src/lib/components/ui/select/select-trigger.svelte
index b1307add3..7cf61c7fb 100644
--- a/frontend/src/lib/components/ui/select/select-trigger.svelte
+++ b/frontend/src/lib/components/ui/select/select-trigger.svelte
@@ -3,12 +3,7 @@
import ChevronDown from '@lucide/svelte/icons/chevron-down';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithoutChild<SelectPrimitive.TriggerProps> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithoutChild<SelectPrimitive.TriggerProps> = $props();
</script>
<SelectPrimitive.Trigger
diff --git a/frontend/src/lib/components/ui/separator/separator.svelte b/frontend/src/lib/components/ui/separator/separator.svelte
index 5466f0ef2..4ce9e4c13 100644
--- a/frontend/src/lib/components/ui/separator/separator.svelte
+++ b/frontend/src/lib/components/ui/separator/separator.svelte
@@ -2,19 +2,7 @@
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-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} />
diff --git a/frontend/src/lib/components/ui/sheet/sheet-content.svelte b/frontend/src/lib/components/ui/sheet/sheet-content.svelte
index ba4228df4..7bc223569 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-content.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-content.svelte
@@ -5,11 +5,9 @@
variants: {
side: {
top: 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
- bottom:
- 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
+ bottom: 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
left: 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
- right:
- 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm'
+ right: 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm'
}
},
defaultVariants: {
@@ -43,16 +41,9 @@
<SheetPrimitive.Portal {...portalProps}>
<SheetOverlay />
- <SheetPrimitive.Content
- bind:ref
- data-slot="sheet-content"
- class={cn(sheetVariants({ side }), className)}
- {...restProps}
- >
+ <SheetPrimitive.Content bind:ref data-slot="sheet-content" class={cn(sheetVariants({ side }), className)} {...restProps}>
{@render children?.()}
- <SheetPrimitive.Close
- class="ring-offset-background focus-visible:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none"
- >
+ <SheetPrimitive.Close class="ring-offset-background focus-visible:ring-ring rounded-xs focus-visible:outline-hidden absolute right-4 top-4 opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none">
<XIcon class="size-4" />
<span class="sr-only">Close</span>
</SheetPrimitive.Close>
diff --git a/frontend/src/lib/components/ui/sheet/sheet-description.svelte b/frontend/src/lib/components/ui/sheet/sheet-description.svelte
index 996c1026e..a50501d24 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-description.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-description.svelte
@@ -2,16 +2,7 @@
import { Dialog as SheetPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: SheetPrimitive.DescriptionProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: SheetPrimitive.DescriptionProps = $props();
</script>
-<SheetPrimitive.Description
- bind:ref
- data-slot="sheet-description"
- class={cn('text-muted-foreground text-sm', className)}
- {...restProps}
-/>
+<SheetPrimitive.Description bind:ref data-slot="sheet-description" class={cn('text-muted-foreground text-sm', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/sheet/sheet-footer.svelte b/frontend/src/lib/components/ui/sheet/sheet-footer.svelte
index aea83f781..4830e4ea5 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-footer.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-footer.svelte
@@ -2,19 +2,9 @@
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();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sheet-footer"
- class={cn('mt-auto flex flex-col gap-2 p-4', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sheet-footer" class={cn('mt-auto flex flex-col gap-2 p-4', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sheet/sheet-header.svelte b/frontend/src/lib/components/ui/sheet/sheet-header.svelte
index 00cd281d3..36fbe9278 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-header.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-header.svelte
@@ -2,19 +2,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn, type WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sheet-header"
- class={cn('flex flex-col gap-1.5 p-4', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sheet-header" class={cn('flex flex-col gap-1.5 p-4', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sheet/sheet-overlay.svelte b/frontend/src/lib/components/ui/sheet/sheet-overlay.svelte
index f0a689d7e..b67bae81d 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-overlay.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-overlay.svelte
@@ -2,21 +2,7 @@
import { Dialog as SheetPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: SheetPrimitive.OverlayProps = $props();
-
- export { className as class };
+ let { ref = $bindable(null), class: className, ...restProps }: SheetPrimitive.OverlayProps = $props();
</script>
-<SheetPrimitive.Overlay
- bind:ref
- data-slot="sheet-overlay"
- class={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
- className
- )}
- {...restProps}
-/>
+<SheetPrimitive.Overlay bind:ref data-slot="sheet-overlay" class={cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/sheet/sheet-title.svelte b/frontend/src/lib/components/ui/sheet/sheet-title.svelte
index 34081c928..f9d1936ec 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-title.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-title.svelte
@@ -2,16 +2,7 @@
import { Dialog as SheetPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: SheetPrimitive.TitleProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: SheetPrimitive.TitleProps = $props();
</script>
-<SheetPrimitive.Title
- bind:ref
- data-slot="sheet-title"
- class={cn('text-foreground font-semibold', className)}
- {...restProps}
-/>
+<SheetPrimitive.Title bind:ref data-slot="sheet-title" class={cn('text-foreground font-semibold', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte
index f1d195ef6..66a1e751a 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte
@@ -2,23 +2,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn, type WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sidebar-content"
- data-sidebar="content"
- class={cn(
- 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
- className
- )}
- {...restProps}
->
+<div bind:this={ref} data-slot="sidebar-content" data-sidebar="content" class={cn('flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-footer.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-footer.svelte
index 24d67f66f..4b29494c6 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-footer.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-footer.svelte
@@ -2,20 +2,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn, type WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sidebar-footer"
- data-sidebar="footer"
- class={cn('flex flex-col gap-2 p-2', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sidebar-footer" data-sidebar="footer" class={cn('flex flex-col gap-2 p-2', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-group-content.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-group-content.svelte
index fafaceefe..9cc74a5f7 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-group-content.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-group-content.svelte
@@ -2,20 +2,9 @@
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();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sidebar-group-content"
- data-sidebar="group-content"
- class={cn('w-full text-sm', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sidebar-group-content" data-sidebar="group-content" class={cn('w-full text-sm', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-group.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-group.svelte
index 897445de9..87340bde0 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-group.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-group.svelte
@@ -2,20 +2,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn, type WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sidebar-group"
- data-sidebar="group"
- class={cn('relative flex w-full min-w-0 flex-col p-2', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sidebar-group" data-sidebar="group" class={cn('relative flex w-full min-w-0 flex-col p-2', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-header.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-header.svelte
index a54647464..c06115f98 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-header.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-header.svelte
@@ -2,20 +2,9 @@
import type { HTMLAttributes } from 'svelte/elements';
import { cn, type WithElementRef } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="sidebar-header"
- data-sidebar="header"
- class={cn('flex flex-col gap-2 p-2', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sidebar-header" data-sidebar="header" class={cn('flex flex-col gap-2 p-2', className)} {...restProps}>
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-input.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-input.svelte
index 9ed0aa89d..7f466a352 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-input.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-input.svelte
@@ -3,19 +3,7 @@
import { Input } from '$lib/components/ui/input/index.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- value = $bindable(''),
- class: className,
- ...restProps
- }: ComponentProps<typeof Input> = $props();
+ let { ref = $bindable(null), value = $bindable(''), class: className, ...restProps }: ComponentProps<typeof Input> = $props();
</script>
-<Input
- bind:ref
- bind:value
- data-slot="sidebar-input"
- data-sidebar="input"
- class={cn('bg-background h-8 w-full shadow-none', className)}
- {...restProps}
-/>
+<Input bind:ref bind:value data-slot="sidebar-input" data-sidebar="input" class={cn('bg-background h-8 w-full shadow-none', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-inset.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-inset.svelte
index 05842bc1b..07a864304 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-inset.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-inset.svelte
@@ -2,22 +2,13 @@
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
<main
bind:this={ref}
data-slot="sidebar-inset"
- class={cn(
- 'bg-background relative flex w-full flex-1 flex-col',
- 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
- className
- )}
+ class={cn('bg-background relative flex w-full flex-1 flex-col', 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2', className)}
{...restProps}
>
{@render children?.()}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte
index 3f178c8f5..d5ca1fa10 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte
@@ -24,8 +24,7 @@
'peer-data-[size=default]/menu-button:top-1.5',
'peer-data-[size=lg]/menu-button:top-2.5',
'group-data-[collapsible=icon]:hidden',
- showOnHover &&
- 'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
+ showOnHover && 'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
className
),
'data-slot': 'sidebar-menu-action',
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte
index a9ebc18a0..fa867a460 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte
@@ -2,12 +2,7 @@
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
<div
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
index c358b7082..b5cb48518 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-button.svelte
@@ -6,8 +6,7 @@
variants: {
variant: {
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
- outline:
- 'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:shadow-[0_0_0_1px_var(--sidebar-accent)]'
+ outline: 'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:shadow-[0_0_0_1px_var(--sidebar-accent)]'
},
size: {
default: 'h-8 text-sm',
@@ -85,12 +84,7 @@
{@render Button({ props })}
{/snippet}
</Tooltip.Trigger>
- <Tooltip.Content
- side="right"
- align="center"
- hidden={sidebar.state !== 'collapsed' || sidebar.isMobile}
- {...tooltipContentProps}
- >
+ <Tooltip.Content side="right" align="center" hidden={sidebar.state !== 'collapsed' || sidebar.isMobile} {...tooltipContentProps}>
{#if typeof tooltipContent === 'string'}
{tooltipContent}
{:else if tooltipContent}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-item.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-item.svelte
index acd286066..f7e40bbcb 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-item.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-item.svelte
@@ -2,20 +2,9 @@
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLLIElement>, HTMLLIElement> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLLIElement>, HTMLLIElement> = $props();
</script>
-<li
- bind:this={ref}
- data-slot="sidebar-menu-item"
- data-sidebar="menu-item"
- class={cn('group/menu-item relative', className)}
- {...restProps}
->
+<li bind:this={ref} data-slot="sidebar-menu-item" data-sidebar="menu-item" class={cn('group/menu-item relative', className)} {...restProps}>
{@render children?.()}
</li>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte
index 49a18f127..5caa40fce 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte
@@ -17,20 +17,10 @@
const width = `${Math.floor(Math.random() * 40) + 50}%`;
</script>
-<div
- bind:this={ref}
- data-slot="sidebar-menu-skeleton"
- data-sidebar="menu-skeleton"
- class={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
- {...restProps}
->
+<div bind:this={ref} data-slot="sidebar-menu-skeleton" data-sidebar="menu-skeleton" class={cn('flex h-8 items-center gap-2 rounded-md px-2', className)} {...restProps}>
{#if showIcon}
<Skeleton class="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />
{/if}
- <Skeleton
- class="h-4 max-w-(--skeleton-width) flex-1"
- data-sidebar="menu-skeleton-text"
- style="--skeleton-width: {width};"
- />
+ <Skeleton class="h-4 max-w-(--skeleton-width) flex-1" data-sidebar="menu-skeleton-text" style="--skeleton-width: {width};" />
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte
index 4274f0e09..eba55e3f8 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte
@@ -2,20 +2,9 @@
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- children,
- class: className,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLLIElement>> = $props();
+ let { ref = $bindable(null), children, class: className, ...restProps }: WithElementRef<HTMLAttributes<HTMLLIElement>> = $props();
</script>
-<li
- bind:this={ref}
- data-slot="sidebar-menu-sub-item"
- data-sidebar="menu-sub-item"
- class={cn('group/menu-sub-item relative', className)}
- {...restProps}
->
+<li bind:this={ref} data-slot="sidebar-menu-sub-item" data-sidebar="menu-sub-item" class={cn('group/menu-sub-item relative', className)} {...restProps}>
{@render children?.()}
</li>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte
index 620ea999c..042e520b5 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte
@@ -2,24 +2,9 @@
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLUListElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLUListElement>> = $props();
</script>
-<ul
- bind:this={ref}
- data-slot="sidebar-menu-sub"
- data-sidebar="menu-sub"
- class={cn(
- 'border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5',
- 'group-data-[collapsible=icon]:hidden',
- className
- )}
- {...restProps}
->
+<ul bind:this={ref} data-slot="sidebar-menu-sub" data-sidebar="menu-sub" class={cn('border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5', 'group-data-[collapsible=icon]:hidden', className)} {...restProps}>
{@render children?.()}
</ul>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu.svelte
index 094f0f07b..8c6405237 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu.svelte
@@ -2,20 +2,9 @@
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLUListElement>, HTMLUListElement> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLUListElement>, HTMLUListElement> = $props();
</script>
-<ul
- bind:this={ref}
- data-slot="sidebar-menu"
- data-sidebar="menu"
- class={cn('flex w-full min-w-0 flex-col gap-1', className)}
- {...restProps}
->
+<ul bind:this={ref} data-slot="sidebar-menu" data-sidebar="menu" class={cn('flex w-full min-w-0 flex-col gap-1', className)} {...restProps}>
{@render children?.()}
</ul>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
index 02f130735..59bbae4ed 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
@@ -2,12 +2,7 @@
import * as Tooltip from '$lib/components/ui/tooltip/index.js';
import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- import {
- SIDEBAR_COOKIE_MAX_AGE,
- SIDEBAR_COOKIE_NAME,
- SIDEBAR_WIDTH,
- SIDEBAR_WIDTH_ICON
- } from './constants.js';
+ import { SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON } from './constants.js';
import { setSidebar } from './context.svelte.js';
let {
@@ -38,16 +33,7 @@
<svelte:window onkeydown={sidebar.handleShortcutKeydown} />
<Tooltip.Provider delayDuration={0}>
- <div
- data-slot="sidebar-wrapper"
- style="--sidebar-width: {SIDEBAR_WIDTH}; --sidebar-width-icon: {SIDEBAR_WIDTH_ICON}; {style}"
- class={cn(
- 'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
- className
- )}
- bind:this={ref}
- {...restProps}
- >
+ <div data-slot="sidebar-wrapper" style="--sidebar-width: {SIDEBAR_WIDTH}; --sidebar-width-icon: {SIDEBAR_WIDTH_ICON}; {style}" class={cn('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className)} bind:this={ref} {...restProps}>
{@render children?.()}
</div>
</Tooltip.Provider>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte
index 220f62e5b..8297411a4 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte
@@ -3,12 +3,7 @@
import type { HTMLAttributes } from 'svelte/elements';
import { useSidebar } from './context.svelte.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> = $props();
const sidebar = useSidebar();
</script>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-separator.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-separator.svelte
index 2fbe5228a..d51e89fa0 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-separator.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-separator.svelte
@@ -3,17 +3,7 @@
import { cn } from '$lib/utils.js';
import type { ComponentProps } from 'svelte';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: ComponentProps<typeof Separator> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: ComponentProps<typeof Separator> = $props();
</script>
-<Separator
- bind:ref
- data-slot="sidebar-separator"
- data-sidebar="separator"
- class={cn('bg-sidebar-border mx-2 w-auto', className)}
- {...restProps}
-/>
+<Separator bind:ref data-slot="sidebar-separator" data-sidebar="separator" class={cn('bg-sidebar-border mx-2 w-auto', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar.svelte b/frontend/src/lib/components/ui/sidebar/sidebar.svelte
index f7e65250e..3a67584a1 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar.svelte
@@ -23,26 +23,12 @@
</script>
{#if collapsible === 'none'}
- <div
- class={cn(
- 'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col',
- className
- )}
- bind:this={ref}
- {...restProps}
- >
+ <div class={cn('bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col', className)} bind:this={ref} {...restProps}>
{@render children?.()}
</div>
{:else if sidebar.isMobile}
<Sheet.Root bind:open={() => sidebar.openMobile, (v) => sidebar.setOpenMobile(v)} {...restProps}>
- <Sheet.Content
- data-sidebar="sidebar"
- data-slot="sidebar"
- data-mobile="true"
- class="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
- style="--sidebar-width: {SIDEBAR_WIDTH_MOBILE};"
- {side}
- >
+ <Sheet.Content data-sidebar="sidebar" data-slot="sidebar" data-mobile="true" class="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden" style="--sidebar-width: {SIDEBAR_WIDTH_MOBILE};" {side}>
<Sheet.Header class="sr-only">
<Sheet.Title>Sidebar</Sheet.Title>
<Sheet.Description>Displays the mobile sidebar.</Sheet.Description>
@@ -53,15 +39,7 @@
</Sheet.Content>
</Sheet.Root>
{:else}
- <div
- bind:this={ref}
- class="text-sidebar-foreground group peer hidden md:block"
- data-state={sidebar.state}
- data-collapsible={sidebar.state === 'collapsed' ? collapsible : ''}
- data-variant={variant}
- data-side={side}
- data-slot="sidebar"
- >
+ <div bind:this={ref} class="text-sidebar-foreground group peer hidden md:block" data-state={sidebar.state} data-collapsible={sidebar.state === 'collapsed' ? collapsible : ''} data-variant={variant} data-side={side} data-slot="sidebar">
<!-- This is what handles the sidebar gap on desktop -->
<div
data-slot="sidebar-gap"
@@ -69,31 +47,21 @@
'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
'group-data-[collapsible=offcanvas]:w-0',
'group-data-[side=right]:rotate-180',
- variant === 'floating' || variant === 'inset'
- ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
- : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'
+ variant === 'floating' || variant === 'inset' ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]' : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'
)}
></div>
<div
data-slot="sidebar-container"
class={cn(
'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
- side === 'left'
- ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
- : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
+ side === 'left' ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]' : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
// Adjust the padding for floating and inset variants.
- variant === 'floating' || variant === 'inset'
- ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
- : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
+ variant === 'floating' || variant === 'inset' ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]' : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
className
)}
{...restProps}
>
- <div
- data-sidebar="sidebar"
- data-slot="sidebar-inner"
- class="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
- >
+ <div data-sidebar="sidebar" data-slot="sidebar-inner" class="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm">
{@render children?.()}
</div>
</div>
diff --git a/frontend/src/lib/components/ui/skeleton/skeleton.svelte b/frontend/src/lib/components/ui/skeleton/skeleton.svelte
index 35b857731..bf80ff70c 100644
--- a/frontend/src/lib/components/ui/skeleton/skeleton.svelte
+++ b/frontend/src/lib/components/ui/skeleton/skeleton.svelte
@@ -2,16 +2,7 @@
import { cn, type WithElementRef, type WithoutChildren } from '$lib/utils.js';
import type { HTMLAttributes } from 'svelte/elements';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
</script>
-<div
- bind:this={ref}
- data-slot="skeleton"
- class={cn('bg-accent animate-pulse rounded-md', className)}
- {...restProps}
-></div>
+<div bind:this={ref} data-slot="skeleton" class={cn('bg-accent animate-pulse rounded-md', className)} {...restProps}></div>
diff --git a/frontend/src/lib/components/ui/sonner/sonner.svelte b/frontend/src/lib/components/ui/sonner/sonner.svelte
index f6360abac..d650006e2 100644
--- a/frontend/src/lib/components/ui/sonner/sonner.svelte
+++ b/frontend/src/lib/components/ui/sonner/sonner.svelte
@@ -10,8 +10,7 @@
class="toaster group"
toastOptions={{
classes: {
- toast:
- 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
+ toast: 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
description: 'group-[.toast]:text-muted-foreground',
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground'
diff --git a/frontend/src/lib/components/ui/switch/switch.svelte b/frontend/src/lib/components/ui/switch/switch.svelte
index 5681d5fb7..63f10b27a 100644
--- a/frontend/src/lib/components/ui/switch/switch.svelte
+++ b/frontend/src/lib/components/ui/switch/switch.svelte
@@ -2,12 +2,7 @@
import { Switch as SwitchPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- checked = $bindable(false),
- ...restProps
- }: WithoutChildrenOrChild<SwitchPrimitive.RootProps> = $props();
+ let { ref = $bindable(null), class: className, checked = $bindable(false), ...restProps }: WithoutChildrenOrChild<SwitchPrimitive.RootProps> = $props();
</script>
<SwitchPrimitive.Root
@@ -19,9 +14,5 @@
)}
{...restProps}
>
- <SwitchPrimitive.Thumb
- class={cn(
- 'bg-background pointer-events-none block size-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0'
- )}
- />
+ <SwitchPrimitive.Thumb class={cn('bg-background pointer-events-none block size-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0')} />
</SwitchPrimitive.Root>
diff --git a/frontend/src/lib/components/ui/table/table-body.svelte b/frontend/src/lib/components/ui/table/table-body.svelte
index b6121e3d5..0fa52ef02 100644
--- a/frontend/src/lib/components/ui/table/table-body.svelte
+++ b/frontend/src/lib/components/ui/table/table-body.svelte
@@ -3,12 +3,7 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
</script>
<tbody bind:this={ref} class={cn('[&_tr:last-child]:border-0', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/table/table-caption.svelte b/frontend/src/lib/components/ui/table/table-caption.svelte
index 61ca268fe..3faa8c7c2 100644
--- a/frontend/src/lib/components/ui/table/table-caption.svelte
+++ b/frontend/src/lib/components/ui/table/table-caption.svelte
@@ -3,12 +3,7 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script>
<caption bind:this={ref} class={cn('text-muted-foreground mt-4 text-sm', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/table/table-cell.svelte b/frontend/src/lib/components/ui/table/table-cell.svelte
index 207308987..45a0afaaa 100644
--- a/frontend/src/lib/components/ui/table/table-cell.svelte
+++ b/frontend/src/lib/components/ui/table/table-cell.svelte
@@ -3,21 +3,9 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLTdAttributes> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLTdAttributes> = $props();
</script>
-<td
- bind:this={ref}
- class={cn(
- 'truncate overflow-hidden p-4 align-middle text-ellipsis whitespace-nowrap [&:has([role=checkbox])]:pr-0',
- className
- )}
- {...restProps}
->
+<td bind:this={ref} class={cn('truncate overflow-hidden p-4 align-middle text-ellipsis whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)} {...restProps}>
{@render children?.()}
</td>
diff --git a/frontend/src/lib/components/ui/table/table-footer.svelte b/frontend/src/lib/components/ui/table/table-footer.svelte
index ba3f51268..b3ec796c1 100644
--- a/frontend/src/lib/components/ui/table/table-footer.svelte
+++ b/frontend/src/lib/components/ui/table/table-footer.svelte
@@ -3,12 +3,7 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
</script>
<tfoot bind:this={ref} class={cn('bg-muted/50 font-medium', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/table/table-head.svelte b/frontend/src/lib/components/ui/table/table-head.svelte
index af59e3f89..0c65d65fd 100644
--- a/frontend/src/lib/components/ui/table/table-head.svelte
+++ b/frontend/src/lib/components/ui/table/table-head.svelte
@@ -3,21 +3,9 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLThAttributes> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLThAttributes> = $props();
</script>
-<th
- bind:this={ref}
- class={cn(
- 'text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0',
- className
- )}
- {...restProps}
->
+<th bind:this={ref} class={cn('text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0', className)} {...restProps}>
{@render children?.()}
</th>
diff --git a/frontend/src/lib/components/ui/table/table-header.svelte b/frontend/src/lib/components/ui/table/table-header.svelte
index 95a2722a4..fa8eaaf81 100644
--- a/frontend/src/lib/components/ui/table/table-header.svelte
+++ b/frontend/src/lib/components/ui/table/table-header.svelte
@@ -3,12 +3,7 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
</script>
<thead bind:this={ref} class={cn('[&_tr]:border-b', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/table/table-row.svelte b/frontend/src/lib/components/ui/table/table-row.svelte
index dec3a0e41..7358f0928 100644
--- a/frontend/src/lib/components/ui/table/table-row.svelte
+++ b/frontend/src/lib/components/ui/table/table-row.svelte
@@ -3,21 +3,9 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLAttributes<HTMLTableRowElement>> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLTableRowElement>> = $props();
</script>
-<tr
- bind:this={ref}
- class={cn(
- 'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
- className
- )}
- {...restProps}
->
+<tr bind:this={ref} class={cn('hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors', className)} {...restProps}>
{@render children?.()}
</tr>
diff --git a/frontend/src/lib/components/ui/table/table.svelte b/frontend/src/lib/components/ui/table/table.svelte
index e558bd986..fa6fe0cbe 100644
--- a/frontend/src/lib/components/ui/table/table.svelte
+++ b/frontend/src/lib/components/ui/table/table.svelte
@@ -3,20 +3,11 @@
import type { WithElementRef } from '$lib/utils.js';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- children,
- ...restProps
- }: WithElementRef<HTMLTableAttributes> = $props();
+ let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLTableAttributes> = $props();
</script>
<div class="relative w-full overflow-auto">
- <table
- bind:this={ref}
- class={cn('w-full table-fixed caption-bottom text-sm', className)}
- {...restProps}
- >
+ <table bind:this={ref} class={cn('w-full table-fixed caption-bottom text-sm', className)} {...restProps}>
{@render children?.()}
</table>
</div>
diff --git a/frontend/src/lib/components/ui/tabs/tabs-content.svelte b/frontend/src/lib/components/ui/tabs/tabs-content.svelte
index 9ef588fb9..4ca82d2dd 100644
--- a/frontend/src/lib/components/ui/tabs/tabs-content.svelte
+++ b/frontend/src/lib/components/ui/tabs/tabs-content.svelte
@@ -2,18 +2,7 @@
import { Tabs as TabsPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: TabsPrimitive.ContentProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: TabsPrimitive.ContentProps = $props();
</script>
-<TabsPrimitive.Content
- bind:ref
- class={cn(
- 'ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none',
- className
- )}
- {...restProps}
-/>
+<TabsPrimitive.Content bind:ref class={cn('ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/tabs/tabs-list.svelte b/frontend/src/lib/components/ui/tabs/tabs-list.svelte
index 22ef81369..23b706fdd 100644
--- a/frontend/src/lib/components/ui/tabs/tabs-list.svelte
+++ b/frontend/src/lib/components/ui/tabs/tabs-list.svelte
@@ -5,11 +5,4 @@
let { ref = $bindable(null), class: className, ...restProps }: TabsPrimitive.ListProps = $props();
</script>
-<TabsPrimitive.List
- bind:ref
- class={cn(
- 'bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1',
- className
- )}
- {...restProps}
-/>
+<TabsPrimitive.List bind:ref class={cn('bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1', className)} {...restProps} />
diff --git a/frontend/src/lib/components/ui/tabs/tabs-trigger.svelte b/frontend/src/lib/components/ui/tabs/tabs-trigger.svelte
index bd53b330a..c6c1f105b 100644
--- a/frontend/src/lib/components/ui/tabs/tabs-trigger.svelte
+++ b/frontend/src/lib/components/ui/tabs/tabs-trigger.svelte
@@ -2,11 +2,7 @@
import { Tabs as TabsPrimitive } from 'bits-ui';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- class: className,
- ...restProps
- }: TabsPrimitive.TriggerProps = $props();
+ let { ref = $bindable(null), class: className, ...restProps }: TabsPrimitive.TriggerProps = $props();
</script>
<TabsPrimitive.Trigger
diff --git a/frontend/src/lib/components/ui/textarea/textarea.svelte b/frontend/src/lib/components/ui/textarea/textarea.svelte
index d226b65f6..620a54537 100644
--- a/frontend/src/lib/components/ui/textarea/textarea.svelte
+++ b/frontend/src/lib/components/ui/textarea/textarea.svelte
@@ -3,12 +3,7 @@
import type { HTMLTextareaAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- let {
- ref = $bindable(null),
- value = $bindable(),
- class: className,
- ...restProps
- }: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
+ let { ref = $bindable(null), value = $bindable(), class: className, ...restProps }: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
</script>
<textarea
diff --git a/frontend/src/lib/components/universal-table.svelte b/frontend/src/lib/components/universal-table.svelte
index b2afb9bc9..376e6e26d 100644
--- a/frontend/src/lib/components/universal-table.svelte
+++ b/frontend/src/lib/components/universal-table.svelte
@@ -1,12 +1,5 @@
<script lang="ts" generics="TData extends Record<string, any>">
- import {
- getCoreRowModel,
- getPaginationRowModel,
- getSortedRowModel,
- getFilteredRowModel,
- type SortingState,
- type ColumnFiltersState
- } from '@tanstack/table-core';
+ import { getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, type SortingState, type ColumnFiltersState } from '@tanstack/table-core';
import { createSvelteTable, FlexRender } from '$lib/components/ui/data-table/index.js';
import * as Table from '$lib/components/ui/table/index.js';
import * as Pagination from '$lib/components/ui/pagination/index.js';
@@ -20,7 +13,6 @@
import type { UniversalTableProps } from '$lib/types/table-types';
import type { Snippet } from 'svelte';
- // Better type constraints
interface TableData extends Record<string, any> {
isExternal?: boolean;
}
@@ -70,24 +62,11 @@
} = $props();
// Destructure with proper defaults
- const {
- sorting: enableSorting = true,
- filtering: enableFiltering = true,
- selection: enableSelection = true
- }: TableFeatures = features;
-
- const {
- pageSize: initialPageSize = 10,
- pageSizeOptions = [10, 20, 50, 100],
- itemsPerPageLabel = 'Items per page'
- }: TablePagination = pagination;
-
- const {
- filterPlaceholder = 'Search...',
- noResultsMessage = 'No results found',
- isDashboardTable = false,
- class: className = ''
- }: TableDisplay = display;
+ const { sorting: enableSorting = true, filtering: enableFiltering = true, selection: enableSelection = true }: TableFeatures = features;
+
+ const { pageSize: initialPageSize = 10, pageSizeOptions = [10, 20, 50, 100], itemsPerPageLabel = 'Items per page' }: TablePagination = pagination;
+
+ const { filterPlaceholder = 'Search...', noResultsMessage = 'No results found', isDashboardTable = false, class: className = '' }: TableDisplay = display;
const { defaultSort }: TableSort = sort;
@@ -202,19 +181,13 @@
});
// Memoized computations
- const validPageSizeOptions = $derived(
- pageSizeOptions.filter((size) => size > 0).sort((a, b) => a - b)
- );
+ const validPageSizeOptions = $derived(pageSizeOptions.filter((size) => size > 0).sort((a, b) => a - b));
- const shouldShowPagination = $derived(
- !isDashboardTable && (table.getPageCount() > 1 || validPageSizeOptions.length > 1)
- );
+ const shouldShowPagination = $derived(!isDashboardTable && (table.getPageCount() > 1 || validPageSizeOptions.length > 1));
const shouldShowFiltering = $derived(enableFiltering && !isDashboardTable);
- const allRowsSelected = $derived(
- table.getIsAllPageRowsSelected() && table.getRowModel().rows.length > 0
- );
+ const allRowsSelected = $derived(table.getIsAllPageRowsSelected() && table.getRowModel().rows.length > 0);
const filteredRowCount = $derived(table.getFilteredRowModel().rows.length);
@@ -256,12 +229,7 @@
<!-- Search Filter -->
{#if shouldShowFiltering}
<div class="flex items-center">
- <Input
- placeholder={filterPlaceholder}
- value={globalFilter}
- oninput={(e) => handleFilterChange(e.currentTarget.value)}
- class="max-w-sm"
- />
+ <Input placeholder={filterPlaceholder} value={globalFilter} oninput={(e) => handleFilterChange(e.currentTarget.value)} class="max-w-sm" />
</div>
{/if}
@@ -273,41 +241,21 @@
<Table.Row>
{#if enableSelection}
<Table.Head class="size-12">
- <Checkbox
- checked={allRowsSelected}
- onCheckedChange={handleSelectAllChange}
- aria-label="Select all rows"
- />
+ <Checkbox checked={allRowsSelected} onCheckedChange={handleSelectAllChange} aria-label="Select all rows" />
</Table.Head>
{/if}
{#each headerGroup.headers as header (header.id)}
<Table.Head>
{#if !header.isPlaceholder}
{#if header.column.getCanSort()}
- <Button
- variant="ghost"
- class="flex items-center p-0 hover:bg-transparent"
- onclick={() => handleSortChange(header)}
- aria-label="Sort by {header.column.columnDef.header}"
- >
- <FlexRender
- content={header.column.columnDef.header}
- context={header.getContext()}
- />
+ <Button variant="ghost" class="flex items-center p-0 hover:bg-transparent" onclick={() => handleSortChange(header)} aria-label="Sort by {header.column.columnDef.header}">
+ <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
{#if header.column.getIsSorted()}
- <ChevronDown
- class={cn(
- 'ml-2 size-4 transition-transform',
- header.column.getIsSorted() === 'asc' && 'rotate-180'
- )}
- />
+ <ChevronDown class={cn('ml-2 size-4 transition-transform', header.column.getIsSorted() === 'asc' && 'rotate-180')} />
{/if}
</Button>
{:else}
- <FlexRender
- content={header.column.columnDef.header}
- context={header.getContext()}
- />
+ <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
{/if}
{/if}
</Table.Head>
@@ -322,12 +270,7 @@
<Table.Row data-state={row.getIsSelected() ? 'selected' : undefined}>
{#if enableSelection}
<Table.Cell class="size-12">
- <Checkbox
- checked={row.getIsSelected()}
- disabled={isDisabled}
- onCheckedChange={(checked) => handleRowSelectionChange(row, !!checked)}
- aria-label="Select row"
- />
+ <Checkbox checked={row.getIsSelected()} disabled={isDisabled} onCheckedChange={(checked) => handleRowSelectionChange(row, !!checked)} aria-label="Select row" />
</Table.Cell>
{/if}
@@ -344,10 +287,7 @@
{/each}
{:else}
<Table.Row>
- <Table.Cell
- colspan={enableSelection ? columns.length + 1 : columns.length}
- class="size-24 text-center"
- >
+ <Table.Cell colspan={enableSelection ? columns.length + 1 : columns.length} class="size-24 text-center">
{noResultsMessage}
</Table.Cell>
</Table.Row>
@@ -362,11 +302,7 @@
{#if validPageSizeOptions.length > 1}
<div class="flex items-center gap-4">
<span class="text-sm whitespace-nowrap">{itemsPerPageLabel}</span>
- <Select.Root
- type="single"
- value={pageSize.toString()}
- onValueChange={handlePageSizeChange}
- >
+ <Select.Root type="single" value={pageSize.toString()} onValueChange={handlePageSizeChange}>
<Select.Trigger class="h-8 w-[70px]" aria-label="Items per page">
<span>{pageSize}</span>
</Select.Trigger>
diff --git a/frontend/src/lib/components/yaml-editor.svelte b/frontend/src/lib/components/yaml-editor.svelte
index 8001c9eab..2ec4e0f2e 100644
--- a/frontend/src/lib/components/yaml-editor.svelte
+++ b/frontend/src/lib/components/yaml-editor.svelte
@@ -18,8 +18,7 @@
} catch (e: unknown) {
const err = e as { mark?: { position: number }; message: string };
const start = err.mark?.position || 0;
- const end =
- err.mark?.position !== undefined ? Math.max(start + 1, err.mark.position + 1) : start + 1;
+ const end = err.mark?.position !== undefined ? Math.max(start + 1, err.mark.position + 1) : start + 1;
diagnostics.push({
from: start,
to: end,
diff --git a/frontend/src/lib/icons/docker-icon.svelte b/frontend/src/lib/icons/docker-icon.svelte
index 41602463b..cc3624d63 100644
--- a/frontend/src/lib/icons/docker-icon.svelte
+++ b/frontend/src/lib/icons/docker-icon.svelte
@@ -6,15 +6,7 @@
} = $props();
</script>
-<svg
- fill="currentColor"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- role="img"
- xmlns="http://www.w3.org/2000/svg"
- class={className}
->
+<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg" class={className}>
<title>Docker icon</title>
<path
d="M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z"
diff --git a/frontend/src/lib/services/agent/agent-manager.ts b/frontend/src/lib/services/agent/agent-manager.ts
index 9792b9e85..629d38bc6 100644
--- a/frontend/src/lib/services/agent/agent-manager.ts
+++ b/frontend/src/lib/services/agent/agent-manager.ts
@@ -101,11 +101,7 @@ export async function deleteAgent(agentId: string): Promise<void> {
/**
* Send a task to an agent
*/
-export async function sendTaskToAgent(
- agentId: string,
- taskType: AgentTaskType,
- payload: any
-): Promise<AgentTask> {
+export async function sendTaskToAgent(agentId: string, taskType: AgentTaskType, payload: any): Promise<AgentTask> {
try {
const agent = await getAgent(agentId);
if (!agent) {
@@ -134,12 +130,7 @@ export async function sendTaskToAgent(
/**
* Update task status (called when agents complete tasks)
*/
-export async function updateTaskStatus(
- taskId: string,
- status: string,
- result?: any,
- error?: string
-): Promise<void> {
+export async function updateTaskStatus(taskId: string, status: string, result?: any, error?: string): Promise<void> {
try {
await agentAPI.updateTaskStatus(taskId, {
status,
@@ -253,11 +244,7 @@ export async function updateAgentDockerInfo(
/**
* Send Docker command to agent
*/
-export async function sendDockerCommand(
- agentId: string,
- command: string,
- args: string[] = []
-): Promise<AgentTask> {
+export async function sendDockerCommand(agentId: string, command: string, args: string[] = []): Promise<AgentTask> {
return sendTaskToAgent(agentId, 'docker_command', {
command,
args
@@ -267,12 +254,7 @@ export async function sendDockerCommand(
/**
* Deploy stack to agent
*/
-export async function deployStackToAgent(
- agentId: string,
- stackId: string,
- composeContent: string,
- envContent?: string
-): Promise<AgentTask> {
+export async function deployStackToAgent(agentId: string, stackId: string, composeContent: string, envContent?: string): Promise<AgentTask> {
return sendTaskToAgent(agentId, 'stack_deploy', {
stackId,
composeContent,
diff --git a/frontend/src/lib/services/agent/agent-stack-service.ts b/frontend/src/lib/services/agent/agent-stack-service.ts
index b5202868a..f48c061a8 100644
--- a/frontend/src/lib/services/agent/agent-stack-service.ts
+++ b/frontend/src/lib/services/agent/agent-stack-service.ts
@@ -8,10 +8,7 @@ export interface ServerFetchContext {
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
}
-export async function getStacksFromAgent(
- agent: Agent,
- context?: ServerFetchContext
-): Promise<AgentStack[]> {
+export async function getStacksFromAgent(agent: Agent, context?: ServerFetchContext): Promise<AgentStack[]> {
try {
// Send a task to get compose projects from the agent
const task = await sendTaskToAgent(agent.id, 'stack_list', {});
@@ -104,10 +101,7 @@ export async function getStacksFromAgent(
}
}
-export async function getAllAgentStacks(
- agents: Agent[],
- context?: ServerFetchContext
-): Promise<AgentStack[]> {
+export async function getAllAgentStacks(agents: Agent[], context?: ServerFetchContext): Promise<AgentStack[]> {
const agentStacks: AgentStack[] = [];
for (const agent of agents) {
@@ -303,11 +297,7 @@ export async function getAgentStackResources(stackId: string): Promise<any> {
/**
* Scale a service within a stack
*/
-export async function scaleAgentStackService(
- stackId: string,
- serviceName: string,
- replicas: number
-): Promise<void> {
+export async function scaleAgentStackService(stackId: string, serviceName: string, replicas: number): Promise<void> {
try {
await agentStackAPI.scaleService(stackId, serviceName, replicas);
} catch (error) {
diff --git a/frontend/src/lib/services/api/agent-api-service.ts b/frontend/src/lib/services/api/agent-api-service.ts
index f19bfb498..579bf57ae 100644
--- a/frontend/src/lib/services/api/agent-api-service.ts
+++ b/frontend/src/lib/services/api/agent-api-service.ts
@@ -189,11 +189,7 @@ export default class AgentAPIService extends BaseAPIService {
/**
* Execute Docker command on agent
*/
- async executeDockerCommand(
- agentId: string,
- command: string,
- args: string[] = []
- ): Promise<AgentTask> {
+ async executeDockerCommand(agentId: string, command: string, args: string[] = []): Promise<AgentTask> {
return this.createTask(agentId, {
type: 'docker_command',
payload: { command, args }
@@ -213,12 +209,7 @@ export default class AgentAPIService extends BaseAPIService {
/**
* Deploy stack on agent
*/
- async deployStack(
- agentId: string,
- stackId: string,
- composeContent: string,
- envContent?: string
- ): Promise<AgentTask> {
+ async deployStack(agentId: string, stackId: string, composeContent: string, envContent?: string): Promise<AgentTask> {
return this.createTask(agentId, {
type: 'stack_deploy',
payload: { stackId, composeContent, envContent }
diff --git a/frontend/src/lib/services/api/agent-stack-api-service.ts b/frontend/src/lib/services/api/agent-stack-api-service.ts
index ee5c6ab62..df53882d1 100644
--- a/frontend/src/lib/services/api/agent-stack-api-service.ts
+++ b/frontend/src/lib/services/api/agent-stack-api-service.ts
@@ -81,9 +81,7 @@ export default class AgentStackAPIService extends BaseAPIService {
* Remove/delete a stack
*/
async remove(stackId: string, removeVolumes = false): Promise<void> {
- return this.handleResponse(
- this.api.delete(`/agent-stacks/${stackId}?removeVolumes=${removeVolumes}`)
- );
+ return this.handleResponse(this.api.delete(`/agent-stacks/${stackId}?removeVolumes=${removeVolumes}`));
}
/**
@@ -160,20 +158,14 @@ export default class AgentStackAPIService extends BaseAPIService {
/**
* Get service logs
*/
- async getServiceLogs(
- stackId: string,
- serviceName: string,
- options?: StackLogsOptions
- ): Promise<string> {
+ async getServiceLogs(stackId: string, serviceName: string, options?: StackLogsOptions): Promise<string> {
const params = new URLSearchParams();
if (options?.tail) params.append('tail', options.tail.toString());
if (options?.since) params.append('since', options.since);
if (options?.follow) params.append('follow', options.follow.toString());
const query = params.toString() ? `?${params.toString()}` : '';
- return this.handleResponse(
- this.api.get(`/agent-stacks/${stackId}/services/${serviceName}/logs${query}`)
- );
+ return this.handleResponse(this.api.get(`/agent-stacks/${stackId}/services/${serviceName}/logs${query}`));
}
/**
diff --git a/frontend/src/lib/services/api/api-service.ts b/frontend/src/lib/services/api/api-service.ts
index bf0952726..abcdd71e1 100644
--- a/frontend/src/lib/services/api/api-service.ts
+++ b/frontend/src/lib/services/api/api-service.ts
@@ -23,14 +23,11 @@ abstract class BaseAPIService {
(error) => {
// Only log errors if not building
if (!building) {
- console.error(
- `API Error [${error.config?.method?.toUpperCase()} ${error.config?.url}]:`,
- {
- status: error.response?.status,
- data: error.response?.data,
- message: error.message
- }
- );
+ console.error(`API Error [${error.config?.method?.toUpperCase()} ${error.config?.url}]:`, {
+ status: error.response?.status,
+ data: error.response?.data,
+ message: error.message
+ });
}
return Promise.reject(error);
}
diff --git a/frontend/src/lib/services/api/container-registry-api-service.ts b/frontend/src/lib/services/api/container-registry-api-service.ts
index 7e09e216f..e43db8a77 100644
--- a/frontend/src/lib/services/api/container-registry-api-service.ts
+++ b/frontend/src/lib/services/api/container-registry-api-service.ts
@@ -1,8 +1,5 @@
import BaseAPIService from './api-service';
-import type {
- ContainerRegistryCreateDto,
- ContainerRegistryUpdateDto
-} from '$lib/dto/container-registry-dto';
+import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/dto/container-registry-dto';
import type { ContainerRegistry } from '$lib/models/container-registry';
export default class ContainerRegistryAPIService extends BaseAPIService {
@@ -18,10 +15,7 @@ export default class ContainerRegistryAPIService extends BaseAPIService {
return this.handleResponse(this.api.post(`/container-registries`, registry));
}
- async updateRegistry(
- id: string,
- registry: ContainerRegistryUpdateDto
- ): Promise<ContainerRegistry> {
+ async updateRegistry(id: string, registry: ContainerRegistryUpdateDto): Promise<ContainerRegistry> {
return this.handleResponse(this.api.put(`/container-registries/${id}`, registry));
}
diff --git a/frontend/src/lib/services/api/deployment-api-service.ts b/frontend/src/lib/services/api/deployment-api-service.ts
index a49bf37b3..67ae9b63f 100644
--- a/frontend/src/lib/services/api/deployment-api-service.ts
+++ b/frontend/src/lib/services/api/deployment-api-service.ts
@@ -97,13 +97,7 @@ export default class DeploymentAPIService extends BaseAPIService {
return this.handleResponse(this.api.get(`/deployments/by-task/${taskId}`));
} catch (error: unknown) {
// Return null if not found instead of throwing
- if (
- typeof error === 'object' &&
- error !== null &&
- 'response' in error &&
- typeof (error as any).response === 'object' &&
- (error as any).response?.status === 404
- ) {
+ if (typeof error === 'object' && error !== null && 'response' in error && typeof (error as any).response === 'object' && (error as any).response?.status === 404) {
return null;
}
throw error;
diff --git a/frontend/src/lib/services/api/image-maturity-api-service.ts b/frontend/src/lib/services/api/image-maturity-api-service.ts
index f8fcc91d1..452ee46fe 100644
--- a/frontend/src/lib/services/api/image-maturity-api-service.ts
+++ b/frontend/src/lib/services/api/image-maturity-api-service.ts
@@ -80,10 +80,7 @@ export default class ImageMaturityAPIService extends BaseAPIService {
}
// Get images needing check
- async getImagesNeedingCheck(
- maxAge: number = 1440,
- limit: number = 100
- ): Promise<ImageMaturityRecord[]> {
+ async getImagesNeedingCheck(maxAge: number = 1440, limit: number = 100): Promise<ImageMaturityRecord[]> {
const res = await this.api.get('/images/maturity/needs-check', {
params: { maxAge, limit }
});
diff --git a/frontend/src/lib/services/api/oidc-api-service.ts b/frontend/src/lib/services/api/oidc-api-service.ts
index fd54597e1..0f608284d 100644
--- a/frontend/src/lib/services/api/oidc-api-service.ts
+++ b/frontend/src/lib/services/api/oidc-api-service.ts
@@ -3,9 +3,7 @@ import type { OidcConfig, OidcUserInfo } from '$lib/types/settings.type';
export default class OidcAPIService extends BaseAPIService {
async getAuthUrl(redirectUri: string): Promise<string> {
- const response = (await this.handleResponse(
- this.api.post('/auth/oidc/url', { redirectUri })
- )) as { authUrl: string };
+ const response = (await this.handleResponse(this.api.post('/auth/oidc/url', { redirectUri }))) as { authUrl: string };
return response.authUrl;
}
diff --git a/frontend/src/lib/services/api/stack-api-service.ts b/frontend/src/lib/services/api/stack-api-service.ts
index 10011f729..815ca3684 100644
--- a/frontend/src/lib/services/api/stack-api-service.ts
+++ b/frontend/src/lib/services/api/stack-api-service.ts
@@ -16,12 +16,7 @@ export default class StackAPIService extends BaseAPIService {
return res.data;
}
- async create(data: {
- name: string;
- composeContent: string;
- envContent?: string;
- agentId?: string;
- }) {
+ async create(data: { name: string; composeContent: string; envContent?: string; agentId?: string }) {
const response = await this.api.post('/stacks', {
name: data.name,
composeContent: data.composeContent,
@@ -40,10 +35,7 @@ export default class StackAPIService extends BaseAPIService {
return res.data;
}
- async deploy(
- id: string,
- options?: { profiles?: string[]; envOverrides?: Record<string, string> }
- ) {
+ async deploy(id: string, options?: { profiles?: string[]; envOverrides?: Record<string, string> }) {
const res = await this.api.post(`/stacks/${id}/deploy`, options || {});
return res.data;
}
@@ -99,8 +91,7 @@ export default class StackAPIService extends BaseAPIService {
async getLogs(id: string, options?: { tail?: number; timestamps?: boolean; follow?: boolean }) {
const params = new URLSearchParams();
if (options?.tail) params.append('tail', options.tail.toString());
- if (options?.timestamps !== undefined)
- params.append('timestamps', options.timestamps.toString());
+ if (options?.timestamps !== undefined) params.append('timestamps', options.timestamps.toString());
if (options?.follow !== undefined) params.append('follow', options.follow.toString());
const url = `/stacks/${id}/logs${params.toString() ? '?' + params.toString() : ''}`;
diff --git a/frontend/src/lib/services/api/system-api-service.ts b/frontend/src/lib/services/api/system-api-service.ts
index d10540e8d..571e46b40 100644
--- a/frontend/src/lib/services/api/system-api-service.ts
+++ b/frontend/src/lib/services/api/system-api-service.ts
@@ -2,14 +2,7 @@ import type { PruneType } from '$lib/types/actions.type';
import BaseAPIService from './api-service';
export default class SystemAPIService extends BaseAPIService {
- async pruneAll(options: {
- containers?: boolean;
- images?: boolean;
- volumes?: boolean;
- networks?: boolean;
- dangling?: boolean;
- until?: string;
- }) {
+ async pruneAll(options: { containers?: boolean; images?: boolean; volumes?: boolean; networks?: boolean; dangling?: boolean; until?: string }) {
return this.handleResponse(this.api.post('/system/prune', options));
}
diff --git a/frontend/src/lib/services/api/template-api-service.ts b/frontend/src/lib/services/api/template-api-service.ts
index 30a5cc3ca..fd9630af7 100644
--- a/frontend/src/lib/services/api/template-api-service.ts
+++ b/frontend/src/lib/services/api/template-api-service.ts
@@ -25,12 +25,7 @@ export default class TemplateAPIService extends BaseAPIService {
};
}
- async create(template: {
- name: string;
- description: string;
- content: string;
- envContent?: string;
- }): Promise<Template> {
+ async create(template: { name: string; description: string; content: string; envContent?: string }): Promise<Template> {
const response = await this.api.post('/templates', template);
return response.data.template;
}
@@ -67,12 +62,7 @@ export default class TemplateAPIService extends BaseAPIService {
return response.data.registries;
}
- async addRegistry(registry: {
- name: string;
- url: string;
- description?: string;
- enabled: boolean;
- }): Promise<TemplateRegistry> {
+ async addRegistry(registry: { name: string; url: string; description?: string; enabled: boolean }): Promise<TemplateRegistry> {
const response = await this.api.post('/templates/registries', registry);
return response.data.registry;
}
@@ -114,11 +104,7 @@ export default class TemplateAPIService extends BaseAPIService {
// This would need to be implemented on backend if needed
// For now, get all templates and filter client-side
const templates = await this.loadAll();
- return templates.filter(
- (template) =>
- template.name.toLowerCase().includes(query.toLowerCase()) ||
- template.description.toLowerCase().includes(query.toLowerCase())
- );
+ return templates.filter((template) => template.name.toLowerCase().includes(query.toLowerCase()) || template.description.toLowerCase().includes(query.toLowerCase()));
}
async getCategories(): Promise<string[]> {
@@ -128,9 +114,7 @@ export default class TemplateAPIService extends BaseAPIService {
const categories = new Set<string>();
templates.forEach((template) => {
if (template.metadata?.tags) {
- const tags = Array.isArray(template.metadata.tags)
- ? template.metadata.tags
- : JSON.parse(template.metadata.tags || '[]');
+ const tags = Array.isArray(template.metadata.tags) ? template.metadata.tags : JSON.parse(template.metadata.tags || '[]');
tags.forEach((tag: string) => categories.add(tag));
}
});
diff --git a/frontend/src/lib/services/api/template-registry-api-service.ts b/frontend/src/lib/services/api/template-registry-api-service.ts
index 86d1e3475..74fb0e514 100644
--- a/frontend/src/lib/services/api/template-registry-api-service.ts
+++ b/frontend/src/lib/services/api/template-registry-api-service.ts
@@ -22,9 +22,7 @@ export default class TemplateRegistryAPIService extends BaseAPIService {
return this.handleResponse(this.api.get(`/template-registries/${id}`));
}
- async create(
- registry: Omit<TemplateRegistry, 'id' | 'createdAt' | 'updatedAt'>
- ): Promise<TemplateRegistry> {
+ async create(registry: Omit<TemplateRegistry, 'id' | 'createdAt' | 'updatedAt'>): Promise<TemplateRegistry> {
return this.handleResponse(this.api.post('/template-registries', registry));
}
diff --git a/frontend/src/lib/services/api/user-api-service.ts b/frontend/src/lib/services/api/user-api-service.ts
index 671290135..e866a5f68 100644
--- a/frontend/src/lib/services/api/user-api-service.ts
+++ b/frontend/src/lib/services/api/user-api-service.ts
@@ -59,9 +59,7 @@ export default class UserAPIService extends BaseAPIService {
}
async getByOidcSubjectId(oidcSubjectId: string): Promise<User> {
- return this.handleResponse(
- this.api.get(`/users/by-oidc-subject/${encodeURIComponent(oidcSubjectId)}`)
- );
+ return this.handleResponse(this.api.get(`/users/by-oidc-subject/${encodeURIComponent(oidcSubjectId)}`));
}
// RBAC methods
diff --git a/frontend/src/lib/services/api/volume-api-service.ts b/frontend/src/lib/services/api/volume-api-service.ts
index 08467880a..35a202089 100644
--- a/frontend/src/lib/services/api/volume-api-service.ts
+++ b/frontend/src/lib/services/api/volume-api-service.ts
@@ -18,12 +18,7 @@ export default class VolumeAPIService extends BaseAPIService {
return response.data.inUse;
}
- async create(volumeConfig: {
- name?: string;
- driver?: string;
- driverOpts?: Record<string, string>;
- labels?: Record<string, string>;
- }) {
+ async create(volumeConfig: { name?: string; driver?: string; driverOpts?: Record<string, string>; labels?: Record<string, string> }) {
return this.handleResponse(this.api.post('/volumes', volumeConfig));
}
diff --git a/frontend/src/lib/services/deployment-service.ts b/frontend/src/lib/services/deployment-service.ts
index 61216a635..5dc0e9582 100644
--- a/frontend/src/lib/services/deployment-service.ts
+++ b/frontend/src/lib/services/deployment-service.ts
@@ -4,9 +4,7 @@ import type { Deployment } from '$lib/types/deployment.type';
/**
* Create a new deployment
*/
-export async function createDeployment(
- deployment: Omit<Deployment, 'id' | 'createdAt' | 'updatedAt'>
-): Promise<Deployment> {
+export async function createDeployment(deployment: Omit<Deployment, 'id' | 'createdAt' | 'updatedAt'>): Promise<Deployment> {
try {
return await deploymentAPI.create({
name: deployment.name,
@@ -25,10 +23,7 @@ export async function createDeployment(
/**
* Update a deployment
*/
-export async function updateDeployment(
- deploymentId: string,
- updates: Partial<Deployment>
-): Promise<Deployment | null> {
+export async function updateDeployment(deploymentId: string, updates: Partial<Deployment>): Promise<Deployment | null> {
try {
return await deploymentAPI.update(deploymentId, {
name: updates.name,
@@ -82,13 +77,7 @@ export async function deleteDeployment(deploymentId: string): Promise<boolean> {
/**
* Create a stack deployment
*/
-export async function createStackDeployment(
- agentId: string,
- stackName: string,
- composeContent: string,
- envContent?: string,
- taskId?: string
-): Promise<Deployment> {
+export async function createStackDeployment(agentId: string, stackName: string, composeContent: string, envContent?: string, taskId?: string): Promise<Deployment> {
try {
return await deploymentAPI.createStackDeployment({
agentId,
@@ -106,14 +95,7 @@ export async function createStackDeployment(
/**
* Create a container deployment
*/
-export async function createContainerDeployment(
- agentId: string,
- containerName: string,
- imageName: string,
- ports?: string[],
- volumes?: string[],
- taskId?: string
-): Promise<Deployment> {
+export async function createContainerDeployment(agentId: string, containerName: string, imageName: string, ports?: string[], volumes?: string[], taskId?: string): Promise<Deployment> {
try {
return await deploymentAPI.createContainerDeployment({
agentId,
@@ -132,11 +114,7 @@ export async function createContainerDeployment(
/**
* Create an image deployment
*/
-export async function createImageDeployment(
- agentId: string,
- imageName: string,
- taskId?: string
-): Promise<Deployment> {
+export async function createImageDeployment(agentId: string, imageName: string, taskId?: string): Promise<Deployment> {
try {
return await deploymentAPI.createImageDeployment({
agentId,
@@ -152,12 +130,7 @@ export async function createImageDeployment(
/**
* Update deployment status based on task completion
*/
-export async function updateDeploymentFromTask(
- taskId: string,
- status: string,
- result?: any,
- error?: string
-): Promise<void> {
+export async function updateDeploymentFromTask(taskId: string, status: string, result?: any, error?: string): Promise<void> {
try {
// Find deployment linked to this task
const deployment = await deploymentAPI.getByTaskId(taskId);
diff --git a/frontend/src/lib/services/user-service.ts b/frontend/src/lib/services/user-service.ts
index 8f883fe2c..7c0a2268c 100644
--- a/frontend/src/lib/services/user-service.ts
+++ b/frontend/src/lib/services/user-service.ts
@@ -60,9 +60,7 @@ export async function saveUser(user: User): Promise<User | null> {
}
}
-export async function createUser(
- user: Omit<User, 'id' | 'createdAt' | 'updatedAt'>
-): Promise<User | null> {
+export async function createUser(user: Omit<User, 'id' | 'createdAt' | 'updatedAt'>): Promise<User | null> {
try {
return await userAPI.create(user);
} catch (error) {
@@ -91,11 +89,7 @@ export async function deleteUser(id: string): Promise<boolean> {
}
// Authentication functions
-export async function login(credentials: {
- username: string;
- password: string;
- rememberMe?: boolean;
-}) {
+export async function login(credentials: { username: string; password: string; rememberMe?: boolean }) {
try {
return await userAPI.login(credentials);
} catch (error) {
@@ -113,11 +107,7 @@ export async function logout(): Promise<void> {
}
}
-export async function changePassword(
- userId: string,
- currentPassword: string,
- newPassword: string
-): Promise<boolean> {
+export async function changePassword(userId: string, currentPassword: string, newPassword: string): Promise<boolean> {
try {
await userAPI.changePassword(userId, { currentPassword, newPassword });
return true;
diff --git a/frontend/src/lib/stores/maturity-store.ts b/frontend/src/lib/stores/maturity-store.ts
index daacf1cd8..59810dd8e 100644
--- a/frontend/src/lib/stores/maturity-store.ts
+++ b/frontend/src/lib/stores/maturity-store.ts
@@ -100,10 +100,7 @@ export async function triggerBulkMaturityCheck(): Promise<{ success: boolean; me
}
// Enhanced image processing that includes maturity data from store
-export function enhanceImagesWithMaturity(
- images: any[],
- maturityData: Record<string, ImageMaturity>
-): any[] {
+export function enhanceImagesWithMaturity(images: any[], maturityData: Record<string, ImageMaturity>): any[] {
return images.map((image) => {
// Parse repo and tag from RepoTags
let repo = '<none>';
diff --git a/frontend/src/lib/stores/table-store.ts b/frontend/src/lib/stores/table-store.ts
index 8ff78beb2..eb540798c 100644
--- a/frontend/src/lib/stores/table-store.ts
+++ b/frontend/src/lib/stores/table-store.ts
@@ -21,14 +21,10 @@ const DEFAULT_PAGE_SIZES: PageSizes = {
};
// Single persisted state for all page sizes
-export const tablePageSizes = new PersistedState<PageSizes>(
- 'arcane-table-page-sizes',
- DEFAULT_PAGE_SIZES,
- {
- storage: 'local',
- syncTabs: true
- }
-);
+export const tablePageSizes = new PersistedState<PageSizes>('arcane-table-page-sizes', DEFAULT_PAGE_SIZES, {
+ storage: 'local',
+ syncTabs: true
+});
// Backward compatibility helpers
export const tablePersistence = {
diff --git a/frontend/src/lib/types/actions.type.ts b/frontend/src/lib/types/actions.type.ts
index c5ee4c2b9..818aa28b0 100644
--- a/frontend/src/lib/types/actions.type.ts
+++ b/frontend/src/lib/types/actions.type.ts
@@ -1,12 +1,3 @@
-export type StackActions =
- | 'start'
- | 'stop'
- | 'restart'
- | 'redeploy'
- | 'import'
- | 'destroy'
- | 'pull'
- | 'migrate'
- | 'update';
+export type StackActions = 'start' | 'stop' | 'restart' | 'redeploy' | 'import' | 'destroy' | 'pull' | 'migrate' | 'update';
export type ContainerActions = 'start' | 'stop' | 'restart' | 'pull' | 'remove';
export type PruneType = 'containers' | 'images' | 'networks' | 'volumes';
diff --git a/frontend/src/lib/types/agent.type.ts b/frontend/src/lib/types/agent.type.ts
index f171ea7d1..cc971c704 100644
--- a/frontend/src/lib/types/agent.type.ts
+++ b/frontend/src/lib/types/agent.type.ts
@@ -29,19 +29,7 @@ export interface Agent {
export interface AgentTask {
id: string;
agentId: string;
- type:
- | 'docker_command'
- | 'stack_deploy'
- | 'compose_create_project'
- | 'compose_up'
- | 'image_pull'
- | 'health_check'
- | 'container_start'
- | 'stack_list'
- | 'container_stop'
- | 'container_restart'
- | 'container_remove'
- | 'agent_upgrade';
+ type: 'docker_command' | 'stack_deploy' | 'compose_create_project' | 'compose_up' | 'image_pull' | 'health_check' | 'container_start' | 'stack_list' | 'container_stop' | 'container_restart' | 'container_remove' | 'agent_upgrade';
payload: Record<string, any>;
status: 'pending' | 'running' | 'completed' | 'failed';
result?: any;
diff --git a/frontend/src/lib/types/errors.ts b/frontend/src/lib/types/errors.ts
index 63e09e705..e956ca493 100644
--- a/frontend/src/lib/types/errors.ts
+++ b/frontend/src/lib/types/errors.ts
@@ -43,10 +43,7 @@ export class NotFoundError extends ServiceError {
export class ValidationError extends ServiceError {
public readonly details?: Record<string, string> | string;
- constructor(
- message: string = 'Input validation failed',
- details?: Record<string, string> | string
- ) {
+ constructor(message: string = 'Input validation failed', details?: Record<string, string> | string) {
super(message, ApiErrorCode.VALIDATION_ERROR, 400);
this.name = 'ValidationError';
this.details = details;
@@ -59,10 +56,7 @@ export class DockerApiError extends ServiceError {
public readonly dockerStatusCode?: number;
constructor(message: string, dockerStatusCode?: number) {
- const status =
- dockerStatusCode && dockerStatusCode >= 400 && dockerStatusCode < 500
- ? dockerStatusCode
- : 503;
+ const status = dockerStatusCode && dockerStatusCode >= 400 && dockerStatusCode < 500 ? dockerStatusCode : 503;
super(message, ApiErrorCode.DOCKER_API_ERROR, status);
this.name = 'DockerApiError';
this.dockerStatusCode = dockerStatusCode;
diff --git a/frontend/src/lib/types/statuses.ts b/frontend/src/lib/types/statuses.ts
index bc0f5c327..c2dcb0883 100644
--- a/frontend/src/lib/types/statuses.ts
+++ b/frontend/src/lib/types/statuses.ts
@@ -1,7 +1,4 @@
-export const statusVariantMap: Record<
- string,
- 'red' | 'purple' | 'green' | 'blue' | 'gray' | 'amber'
-> = {
+export const statusVariantMap: Record<string, 'red' | 'purple' | 'green' | 'blue' | 'gray' | 'amber'> = {
running: 'green',
deployed: 'green',
stopped: 'red',
diff --git a/frontend/src/lib/utils/api.util.ts b/frontend/src/lib/utils/api.util.ts
index 2af119f1c..aeb074378 100644
--- a/frontend/src/lib/utils/api.util.ts
+++ b/frontend/src/lib/utils/api.util.ts
@@ -2,19 +2,7 @@ import type { Result } from './try-catch'; // Assuming Result<T, Error> is { dat
import { toast } from 'svelte-sonner';
import { extractDockerErrorMessage } from '$lib/utils/errors.util';
-export function handleApiResultWithCallbacks<T>({
- result,
- message,
- setLoadingState = () => {},
- onSuccess,
- onError = () => {}
-}: {
- result: Result<T, Error>;
- message: string;
- setLoadingState?: (value: boolean) => void;
- onSuccess: (data: T) => void;
- onError?: (error: Error) => void;
-}) {
+export function handleApiResultWithCallbacks<T>({ result, message, setLoadingState = () => {}, onSuccess, onError = () => {} }: { result: Result<T, Error>; message: string; setLoadingState?: (value: boolean) => void; onSuccess: (data: T) => void; onError?: (error: Error) => void }) {
setLoadingState(true);
if (result.error) {
diff --git a/frontend/src/lib/utils/compose-parser.ts b/frontend/src/lib/utils/compose-parser.ts
index d173e429f..b3c418c26 100644
--- a/frontend/src/lib/utils/compose-parser.ts
+++ b/frontend/src/lib/utils/compose-parser.ts
@@ -47,15 +47,8 @@ export function parseComposeFile(content: string): {
errors.push(`Service "${serviceName}" depends on non-existent service "${dep}"`);
}
// Validate condition values per spec
- if (
- config.condition &&
- !['service_started', 'service_healthy', 'service_completed_successfully'].includes(
- config.condition
- )
- ) {
- errors.push(
- `Service "${serviceName}" has invalid dependency condition "${config.condition}"`
- );
+ if (config.condition && !['service_started', 'service_healthy', 'service_completed_successfully'].includes(config.condition)) {
+ errors.push(`Service "${serviceName}" has invalid dependency condition "${config.condition}"`);
}
}
}
@@ -65,11 +58,7 @@ export function parseComposeFile(content: string): {
// Validate networks
if (parsed.networks) {
for (const [networkName, network] of Object.entries(parsed.networks)) {
- if (
- network &&
- network.driver &&
- !['bridge', 'host', 'overlay', 'macvlan', 'none', 'null'].includes(network.driver)
- ) {
+ if (network && network.driver && !['bridge', 'host', 'overlay', 'macvlan', 'none', 'null'].includes(network.driver)) {
warnings.push(`Network "${networkName}" uses uncommon driver "${network.driver}"`);
}
}
@@ -81,9 +70,7 @@ export function parseComposeFile(content: string): {
warnings
};
} catch (parseError) {
- errors.push(
- `YAML parsing error: ${parseError instanceof Error ? parseError.message : String(parseError)}`
- );
+ errors.push(`YAML parsing error: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
return { data: null, errors, warnings };
}
}
diff --git a/frontend/src/lib/utils/compose-validate.utils.ts b/frontend/src/lib/utils/compose-validate.utils.ts
index 61f121dd3..8189845af 100644
--- a/frontend/src/lib/utils/compose-validate.utils.ts
+++ b/frontend/src/lib/utils/compose-validate.utils.ts
@@ -10,12 +10,7 @@ export type ValidationMode = 'default' | 'strict' | 'loose';
/**
* Validate unknown fields according to Compose spec
*/
-export function validateUnknownFields(
- data: any,
- knownFields: string[],
- context: string,
- mode: ValidationMode = 'default'
-): string[] {
+export function validateUnknownFields(data: any, knownFields: string[], context: string, mode: ValidationMode = 'default'): string[] {
const warnings: string[] = [];
if (mode === 'loose') return warnings;
@@ -37,16 +32,7 @@ export function validateUnknownFields(
/**
* Known top-level fields per Compose spec
*/
-export const KNOWN_TOP_LEVEL_FIELDS = [
- 'version',
- 'name',
- 'services',
- 'networks',
- 'volumes',
- 'configs',
- 'secrets',
- 'include'
-];
+export const KNOWN_TOP_LEVEL_FIELDS = ['version', 'name', 'services', 'networks', 'volumes', 'configs', 'secrets', 'include'];
/**
* Known service-level fields per Compose spec
@@ -145,18 +131,7 @@ export const KNOWN_SERVICE_FIELDS = [
/**
* Known network-level fields per Compose spec
*/
-export const KNOWN_NETWORK_FIELDS = [
- 'driver',
- 'driver_opts',
- 'external',
- 'name',
- 'ipam',
- 'enable_ipv6',
- 'labels',
- 'attachable',
- 'scope',
- 'internal'
-];
+export const KNOWN_NETWORK_FIELDS = ['driver', 'driver_opts', 'external', 'name', 'ipam', 'enable_ipv6', 'labels', 'attachable', 'scope', 'internal'];
/**
* Known volume-level fields per Compose spec
@@ -166,21 +141,14 @@ export const KNOWN_VOLUME_FIELDS = ['driver', 'driver_opts', 'external', 'name',
/**
* Validate container name format and conflicts per Compose spec
*/
-export function validateContainerName(
- serviceName: string,
- serviceConfig: any,
- stackId: string
-): string {
+export function validateContainerName(serviceName: string, serviceConfig: any, stackId: string): string {
let containerName = serviceConfig.container_name;
if (containerName) {
// Validate container_name format per spec
const containerNameRegex = /^[a-zA-Z0-9][a-zA-Z0-9_.-]+$/;
if (!containerNameRegex.test(containerName)) {
- throw new Error(
- `Invalid container_name "${containerName}" for service "${serviceName}". ` +
- `Must match pattern [a-zA-Z0-9][a-zA-Z0-9_.-]+`
- );
+ throw new Error(`Invalid container_name "${containerName}" for service "${serviceName}". ` + `Must match pattern [a-zA-Z0-9][a-zA-Z0-9_.-]+`);
}
// Check for scaling conflicts - service with container_name cannot be scaled
@@ -198,20 +166,14 @@ export function validateContainerName(
/**
* Validate external resource configuration per Compose spec
*/
-export function validateExternalResource(
- name: string,
- config: any,
- type: 'network' | 'volume'
-): void {
+export function validateExternalResource(name: string, config: any, type: 'network' | 'volume'): void {
if (config.external === true) {
// External resources should not have other configuration attributes
const allowedFields = ['name', 'external'];
const otherFields = Object.keys(config).filter((key) => !allowedFields.includes(key));
if (otherFields.length > 0) {
- throw new Error(
- `External ${type} "${name}" cannot have additional attributes: ${otherFields.join(', ')}`
- );
+ throw new Error(`External ${type} "${name}" cannot have additional attributes: ${otherFields.join(', ')}`);
}
}
}
@@ -219,10 +181,7 @@ export function validateExternalResource(
/**
* Enhanced environment file loading with new format support
*/
-export async function loadEnvFiles(
- envFiles: string | string[] | Array<{ path: string; required?: boolean; format?: string }>,
- stackDir: string
-): Promise<Record<string, string>> {
+export async function loadEnvFiles(envFiles: string | string[] | Array<{ path: string; required?: boolean; format?: string }>, stackDir: string): Promise<Record<string, string>> {
const envVars: Record<string, string> = {};
const files = Array.isArray(envFiles) ? envFiles : [envFiles];
@@ -307,10 +266,7 @@ function parseEnvContent(content: string): Record<string, string> {
let value = trimmed.substring(equalIndex + 1);
// Remove quotes if present
- if (
- (value.startsWith('"') && value.endsWith('"')) ||
- (value.startsWith("'") && value.endsWith("'"))
- ) {
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
value = value.slice(1, -1);
}
@@ -330,10 +286,7 @@ export function validateServiceAttributes(serviceName: string, serviceConfig: an
if (serviceConfig.pull_policy) {
const validPullPolicies = ['always', 'never', 'missing', 'build'];
if (!validPullPolicies.includes(serviceConfig.pull_policy)) {
- warnings.push(
- `Service "${serviceName}" has invalid pull_policy "${serviceConfig.pull_policy}". ` +
- `Valid values: ${validPullPolicies.join(', ')}`
- );
+ warnings.push(`Service "${serviceName}" has invalid pull_policy "${serviceConfig.pull_policy}". ` + `Valid values: ${validPullPolicies.join(', ')}`);
}
}
@@ -341,18 +294,13 @@ export function validateServiceAttributes(serviceName: string, serviceConfig: an
if (serviceConfig.platform) {
const platformRegex = /^[a-z0-9]+\/[a-z0-9]+$/;
if (!platformRegex.test(serviceConfig.platform)) {
- warnings.push(
- `Service "${serviceName}" has invalid platform format "${serviceConfig.platform}". ` +
- `Expected format: os/arch (e.g., linux/amd64)`
- );
+ warnings.push(`Service "${serviceName}" has invalid platform format "${serviceConfig.platform}". ` + `Expected format: os/arch (e.g., linux/amd64)`);
}
}
// Validate init attribute
if (serviceConfig.init !== undefined && typeof serviceConfig.init !== 'boolean') {
- warnings.push(
- `Service "${serviceName}" init attribute must be a boolean, got: ${typeof serviceConfig.init}`
- );
+ warnings.push(`Service "${serviceName}" init attribute must be a boolean, got: ${typeof serviceConfig.init}`);
}
return warnings;
@@ -361,10 +309,7 @@ export function validateServiceAttributes(serviceName: string, serviceConfig: an
/**
* Enhanced validation for compose structure with unknown field checking
*/
-export function validateComposeStructureEnhanced(
- composeData: any,
- mode: ValidationMode = 'default'
-): { valid: boolean; errors: string[]; warnings: string[] } {
+export function validateComposeStructureEnhanced(composeData: any, mode: ValidationMode = 'default'): { valid: boolean; errors: string[]; warnings: string[] } {
const errors: string[] = [];
const warnings: string[] = [];
@@ -386,14 +331,7 @@ export function validateComposeStructureEnhanced(
for (const [serviceName, serviceConfig] of Object.entries(composeData.services)) {
// Validate unknown fields in service
try {
- warnings.push(
- ...validateUnknownFields(
- serviceConfig,
- KNOWN_SERVICE_FIELDS,
- `service "${serviceName}"`,
- mode
- )
- );
+ warnings.push(...validateUnknownFields(serviceConfig, KNOWN_SERVICE_FIELDS, `service "${serviceName}"`, mode));
} catch (error) {
errors.push(error instanceof Error ? error.message : String(error));
continue;
@@ -410,14 +348,7 @@ export function validateComposeStructureEnhanced(
if (!networkConfig) continue;
try {
- warnings.push(
- ...validateUnknownFields(
- networkConfig,
- KNOWN_NETWORK_FIELDS,
- `network "${networkName}"`,
- mode
- )
- );
+ warnings.push(...validateUnknownFields(networkConfig, KNOWN_NETWORK_FIELDS, `network "${networkName}"`, mode));
// Validate external networks
validateExternalResource(networkName, networkConfig, 'network');
@@ -433,14 +364,7 @@ export function validateComposeStructureEnhanced(
if (!volumeConfig) continue;
try {
- warnings.push(
- ...validateUnknownFields(
- volumeConfig,
- KNOWN_VOLUME_FIELDS,
- `volume "${volumeName}"`,
- mode
- )
- );
+ warnings.push(...validateUnknownFields(volumeConfig, KNOWN_VOLUME_FIELDS, `volume "${volumeName}"`, mode));
// Validate external volumes
validateExternalResource(volumeName, volumeConfig, 'volume');
@@ -460,10 +384,7 @@ export function validateComposeStructureEnhanced(
/**
* Validate compose content with enhanced field checking
*/
-function validateComposeContentEnhanced(
- content: string,
- mode: ValidationMode = 'default'
-): { valid: boolean; errors: string[]; warnings: string[] } {
+function validateComposeContentEnhanced(content: string, mode: ValidationMode = 'default'): { valid: boolean; errors: string[]; warnings: string[] } {
try {
// Remove the require and use the imported yamlLoad directly
const parsed = yamlLoad(content);
@@ -471,9 +392,7 @@ function validateComposeContentEnhanced(
} catch (parseError) {
return {
valid: false,
- errors: [
- `YAML parsing error: ${parseError instanceof Error ? parseError.message : String(parseError)}`
- ],
+ errors: [`YAML parsing error: ${parseError instanceof Error ? parseError.message : String(parseError)}`],
warnings: []
};
}
@@ -519,11 +438,7 @@ export function enhanceContainerConfig(containerConfig: any, serviceConfig: any)
/**
* Validate all compose configuration with comprehensive checks
*/
-export async function validateComposeConfiguration(
- composeContent: string,
- envContent: string = '',
- mode: ValidationMode = 'default'
-): Promise<{ valid: boolean; errors: string[]; warnings: string[] }> {
+export async function validateComposeConfiguration(composeContent: string, envContent: string = '', mode: ValidationMode = 'default'): Promise<{ valid: boolean; errors: string[]; warnings: string[] }> {
const errors: string[] = [];
const warnings: string[] = [];
diff --git a/frontend/src/lib/utils/compose.utils.ts b/frontend/src/lib/utils/compose.utils.ts
index 5529874e9..0e107b17f 100644
--- a/frontend/src/lib/utils/compose.utils.ts
+++ b/frontend/src/lib/utils/compose.utils.ts
@@ -5,18 +5,7 @@ import * as path from 'node:path';
import type { ComposeSpecification, Service as ServiceConfig } from '../types/compose.spec.type.js';
// Compose specification constants
-export const SUPPORTED_COMPOSE_VERSIONS = [
- '3.0',
- '3.1',
- '3.2',
- '3.3',
- '3.4',
- '3.5',
- '3.6',
- '3.7',
- '3.8',
- '3.9'
-];
+export const SUPPORTED_COMPOSE_VERSIONS = ['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9'];
export const DEFAULT_COMPOSE_VERSION = '3.8';
/**
@@ -101,10 +90,7 @@ export function parseEnvContent(envContent: string | null): Record<string, strin
let value = line.substring(equalIndex + 1);
// Handle quoted values
- if (
- (value.startsWith('"') && value.endsWith('"')) ||
- (value.startsWith("'") && value.endsWith("'"))
- ) {
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
value = value.slice(1, -1);
// Handle escaped quotes within double quotes
if (value.includes('\\"')) {
@@ -145,9 +131,7 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
// Check version
if (composeData.version) {
if (!SUPPORTED_COMPOSE_VERSIONS.includes(composeData.version)) {
- warnings.push(
- `Compose version ${composeData.version} may not be fully supported. Supported versions: ${SUPPORTED_COMPOSE_VERSIONS.join(', ')}`
- );
+ warnings.push(`Compose version ${composeData.version} may not be fully supported. Supported versions: ${SUPPORTED_COMPOSE_VERSIONS.join(', ')}`);
}
} else {
warnings.push('No version specified in compose file. Consider adding a version field.');
@@ -168,9 +152,7 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
// Validate service name format
if (!/^[a-zA-Z0-9._-]+$/.test(serviceName)) {
- errors.push(
- `Service name '${serviceName}' contains invalid characters. Use only letters, numbers, dots, hyphens, and underscores.`
- );
+ errors.push(`Service name '${serviceName}' contains invalid characters. Use only letters, numbers, dots, hyphens, and underscores.`);
}
// Validate depends_on
@@ -194,22 +176,14 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
if (serviceConfig.networks) {
if (Array.isArray(serviceConfig.networks)) {
for (const network of serviceConfig.networks) {
- if (
- typeof network === 'string' &&
- composeData.networks &&
- !composeData.networks[network]
- ) {
- warnings.push(
- `Service '${serviceName}' references network '${network}' which is not defined`
- );
+ if (typeof network === 'string' && composeData.networks && !composeData.networks[network]) {
+ warnings.push(`Service '${serviceName}' references network '${network}' which is not defined`);
}
}
} else if (typeof serviceConfig.networks === 'object') {
for (const network of Object.keys(serviceConfig.networks)) {
if (composeData.networks && !composeData.networks[network]) {
- warnings.push(
- `Service '${serviceName}' references network '${network}' which is not defined`
- );
+ warnings.push(`Service '${serviceName}' references network '${network}' which is not defined`);
}
}
}
@@ -220,9 +194,7 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
for (const volume of serviceConfig.volumes) {
if (typeof volume === 'object' && volume.source && volume.type === 'volume') {
if (composeData.volumes && !composeData.volumes[volume.source]) {
- warnings.push(
- `Service '${serviceName}' references volume '${volume.source}' which is not defined`
- );
+ warnings.push(`Service '${serviceName}' references volume '${volume.source}' which is not defined`);
}
}
}
@@ -249,18 +221,11 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
continue; // Skip null/undefined network configs
}
- if (
- networkConfig.external &&
- typeof networkConfig.external === 'object' &&
- !networkConfig.external.name
- ) {
+ if (networkConfig.external && typeof networkConfig.external === 'object' && !networkConfig.external.name) {
warnings.push(`External network '${networkName}' should have a name specified`);
}
- if (
- networkConfig.driver &&
- !['bridge', 'host', 'overlay', 'macvlan', 'none'].includes(networkConfig.driver)
- ) {
+ if (networkConfig.driver && !['bridge', 'host', 'overlay', 'macvlan', 'none'].includes(networkConfig.driver)) {
warnings.push(`Network '${networkName}' uses uncommon driver '${networkConfig.driver}'`);
}
}
@@ -274,11 +239,7 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
continue; // Skip null/undefined volume configs
}
- if (
- volumeConfig.external &&
- typeof volumeConfig.external === 'object' &&
- !volumeConfig.external.name
- ) {
+ if (volumeConfig.external && typeof volumeConfig.external === 'object' && !volumeConfig.external.name) {
warnings.push(`External volume '${volumeName}' should have a name specified`);
}
}
@@ -294,10 +255,7 @@ export function validateComposeStructure(composeData: ComposeSpecification): {
/**
* Normalize healthcheck according to Compose spec
*/
-export function normalizeHealthcheckTest(
- composeContent: string,
- envGetter?: (key: string) => string | undefined
-): string {
+export function normalizeHealthcheckTest(composeContent: string, envGetter?: (key: string) => string | undefined): string {
let doc: any;
try {
doc = yamlLoad(composeContent);
@@ -328,10 +286,7 @@ export function normalizeHealthcheckTest(
}
modified = true;
} else if (Array.isArray(service.healthcheck.test)) {
- if (
- service.healthcheck.test.length > 0 &&
- !['CMD', 'CMD-SHELL', 'NONE'].includes(service.healthcheck.test[0])
- ) {
+ if (service.healthcheck.test.length > 0 && !['CMD', 'CMD-SHELL', 'NONE'].includes(service.healthcheck.test[0])) {
service.healthcheck.test.unshift('CMD');
modified = true;
}
@@ -347,10 +302,7 @@ export function normalizeHealthcheckTest(
service.healthcheck.timeout = `${service.healthcheck.timeout}s`;
modified = true;
}
- if (
- service.healthcheck.start_period &&
- typeof service.healthcheck.start_period === 'number'
- ) {
+ if (service.healthcheck.start_period && typeof service.healthcheck.start_period === 'number') {
service.healthcheck.start_period = `${service.healthcheck.start_period}s`;
modified = true;
}
@@ -376,10 +328,7 @@ export function normalizeHealthcheckTest(
/**
* Parse YAML content with proper Compose spec validation
*/
-export function parseYamlContent(
- content: string,
- envGetter?: (key: string) => string | undefined
-): ComposeSpecification | null {
+export function parseYamlContent(content: string, envGetter?: (key: string) => string | undefined): ComposeSpecification | null {
try {
const parsedYaml = yamlLoad(content);
@@ -423,10 +372,7 @@ export function parseYamlContent(
/**
* Enhanced variable substitution with Compose spec compliance
*/
-export function substituteVariablesInObject(
- obj: any,
- envGetter: (key: string) => string | undefined
-): any {
+export function substituteVariablesInObject(obj: any, envGetter: (key: string) => string | undefined): any {
if (Array.isArray(obj)) {
return obj.map((item) => substituteVariablesInObject(item, envGetter));
} else if (typeof obj === 'object' && obj !== null) {
@@ -506,11 +452,7 @@ export function prepareVolumes(volumes: any[], composeData: any, stackId: string
* Process short volume syntax strings
* Examples: "/host/path:/container/path", "volume-name:/data", "/path:/data:ro"
*/
-function processShortVolumeString(
- volumeString: string,
- composeData: any,
- stackId: string
-): string | null {
+function processShortVolumeString(volumeString: string, composeData: any, stackId: string): string | null {
const parts = volumeString.split(':');
if (parts.length < 2) {
@@ -556,11 +498,7 @@ function processShortVolumeString(
* Process long volume syntax objects
* Supports all Docker Compose volume options
*/
-function processLongVolumeObject(
- volume: any,
- composeData: any,
- stackId: string
-): { bind?: string; tmpfs?: string } {
+function processLongVolumeObject(volume: any, composeData: any, stackId: string): { bind?: string; tmpfs?: string } {
const { type, source, target, read_only, consistency, bind, volume: volumeOpts, tmpfs } = volume;
if (!target) {
@@ -634,13 +572,7 @@ function processBindMount(source: string, target: string, options: any = {}): st
/**
* Process named volume mount with all options
*/
-function processVolumeMount(
- source: string,
- target: string,
- stackId: string,
- composeData: any,
- options: any = {}
-): string {
+function processVolumeMount(source: string, target: string, stackId: string, composeData: any, options: any = {}): string {
let volumeName = '';
if (source) {
@@ -774,10 +706,7 @@ export function extractTmpfsMounts(volumes: any[]): Array<{ target: string; opti
* Create Docker volume definitions for named volumes
* This should be called before creating containers to ensure named volumes exist
*/
-export function createVolumeDefinitions(
- composeData: any,
- stackId: string
-): Array<{ name: string; config: any }> {
+export function createVolumeDefinitions(composeData: any, stackId: string): Array<{ name: string; config: any }> {
if (!composeData.volumes) {
return [];
}
@@ -826,9 +755,7 @@ export function validateVolumeConfiguration(volumes: any[]): { valid: boolean; e
if (typeof volume === 'string') {
// Validate short syntax
if (!volume.includes(':')) {
- errors.push(
- `Volume ${i}: Invalid short syntax "${volume}". Expected "source:target" format.`
- );
+ errors.push(`Volume ${i}: Invalid short syntax "${volume}". Expected "source:target" format.`);
}
} else if (typeof volume === 'object' && volume !== null) {
// Validate long syntax
@@ -837,9 +764,7 @@ export function validateVolumeConfiguration(volumes: any[]): { valid: boolean; e
}
if (volume.type && !['bind', 'volume', 'tmpfs', 'npipe'].includes(volume.type)) {
- errors.push(
- `Volume ${i}: Invalid type "${volume.type}". Must be one of: bind, volume, tmpfs, npipe.`
- );
+ errors.push(`Volume ${i}: Invalid type "${volume.type}". Must be one of: bind, volume, tmpfs, npipe.`);
}
if (volume.type === 'bind' && !volume.source) {
@@ -935,10 +860,7 @@ export function preparePorts(ports: any[]): any {
/**
* Enhanced environment variable preparation
*/
-export async function prepareEnvironmentVariables(
- environment: any,
- stackDir: string
-): Promise<string[]> {
+export async function prepareEnvironmentVariables(environment: any, stackDir: string): Promise<string[]> {
const envArray: string[] = [];
const envMap = new Map<string, string>();
@@ -1030,9 +952,7 @@ export function resolveDependencyOrder(services: Record<string, any>): string[]
const service = services[serviceName];
if (service.depends_on) {
- const dependencies = Array.isArray(service.depends_on)
- ? service.depends_on
- : Object.keys(service.depends_on);
+ const dependencies = Array.isArray(service.depends_on) ? service.depends_on : Object.keys(service.depends_on);
for (const dep of dependencies) {
if (services[dep]) {
@@ -1225,9 +1145,7 @@ export function validateComposeContent(content: string): {
} catch (parseError) {
return {
valid: false,
- errors: [
- `YAML parsing error: ${parseError instanceof Error ? parseError.message : String(parseError)}`
- ],
+ errors: [`YAML parsing error: ${parseError instanceof Error ? parseError.message : String(parseError)}`],
warnings: []
};
}
@@ -1237,9 +1155,7 @@ export function validateComposeContent(content: string): {
* Parse and validate depends_on configuration
* Supports both short and long syntax as per Docker Compose spec
*/
-export function parseDependsOn(
- dependsOn: any
-): Array<{ service: string; condition: string; restart?: boolean }> {
+export function parseDependsOn(dependsOn: any): Array<{ service: string; condition: string; restart?: boolean }> {
if (!dependsOn) {
return [];
}
@@ -1276,9 +1192,7 @@ export function parseDependsOn(
/**
* Validate dependency conditions according to Docker Compose spec
*/
-export function validateDependencyConditions(
- dependencies: Array<{ service: string; condition: string }>
-): { valid: boolean; errors: string[] } {
+export function validateDependencyConditions(dependencies: Array<{ service: string; condition: string }>): { valid: boolean; errors: string[] } {
const errors: string[] = [];
const validConditions = ['service_started', 'service_healthy', 'service_completed_successfully'];
@@ -1288,9 +1202,7 @@ export function validateDependencyConditions(
}
if (!validConditions.includes(dep.condition)) {
- errors.push(
- `Invalid dependency condition '${dep.condition}' for service '${dep.service}'. Valid conditions: ${validConditions.join(', ')}`
- );
+ errors.push(`Invalid dependency condition '${dep.condition}' for service '${dep.service}'. Valid conditions: ${validConditions.join(', ')}`);
}
}
@@ -1304,21 +1216,13 @@ export function validateDependencyConditions(
* Check if a service has a healthcheck defined
*/
export function hasHealthcheck(serviceConfig: any): boolean {
- return !!(
- serviceConfig?.healthcheck &&
- serviceConfig.healthcheck !== false &&
- serviceConfig.healthcheck.disable !== true
- );
+ return !!(serviceConfig?.healthcheck && serviceConfig.healthcheck !== false && serviceConfig.healthcheck.disable !== true);
}
/**
* Get service dependency chain for debugging
*/
-export function getDependencyChain(
- services: Record<string, any>,
- startService: string,
- visited = new Set<string>()
-): string[] {
+export function getDependencyChain(services: Record<string, any>, startService: string, visited = new Set<string>()): string[] {
if (visited.has(startService)) {
return []; // Circular dependency detected
}
@@ -1411,9 +1315,7 @@ export function resolveDependencyOrderWithConditions(services: Record<string, an
// First check for circular dependencies
const circularCheck = detectCircularDependencies(services);
if (circularCheck.hasCircular) {
- warnings.push(
- `Circular dependencies detected: ${circularCheck.cycles.map((cycle) => cycle.join(' -> ')).join(', ')}`
- );
+ warnings.push(`Circular dependencies detected: ${circularCheck.cycles.map((cycle) => cycle.join(' -> ')).join(', ')}`);
}
// Build dependency graph
@@ -1489,9 +1391,7 @@ export function resolveDependencyOrderWithConditions(services: Record<string, an
// Check if all services were processed (detect remaining cycles)
if (result.length !== Object.keys(services).length) {
const remaining = Object.keys(services).filter((name) => !result.includes(name));
- warnings.push(
- `Could not resolve dependencies for services: ${remaining.join(', ')} (possible circular dependencies)`
- );
+ warnings.push(`Could not resolve dependencies for services: ${remaining.join(', ')} (possible circular dependencies)`);
// Add remaining services to the end
result.push(...remaining);
}
@@ -1563,10 +1463,7 @@ export function createDependencyWaitConfig(
/**
* Check if a dependency condition can be satisfied
*/
-export function canSatisfyDependencyCondition(
- condition: string,
- serviceConfig: any
-): { canSatisfy: boolean; reason?: string } {
+export function canSatisfyDependencyCondition(condition: string, serviceConfig: any): { canSatisfy: boolean; reason?: string } {
switch (condition) {
case 'service_started':
return { canSatisfy: true };
@@ -1575,8 +1472,7 @@ export function canSatisfyDependencyCondition(
if (!hasHealthcheck(serviceConfig)) {
return {
canSatisfy: false,
- reason:
- 'Service has no healthcheck defined but dependency requires service_healthy condition'
+ reason: 'Service has no healthcheck defined but dependency requires service_healthy condition'
};
}
return { canSatisfy: true };
@@ -1607,18 +1503,13 @@ export function validateAllDependencies(services: Record<string, any>): {
// Check for circular dependencies
const circularCheck = detectCircularDependencies(services);
if (circularCheck.hasCircular) {
- errors.push(
- `Circular dependencies detected: ${circularCheck.cycles.map((cycle) => cycle.join(' -> ')).join(', ')}`
- );
+ errors.push(`Circular dependencies detected: ${circularCheck.cycles.map((cycle) => cycle.join(' -> ')).join(', ')}`);
}
// Validate each service's dependencies
for (const [serviceName, serviceConfig] of Object.entries(services)) {
if (serviceConfig?.depends_on) {
- const { dependencies, warnings: depWarnings } = createDependencyWaitConfig(
- serviceName,
- serviceConfig
- );
+ const { dependencies, warnings: depWarnings } = createDependencyWaitConfig(serviceName, serviceConfig);
warnings.push(...depWarnings);
// Check if dependency services exist and can satisfy conditions
@@ -1632,9 +1523,7 @@ export function validateAllDependencies(services: Record<string, any>): {
const satisfyCheck = canSatisfyDependencyCondition(dep.condition, dependencyServiceConfig);
if (!satisfyCheck.canSatisfy) {
- warnings.push(
- `Service '${serviceName}' dependency on '${dep.service}' with condition '${dep.condition}': ${satisfyCheck.reason}`
- );
+ warnings.push(`Service '${serviceName}' dependency on '${dep.service}' with condition '${dep.condition}': ${satisfyCheck.reason}`);
}
}
}
@@ -1698,11 +1587,7 @@ export function validateProfiles(composeData: ComposeSpecification): {
// Check if profiles are defined at top level
const topLevelProfiles = composeData.profiles;
- if (
- topLevelProfiles &&
- !Array.isArray(topLevelProfiles) &&
- typeof topLevelProfiles !== 'object'
- ) {
+ if (topLevelProfiles && !Array.isArray(topLevelProfiles) && typeof topLevelProfiles !== 'object') {
errors.push('Top-level profiles must be an array or object');
}
@@ -1719,9 +1604,7 @@ export function validateProfiles(composeData: ComposeSpecification): {
// Array of profiles
for (const profile of serviceConfig.profiles) {
if (typeof profile !== 'string') {
- errors.push(
- `Service '${serviceName}' has invalid profile type. Profiles must be strings.`
- );
+ errors.push(`Service '${serviceName}' has invalid profile type. Profiles must be strings.`);
}
if (!profile.trim()) {
errors.push(`Service '${serviceName}' has empty profile name.`);
@@ -1792,26 +1675,17 @@ export function getAllDefinedProfiles(composeData: ComposeSpecification): string
/**
* Check if a service should be deployed based on active profiles
*/
-export function shouldDeployService(
- serviceConfig: ServiceConfig,
- activeProfiles: string[],
- defaultBehavior: 'include' | 'exclude' = 'include'
-): ProfileDeploymentCheck {
+export function shouldDeployService(serviceConfig: ServiceConfig, activeProfiles: string[], defaultBehavior: 'include' | 'exclude' = 'include'): ProfileDeploymentCheck {
// If no profiles are specified on the service, use default behavior
if (!serviceConfig.profiles) {
return {
shouldDeploy: defaultBehavior === 'include',
- reason:
- defaultBehavior === 'include'
- ? 'No profiles specified, included by default'
- : 'No profiles specified, excluded by default'
+ reason: defaultBehavior === 'include' ? 'No profiles specified, included by default' : 'No profiles specified, excluded by default'
};
}
// Normalize service profiles to array
- const serviceProfiles = Array.isArray(serviceConfig.profiles)
- ? serviceConfig.profiles
- : [serviceConfig.profiles];
+ const serviceProfiles = Array.isArray(serviceConfig.profiles) ? serviceConfig.profiles : [serviceConfig.profiles];
// Check if any of the service's profiles are in the active profiles
const matchingProfiles = serviceProfiles.filter((profile) => activeProfiles.includes(profile));
@@ -1832,10 +1706,7 @@ export function shouldDeployService(
/**
* Filter services based on profiles
*/
-export function filterServicesByProfiles(
- services: Record<string, ServiceConfig>,
- activeProfiles: string[]
-): ProfileServiceFiltering {
+export function filterServicesByProfiles(services: Record<string, ServiceConfig>, activeProfiles: string[]): ProfileServiceFiltering {
const deployableServices: Record<string, ServiceConfig> = {};
const skippedServices: Array<{ name: string; reason: string }> = [];
@@ -1867,10 +1738,7 @@ export function filterServicesByProfiles(
/**
* Resolve profile dependencies and conflicts
*/
-export function resolveProfileDependencies(
- composeData: ComposeSpecification,
- requestedProfiles: string[]
-): ProfileResolution {
+export function resolveProfileDependencies(composeData: ComposeSpecification, requestedProfiles: string[]): ProfileResolution {
const warnings: string[] = [];
const errors: string[] = [];
const resolvedProfiles = new Set(requestedProfiles);
@@ -1881,11 +1749,7 @@ export function resolveProfileDependencies(
}
// Check for profile definitions and dependencies
- if (
- composeData.profiles &&
- typeof composeData.profiles === 'object' &&
- !Array.isArray(composeData.profiles)
- ) {
+ if (composeData.profiles && typeof composeData.profiles === 'object' && !Array.isArray(composeData.profiles)) {
for (const [profileName, profileConfig] of Object.entries(composeData.profiles)) {
if (resolvedProfiles.has(profileName) && profileConfig && typeof profileConfig === 'object') {
// Handle profile dependencies
@@ -1893,9 +1757,7 @@ export function resolveProfileDependencies(
for (const dependency of profileConfig.depends_on) {
if (typeof dependency === 'string') {
resolvedProfiles.add(dependency);
- warnings.push(
- `Profile '${profileName}' requires profile '${dependency}' - added automatically`
- );
+ warnings.push(`Profile '${profileName}' requires profile '${dependency}' - added automatically`);
}
}
}
@@ -1930,10 +1792,7 @@ export function resolveProfileDependencies(
/**
* Create deployment plan based on profiles
*/
-export function createProfileDeploymentPlan(
- composeData: ComposeSpecification,
- activeProfiles: string[]
-): ProfileDeploymentPlan {
+export function createProfileDeploymentPlan(composeData: ComposeSpecification, activeProfiles: string[]): ProfileDeploymentPlan {
const warnings: string[] = [];
const errors: string[] = [];
@@ -1950,10 +1809,7 @@ export function createProfileDeploymentPlan(
const finalActiveProfiles = resolution.resolvedProfiles;
// Filter services by profiles
- const serviceFiltering = filterServicesByProfiles(
- composeData.services || {},
- finalActiveProfiles
- );
+ const serviceFiltering = filterServicesByProfiles(composeData.services || {}, finalActiveProfiles);
// Determine volumes and networks needed for deployable services
const volumesToCreate = new Set<string>();
@@ -1998,9 +1854,7 @@ export function createProfileDeploymentPlan(
// Only include networks that are actually defined in the compose file
const definedNetworks = composeData.networks ? Object.keys(composeData.networks) : [];
- const filteredNetworks = Array.from(networksToCreate).filter((net) =>
- definedNetworks.includes(net)
- );
+ const filteredNetworks = Array.from(networksToCreate).filter((net) => definedNetworks.includes(net));
return {
plan: {
@@ -2064,10 +1918,7 @@ export function applyProfileFiltering(
}
// Always ensure default network exists if no networks specified
- if (
- Object.keys(filteredComposeData.networks!).length === 0 &&
- Object.keys(filteredComposeData.services!).length > 0
- ) {
+ if (Object.keys(filteredComposeData.networks!).length === 0 && Object.keys(filteredComposeData.services!).length > 0) {
filteredComposeData.networks!.default = {
driver: 'bridge'
};
@@ -2098,9 +1949,7 @@ export function getProfileUsageStats(composeData: ComposeSpecification): Profile
for (const [serviceName, serviceConfig] of Object.entries(composeData.services)) {
if (serviceConfig && typeof serviceConfig === 'object') {
if (serviceConfig.profiles) {
- const serviceProfiles = Array.isArray(serviceConfig.profiles)
- ? serviceConfig.profiles
- : [serviceConfig.profiles];
+ const serviceProfiles = Array.isArray(serviceConfig.profiles) ? serviceConfig.profiles : [serviceConfig.profiles];
servicesWithProfiles.push({
service: serviceName,
@@ -2121,13 +1970,11 @@ export function getProfileUsageStats(composeData: ComposeSpecification): Profile
}
}
- const profilesWithServices = Array.from(profileServiceMap.entries()).map(
- ([profile, services]) => ({
- profile,
- serviceCount: services.length,
- services: services.sort()
- })
- );
+ const profilesWithServices = Array.from(profileServiceMap.entries()).map(([profile, services]) => ({
+ profile,
+ serviceCount: services.length,
+ services: services.sort()
+ }));
return {
totalProfiles: allProfiles.length,
diff --git a/frontend/src/lib/utils/form.utils.ts b/frontend/src/lib/utils/form.utils.ts
index a35395a51..942212596 100644
--- a/frontend/src/lib/utils/form.utils.ts
+++ b/frontend/src/lib/utils/form.utils.ts
@@ -1,6 +1,123 @@
+import { get, writable } from 'svelte/store';
+import { z } from 'zod/v4';
+
export function preventDefault(fn: (event: Event) => any) {
return function (this: any, event: Event) {
event.preventDefault();
fn.call(this, event);
};
}
+
+export type FormInput<T> = {
+ value: T;
+ error: string | null;
+};
+
+type FormInputs<T> = {
+ [K in keyof T]: FormInput<T[K]>;
+};
+
+export function createForm<T extends z.ZodType<any, any>>(schema: T, initialValues: z.infer<T>) {
+ // Create a writable store for the inputs
+ const inputsStore = writable<FormInputs<z.infer<T>>>(initializeInputs(initialValues));
+ const errorsStore = writable<z.ZodError<any> | undefined>();
+
+ function initializeInputs(initialValues: z.infer<T>): FormInputs<z.infer<T>> {
+ const inputs: FormInputs<z.infer<T>> = {} as FormInputs<z.infer<T>>;
+ for (const key in initialValues) {
+ if (Object.prototype.hasOwnProperty.call(initialValues, key)) {
+ inputs[key as keyof z.infer<T>] = {
+ value: initialValues[key as keyof z.infer<T>],
+ error: null
+ };
+ }
+ }
+ return inputs;
+ }
+
+ function validate() {
+ let success = true;
+ inputsStore.update((inputs) => {
+ // Extract values from inputs to validate against the schema
+ const values = Object.fromEntries(Object.entries(inputs).map(([key, input]) => [key, input.value]));
+
+ const result = schema.safeParse(values);
+ errorsStore.set(result.error);
+
+ if (!result.success) {
+ success = false;
+ for (const input of Object.keys(inputs)) {
+ const error = result.error.issues.find((e) => e.path[0] === input);
+ if (error) {
+ inputs[input as keyof z.infer<T>].error = error.message;
+ } else {
+ inputs[input as keyof z.infer<T>].error = null;
+ }
+ }
+ } else {
+ for (const input of Object.keys(inputs)) {
+ inputs[input as keyof z.infer<T>].error = null;
+ }
+ }
+ return inputs;
+ });
+ return success ? data() : null;
+ }
+
+ function data() {
+ const inputs = get(inputsStore);
+
+ const values = Object.fromEntries(
+ Object.entries(inputs).map(([key, input]) => {
+ input.value = trimValue(input.value);
+ return [key, input.value];
+ })
+ ) as z.infer<T>;
+
+ return values;
+ }
+
+ function reset() {
+ inputsStore.update((inputs) => {
+ for (const input of Object.keys(inputs)) {
+ inputs[input as keyof z.infer<T>] = {
+ value: initialValues[input as keyof z.infer<T>],
+ error: null
+ };
+ }
+ return inputs;
+ });
+ }
+
+ function setValue(key: keyof z.infer<T>, value: z.infer<T>[keyof z.infer<T>]) {
+ inputsStore.update((inputs) => {
+ inputs[key].value = value;
+ return inputs;
+ });
+ }
+
+ // Trims whitespace from string values and arrays of strings
+ function trimValue(value: any) {
+ if (typeof value === 'string') {
+ value = value.trim();
+ } else if (Array.isArray(value)) {
+ value = value.map((item: any) => {
+ if (typeof item === 'string') {
+ return item.trim();
+ }
+ return item;
+ });
+ }
+ return value;
+ }
+
+ return {
+ schema,
+ inputs: inputsStore,
+ errors: errorsStore,
+ data,
+ validate,
+ setValue,
+ reset
+ };
+}
diff --git a/frontend/src/lib/utils/registry.utils.ts b/frontend/src/lib/utils/registry.utils.ts
index b4d0383e9..0d7bd6fbb 100644
--- a/frontend/src/lib/utils/registry.utils.ts
+++ b/frontend/src/lib/utils/registry.utils.ts
@@ -18,11 +18,7 @@ export function areRegistriesEquivalent(url1: string, url2: string): boolean {
if (normalized.startsWith('https://')) normalized = normalized.substring(8);
if (normalized.endsWith('/')) normalized = normalized.slice(0, -1);
// Common Docker Hub aliases
- if (
- normalized === 'index.docker.io' ||
- normalized === 'registry-1.docker.io' ||
- normalized === 'auth.docker.io'
- ) {
+ if (normalized === 'index.docker.io' || normalized === 'registry-1.docker.io' || normalized === 'auth.docker.io') {
return 'docker.io';
}
return normalized;
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index 08f0b6a24..8e15d5864 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -1,72 +1,56 @@
<script lang="ts">
- import "../app.css";
- import { ModeWatcher } from "mode-watcher";
- import { Toaster } from "$lib/components/ui/sonner/index.js";
- import { navigating, page } from "$app/state";
- import ConfirmDialog from "$lib/components/confirm-dialog/confirm-dialog.svelte";
- import * as Sidebar from "$lib/components/ui/sidebar/index.js";
- import AppSidebar from "$lib/components/sidebar/sidebar.svelte";
- import { onMount } from "svelte";
- import { goto } from "$app/navigation";
- import { initializeClientStores } from "$lib/stores/client-init";
+ import '../app.css';
+ import { ModeWatcher } from 'mode-watcher';
+ import { Toaster } from '$lib/components/ui/sonner/index.js';
+ import { navigating, page } from '$app/state';
+ import ConfirmDialog from '$lib/components/confirm-dialog/confirm-dialog.svelte';
+ import * as Sidebar from '$lib/components/ui/sidebar/index.js';
+ import AppSidebar from '$lib/components/sidebar/sidebar.svelte';
+ import { onMount } from 'svelte';
+ import { goto } from '$app/navigation';
+ import { initializeClientStores } from '$lib/stores/client-init';
- let { children, data } = $props();
+ let { children, data } = $props();
- const versionInformation = data.versionInformation;
- const user = $derived(data.user);
- const agents = $derived(data.agents);
- const isNavigating = $derived(navigating.type !== null);
- const isAuthenticated = $derived(!!user);
+ const versionInformation = data.versionInformation;
+ const user = $derived(data.user);
+ const agents = $derived(data.agents);
+ const isNavigating = $derived(navigating.type !== null);
+ const isAuthenticated = $derived(!!user);
- const isOnboardingPage = $derived(
- page.url.pathname.startsWith("/onboarding")
- );
- const isLoginPage = $derived(
- page.url.pathname === "/login" ||
- page.url.pathname.startsWith("/auth/login") ||
- page.url.pathname === "/auth" ||
- page.url.pathname.includes("/login")
- );
- const showSidebar = $derived(
- isAuthenticated && !isOnboardingPage && !isLoginPage
- );
+ const isOnboardingPage = $derived(page.url.pathname.startsWith('/onboarding'));
+ const isLoginPage = $derived(page.url.pathname === '/login' || page.url.pathname.startsWith('/auth/login') || page.url.pathname === '/auth' || page.url.pathname.includes('/login'));
+ const showSidebar = $derived(isAuthenticated && !isOnboardingPage && !isLoginPage);
- $effect(() => {
- const path = page.url.pathname;
+ $effect(() => {
+ const path = page.url.pathname;
- const publicPaths = [
- "/auth/login",
- "/auth/logout",
- "/auth/oidc/login",
- "/auth/oidc/callback",
- "/img",
- "/favicon.ico",
- ];
+ const publicPaths = ['/auth/login', '/auth/logout', '/auth/oidc/login', '/auth/oidc/callback', '/img', '/favicon.ico'];
- const isPublicPath = publicPaths.some((p) => path.startsWith(p));
+ const isPublicPath = publicPaths.some((p) => path.startsWith(p));
- if (!isPublicPath && !data.isAuthenticated) {
- fetch("/api/auth/me", {
- credentials: "include",
- })
- .then((response) => {
- if (!response.ok) {
- goto(`/auth/login?redirect=${encodeURIComponent(path)}`);
- }
- })
- .catch(() => {
- goto(`/auth/login?redirect=${encodeURIComponent(path)}`);
- });
- }
- });
+ if (!isPublicPath && !data.isAuthenticated) {
+ fetch('/api/auth/me', {
+ credentials: 'include'
+ })
+ .then((response) => {
+ if (!response.ok) {
+ goto(`/auth/login?redirect=${encodeURIComponent(path)}`);
+ }
+ })
+ .catch(() => {
+ goto(`/auth/login?redirect=${encodeURIComponent(path)}`);
+ });
+ }
+ });
- onMount(() => {
- const init = async () => {
- await initializeClientStores();
- };
+ onMount(() => {
+ const init = async () => {
+ await initializeClientStores();
+ };
- init();
- });
+ init();
+ });
</script>
<svelte:head><title>Arcane</title></svelte:head>
@@ -77,29 +61,24 @@
<!-- Loading Indicator -->
{#if isNavigating}
- <div class="fixed top-0 right-0 left-0 z-50 h-2">
- <div class="bg-primary h-full animate-pulse"></div>
- </div>
+ <div class="fixed top-0 right-0 left-0 z-50 h-2">
+ <div class="bg-primary h-full animate-pulse"></div>
+ </div>
{/if}
<div class="bg-background flex min-h-screen">
- {#if showSidebar}
- <Sidebar.Provider>
- <AppSidebar
- hasLocalDocker={data.hasLocalDocker || false}
- agents={agents || []}
- {versionInformation}
- {user}
- />
- <main class="flex-1">
- <section class="p-6">
- {@render children()}
- </section>
- </main>
- </Sidebar.Provider>
- {:else}
- <main class="flex-1">
- {@render children()}
- </main>
- {/if}
+ {#if showSidebar}
+ <Sidebar.Provider>
+ <AppSidebar hasLocalDocker={data.hasLocalDocker || false} agents={agents || []} {versionInformation} {user} />
+ <main class="flex-1">
+ <section class="p-6">
+ {@render children()}
+ </section>
+ </main>
+ </Sidebar.Provider>
+ {:else}
+ <main class="flex-1">
+ {@render children()}
+ </main>
+ {/if}
</div>
diff --git a/frontend/src/routes/+layout.ts b/frontend/src/routes/+layout.ts
index cd152d443..92df31c8d 100644
--- a/frontend/src/routes/+layout.ts
+++ b/frontend/src/routes/+layout.ts
@@ -25,14 +25,7 @@ export const load = async ({ fetch, url }) => {
const path = url.pathname;
- const publicPaths = [
- '/auth/login',
- '/auth/logout',
- '/auth/oidc/login',
- '/auth/oidc/callback',
- '/img',
- '/favicon.ico'
- ];
+ const publicPaths = ['/auth/login', '/auth/logout', '/auth/oidc/login', '/auth/oidc/callback', '/img', '/favicon.ico'];
const isPublicPath = publicPaths.some((p) => path.startsWith(p));
let settings: any = null;
@@ -106,9 +99,7 @@ export const load = async ({ fetch, url }) => {
currentVersion: '0.15.0'
} as AppVersionInformation;
} else {
- const cacheExpired =
- versionInformationLastUpdated &&
- Date.now() - versionInformationLastUpdated > 1000 * 60 * 60 * 3;
+ const cacheExpired = versionInformationLastUpdated && Date.now() - versionInformationLastUpdated > 1000 * 60 * 60 * 3;
if (!versionInformation || cacheExpired) {
try {
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index 4b5cd9762..2d556466e 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -471,7 +471,11 @@
<section>
<h2 class="mb-4 text-lg font-semibold tracking-tight">Quick Actions</h2>
<div class="grid grid-cols-1 gap-5 sm:grid-cols-3">
- <button class="group bg-card relative flex flex-col items-center rounded-xl border p-6 shadow-sm transition-all hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm" disabled={!dashboardStates.dockerInfo || stoppedContainers === 0 || isLoading.starting || isLoading.stopping || isLoading.pruning} onclick={handleStartAll}>
+ <button
+ class="group bg-card relative flex flex-col items-center rounded-xl border p-6 shadow-sm transition-all hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
+ disabled={!dashboardStates.dockerInfo || stoppedContainers === 0 || isLoading.starting || isLoading.stopping || isLoading.pruning}
+ onclick={handleStartAll}
+ >
<div class="mb-4 flex size-12 items-center justify-center rounded-full bg-green-500/10 transition-colors group-hover:bg-green-500/20">
{#if isLoading.starting}
<Loader2 class="size-6 animate-spin text-green-500" />
@@ -483,7 +487,11 @@
<span class="text-muted-foreground mt-1 text-sm">{stoppedContainers} containers</span>
</button>
- <button class="group bg-card relative flex flex-col items-center rounded-xl border p-6 shadow-sm transition-all hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm" disabled={!dashboardStates.dockerInfo || runningContainers === 0 || isLoading.starting || isLoading.stopping || isLoading.pruning} onclick={handleStopAll}>
+ <button
+ class="group bg-card relative flex flex-col items-center rounded-xl border p-6 shadow-sm transition-all hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
+ disabled={!dashboardStates.dockerInfo || runningContainers === 0 || isLoading.starting || isLoading.stopping || isLoading.pruning}
+ onclick={handleStopAll}
+ >
<div class="mb-4 flex size-12 items-center justify-center rounded-full bg-blue-500/10 transition-colors group-hover:bg-blue-500/20">
{#if isLoading.stopping}
<Loader2 class="size-6 animate-spin text-blue-500" />
@@ -495,7 +503,11 @@
<span class="text-muted-foreground mt-1 text-sm">{runningContainers}</span>
</button>
- <button class="group bg-card hover:border-destructive/50 disabled:hover:border-border relative flex flex-col items-center rounded-xl border p-6 shadow-sm transition-all hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm" disabled={!dashboardStates.dockerInfo || isLoading.starting || isLoading.stopping || isLoading.pruning} onclick={() => (dashboardStates.isPruneDialogOpen = true)}>
+ <button
+ class="group bg-card hover:border-destructive/50 disabled:hover:border-border relative flex flex-col items-center rounded-xl border p-6 shadow-sm transition-all hover:shadow-md disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:shadow-sm"
+ disabled={!dashboardStates.dockerInfo || isLoading.starting || isLoading.stopping || isLoading.pruning}
+ onclick={() => (dashboardStates.isPruneDialogOpen = true)}
+ >
<div class="mb-4 flex size-12 items-center justify-center rounded-full bg-red-500/10 transition-colors group-hover:bg-red-500/20">
{#if isLoading.pruning}
<Loader2 class="size-6 animate-spin text-red-500" />
diff --git a/frontend/src/routes/+page.ts b/frontend/src/routes/+page.ts
index 0f357ed86..0c44d1c96 100644
--- a/frontend/src/routes/+page.ts
+++ b/frontend/src/routes/+page.ts
@@ -3,12 +3,7 @@ import { containerAPI, imageAPI, systemAPI, settingsAPI } from '$lib/services/ap
export const load = async () => {
try {
// Remove systemStats from initial load for faster dashboard loading
- const [dockerInfo, containers, images, settings] = await Promise.all([
- systemAPI.getDockerInfo(),
- containerAPI.list(true),
- imageAPI.list(),
- settingsAPI.getSettings()
- ]);
+ const [dockerInfo, containers, images, settings] = await Promise.all([systemAPI.getDockerInfo(), containerAPI.list(true), imageAPI.list(), settingsAPI.getSettings()]);
return {
dockerInfo,
diff --git a/frontend/src/routes/agents/+page.svelte b/frontend/src/routes/agents/+page.svelte
index d3e4c710d..8df3e5dcf 100644
--- a/frontend/src/routes/agents/+page.svelte
+++ b/frontend/src/routes/agents/+page.svelte
@@ -3,18 +3,7 @@
import { goto, invalidateAll } from '$app/navigation';
import type { Agent } from '$lib/types/agent.type';
import { formatDistanceToNow } from 'date-fns';
- import {
- RefreshCw,
- AlertCircle,
- Loader2,
- Monitor,
- CheckCircle,
- Eye,
- Send,
- Container,
- HardDrive,
- Trash2
- } from '@lucide/svelte';
+ import { RefreshCw, AlertCircle, Loader2, Monitor, CheckCircle, Eye, Send, Container, HardDrive, Trash2 } from '@lucide/svelte';
import { toast } from 'svelte-sonner';
import { getActualAgentStatus } from '$lib/utils/agent-status.utils';
import { openConfirmDialog } from '$lib/components/confirm-dialog/index.js';
@@ -131,11 +120,7 @@
<h1 class="text-3xl font-bold text-gray-900 dark:text-white">Agent Management</h1>
<p class="mt-1 text-gray-600 dark:text-gray-400">Manage and monitor your remote agents</p>
</div>
- <button
- onclick={loadAgents}
- class="flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50"
- disabled={loading}
- >
+ <button onclick={loadAgents} class="flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50" disabled={loading}>
{#if loading}
<Loader2 class="h-4 w-4 animate-spin" />
{:else}
@@ -147,9 +132,7 @@
<!-- Error Message -->
{#if error}
- <div
- class="mb-6 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400"
- >
+ <div class="mb-6 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-400">
<div class="flex items-center gap-2">
<AlertCircle class="h-5 w-5" />
<strong>Error:</strong>
@@ -164,54 +147,32 @@
<div class="py-16 text-center">
<Monitor class="mx-auto mb-4 h-16 w-16 text-gray-400" />
<h3 class="mb-2 text-lg font-medium text-gray-900 dark:text-white">No agents registered</h3>
- <p class="mb-4 text-gray-600 dark:text-gray-400">
- Get started by connecting your first agent
- </p>
+ <p class="mb-4 text-gray-600 dark:text-gray-400">Get started by connecting your first agent</p>
<div class="mx-auto max-w-md rounded-lg bg-gray-50 p-4 dark:bg-gray-800">
- <p class="text-sm text-gray-600 dark:text-gray-400">
- Make sure your Go agent is running and connecting to:
- </p>
- <code
- class="mt-2 inline-block rounded bg-gray-100 px-2 py-1 font-mono text-sm text-gray-800 dark:bg-gray-700 dark:text-gray-200"
- >
- http://localhost:3000/agent/register
- </code>
+ <p class="text-sm text-gray-600 dark:text-gray-400">Make sure your Go agent is running and connecting to:</p>
+ <code class="mt-2 inline-block rounded bg-gray-100 px-2 py-1 font-mono text-sm text-gray-800 dark:bg-gray-700 dark:text-gray-200"> http://localhost:3000/agent/register </code>
</div>
</div>
{:else}
<!-- Agents Grid -->
<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
{#each agents as agent}
- <div
- class="rounded-xl border border-gray-200 bg-white p-6 transition-shadow hover:shadow-lg dark:border-gray-700 dark:bg-gray-800"
- >
+ <div class="rounded-xl border border-gray-200 bg-white p-6 transition-shadow hover:shadow-lg dark:border-gray-700 dark:bg-gray-800">
<!-- Agent Header -->
<div class="mb-4 flex items-start justify-between">
<div class="flex items-center gap-3">
<div class="relative">
- <div
- class="flex h-12 w-12 items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-700"
- >
+ <div class="flex h-12 w-12 items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-700">
<Monitor class="h-6 w-6 text-gray-600 dark:text-gray-400" />
</div>
- <div
- class="absolute -top-1 -right-1 h-4 w-4 {getStatusColor(
- agent
- )} rounded-full border-2 border-white dark:border-gray-800"
- ></div>
+ <div class="absolute -top-1 -right-1 h-4 w-4 {getStatusColor(agent)} rounded-full border-2 border-white dark:border-gray-800"></div>
</div>
<div>
<h3 class="font-semibold text-gray-900 dark:text-white">{agent.hostname}</h3>
<p class="font-mono text-xs text-gray-500 dark:text-gray-400">{agent.id}</p>
</div>
</div>
- <span
- class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {getActualAgentStatus(
- agent
- ) === 'online'
- ? 'bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400'
- : 'bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400'}"
- >
+ <span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {getActualAgentStatus(agent) === 'online' ? 'bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400' : 'bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400'}">
{getStatusText(agent)}
</span>
</div>
@@ -231,9 +192,7 @@
<!-- Resource Metrics -->
{#if agent.metrics}
- <div
- class="grid grid-cols-2 gap-2 border-t border-gray-100 py-3 dark:border-gray-700"
- >
+ <div class="grid grid-cols-2 gap-2 border-t border-gray-100 py-3 dark:border-gray-700">
<div class="text-center">
<div class="mb-1 flex items-center justify-center gap-1">
<Container class="h-3 w-3 text-blue-600 dark:text-blue-400" />
@@ -263,9 +222,7 @@
<span class="text-sm text-gray-500 dark:text-gray-400">Capabilities</span>
<div class="mt-1 flex flex-wrap gap-1">
{#each agent.capabilities as capability}
- <span
- class="inline-flex items-center rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/20 dark:text-blue-400"
- >
+ <span class="inline-flex items-center rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/20 dark:text-blue-400">
{capability}
</span>
{:else}
@@ -283,41 +240,21 @@
<!-- Connected Status -->
{#if getActualAgentStatus(agent) === 'online'}
- <div
- class="mt-4 rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20"
- >
+ <div class="mt-4 rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20">
<div class="flex items-center gap-2">
<CheckCircle class="h-4 w-4 text-green-600 dark:text-green-400" />
- <p class="text-sm font-medium text-green-700 dark:text-green-400">
- Ready to receive commands
- </p>
+ <p class="text-sm font-medium text-green-700 dark:text-green-400">Ready to receive commands</p>
</div>
</div>
{/if}
<!-- Action Buttons -->
<div class="mt-4 flex gap-2">
- <ArcaneButton
- action="inspect"
- onClick={() => viewAgentDetails(agent.id)}
- label="View Details"
- class="flex-1"
- />
+ <ArcaneButton action="inspect" onClick={() => viewAgentDetails(agent.id)} label="View Details" class="flex-1" />
{#if getActualAgentStatus(agent) === 'online'}
- <ArcaneButton
- action="edit"
- onClick={() => viewAgentDetails(agent.id)}
- label="Manage"
- class="flex-1"
- />
+ <ArcaneButton action="edit" onClick={() => viewAgentDetails(agent.id)} label="Manage" class="flex-1" />
{/if}
- <ArcaneButton
- action="remove"
- onClick={() => deleteAgent(agent.id, agent.hostname)}
- label="Delete"
- loadingLabel="Deleting..."
- class="flex-1"
- />
+ <ArcaneButton action="remove" onClick={() => deleteAgent(agent.id, agent.hostname)} label="Delete" loadingLabel="Deleting..." class="flex-1" />
</div>
</div>
{/each}
@@ -326,9 +263,7 @@
<!-- Show subtle loading indicator during background refresh -->
{#if loading && agents.length > 0}
- <div
- class="fixed right-4 bottom-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg"
- >
+ <div class="fixed right-4 bottom-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg">
<Loader2 class="h-4 w-4 animate-spin" />
<span class="text-sm">Refreshing...</span>
</div>
diff --git a/frontend/src/routes/agents/[agentId]/+page.svelte b/frontend/src/routes/agents/[agentId]/+page.svelte
index c69724f7b..b9e620e22 100644
--- a/frontend/src/routes/agents/[agentId]/+page.svelte
+++ b/frontend/src/routes/agents/[agentId]/+page.svelte
@@ -16,26 +16,7 @@
import { Button } from '$lib/components/ui/button/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
- import {
- Monitor,
- Terminal,
- Clock,
- Settings,
- Activity,
- AlertCircle,
- Server,
- RefreshCw,
- Play,
- ArrowLeft,
- Container,
- HardDrive,
- Layers,
- Network,
- Database,
- Loader2,
- Download,
- Trash2
- } from '@lucide/svelte';
+ import { Monitor, Terminal, Clock, Settings, Activity, AlertCircle, Server, RefreshCw, Play, ArrowLeft, Container, HardDrive, Layers, Network, Database, Loader2, Download, Trash2 } from '@lucide/svelte';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import ImagePullForm from '$lib/components/forms/ImagePullForm.svelte';
import StackDeploymentForm from '$lib/components/forms/StackDeploymentForm.svelte';
@@ -44,7 +25,6 @@
import { openConfirmDialog } from '$lib/components/confirm-dialog/index.js';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util.js';
import { tryCatch } from '$lib/utils/try-catch.js';
-
let { data } = $props();
// Initialize from SSR data
@@ -122,11 +102,7 @@
loading = true;
// Use parallel requests for updates
- const [agentResponse, tasksResponse, deploymentsResponse] = await Promise.allSettled([
- fetch(`/api/agents/${agentId}`),
- fetch(`/api/agents/${agentId}/tasks?admin=true`),
- fetch(`/api/agents/${agentId}/deployments`)
- ]);
+ const [agentResponse, tasksResponse, deploymentsResponse] = await Promise.allSettled([fetch(`/api/agents/${agentId}`), fetch(`/api/agents/${agentId}/tasks?admin=true`), fetch(`/api/agents/${agentId}/deployments`)]);
// Update agent data
if (agentResponse.status === 'fulfilled' && agentResponse.value.ok) {
@@ -201,10 +177,7 @@
}
const taskId = result.task.id;
- return pollTaskCompletion(
- taskId,
- ['containers', 'images', 'networks', 'volumes', 'stacks'][index]
- );
+ return pollTaskCompletion(taskId, ['containers', 'images', 'networks', 'volumes', 'stacks'][index]);
})
);
@@ -225,9 +198,7 @@
results.forEach((result, index) => {
if (result.status === 'fulfilled' && result.value) {
- const resourceType = ['containers', 'images', 'networks', 'volumes', 'stacks'][
- index
- ] as keyof typeof newResourcesData;
+ const resourceType = ['containers', 'images', 'networks', 'volumes', 'stacks'][index] as keyof typeof newResourcesData;
console.log(`Assigning ${result.value.length} items to ${resourceType}:`, result.value);
newResourcesData[resourceType] = result.value;
} else {
@@ -266,9 +237,7 @@
if (response.status === 403) {
console.error(`Authentication failed for task ${taskId}`);
}
- console.error(
- `Failed to fetch task ${taskId}: ${response.status} ${response.statusText}`
- );
+ console.error(`Failed to fetch task ${taskId}: ${response.status} ${response.statusText}`);
continue;
}
@@ -396,8 +365,7 @@
break;
}
- const taskType =
- selectedCommand.value === 'agent_upgrade' ? 'agent_upgrade' : 'docker_command';
+ const taskType = selectedCommand.value === 'agent_upgrade' ? 'agent_upgrade' : 'docker_command';
const response = await fetch(`/api/agents/${agentId}/tasks`, {
method: 'POST',
@@ -463,8 +431,7 @@
function getStatusClasses(agent: Agent) {
const actualStatus = getActualAgentStatus(agent);
- if (actualStatus === 'online')
- return 'bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400';
+ if (actualStatus === 'online') return 'bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400';
return 'bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400';
}
@@ -644,11 +611,7 @@
</div>
<div>
<p class="text-muted-foreground text-sm font-medium">Status</p>
- <span
- class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {getStatusClasses(
- agent
- )}"
- >
+ <span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {getStatusClasses(agent)}">
{getStatusText(agent)}
</span>
</div>
@@ -694,13 +657,7 @@
<!-- Resource Metrics -->
{#if agent.metrics}
- <DropdownCard
- id="agent-metrics"
- title="Resource Metrics"
- description="View detailed Docker resource information"
- defaultExpanded={false}
- icon={Activity}
- >
+ <DropdownCard id="agent-metrics" title="Resource Metrics" description="View detailed Docker resource information" defaultExpanded={false} icon={Activity}>
<!-- Metrics Overview -->
<div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-4">
<div class="rounded-lg bg-blue-50 p-3 text-center dark:bg-blue-900/20">
@@ -739,16 +696,9 @@
<div class="flex items-center justify-between">
<div>
<h4 class="mb-1 font-medium">Resource Details</h4>
- <p class="text-muted-foreground text-sm">
- View detailed information about Docker resources
- </p>
+ <p class="text-muted-foreground text-sm">View detailed information about Docker resources</p>
</div>
- <Button
- variant="outline"
- size="sm"
- onclick={loadResourcesData}
- disabled={resourcesLoading}
- >
+ <Button variant="outline" size="sm" onclick={loadResourcesData} disabled={resourcesLoading}>
{#if resourcesLoading}
<Loader2 class="mr-2 size-4 animate-spin" />
Loading...
@@ -947,19 +897,14 @@
<div class="flex items-center justify-between">
<div>
<h4 class="mb-1 font-medium">Deploy Resources</h4>
- <p class="text-muted-foreground text-sm">
- Deploy stacks, containers, or images to this agent
- </p>
+ <p class="text-muted-foreground text-sm">Deploy stacks, containers, or images to this agent</p>
</div>
</div>
<!-- Quick Deploy Cards -->
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
<!-- Deploy Stack Card -->
- <Card.Root
- class="hover:border-primary/50 cursor-pointer transition-colors"
- onclick={() => (deployDialogOpen = true)}
- >
+ <Card.Root class="hover:border-primary/50 cursor-pointer transition-colors" onclick={() => (deployDialogOpen = true)}>
<Card.Content class="p-4">
<div class="flex items-center space-x-3">
<div class="rounded-lg bg-blue-500/10 p-2">
@@ -967,19 +912,14 @@
</div>
<div>
<h5 class="font-medium">Deploy Stack</h5>
- <p class="text-muted-foreground text-sm">
- Deploy a complete application stack
- </p>
+ <p class="text-muted-foreground text-sm">Deploy a complete application stack</p>
</div>
</div>
</Card.Content>
</Card.Root>
<!-- Pull Image Card -->
- <Card.Root
- class="hover:border-primary/50 cursor-pointer transition-colors"
- onclick={() => (imageDialogOpen = true)}
- >
+ <Card.Root class="hover:border-primary/50 cursor-pointer transition-colors" onclick={() => (imageDialogOpen = true)}>
<Card.Content class="p-4">
<div class="flex items-center space-x-3">
<div class="rounded-lg bg-green-500/10 p-2">
@@ -994,10 +934,7 @@
</Card.Root>
<!-- Quick Container Card -->
- <Card.Root
- class="hover:border-primary/50 cursor-pointer transition-colors"
- onclick={() => (containerDialogOpen = true)}
- >
+ <Card.Root class="hover:border-primary/50 cursor-pointer transition-colors" onclick={() => (containerDialogOpen = true)}>
<Card.Content class="p-4">
<div class="flex items-center space-x-3">
<div class="rounded-lg bg-purple-500/10 p-2">
@@ -1032,20 +969,11 @@
<div>
<p class="text-sm font-medium">{deployment.name}</p>
<p class="text-muted-foreground text-xs">
- {deployment.type} • {formatDistanceToNow(
- new Date(deployment.createdAt)
- )} ago
+ {deployment.type} • {formatDistanceToNow(new Date(deployment.createdAt))} ago
</p>
</div>
</div>
- <StatusBadge
- variant={deployment.status === 'running'
- ? 'green'
- : deployment.status === 'failed'
- ? 'red'
- : 'amber'}
- text={deployment.status}
- />
+ <StatusBadge variant={deployment.status === 'running' ? 'green' : deployment.status === 'failed' ? 'red' : 'amber'} text={deployment.status} />
</div>
{/each}
</div>
@@ -1088,9 +1016,7 @@
<span class="text-muted-foreground text-sm">Capabilities</span>
<div class="mt-1 flex flex-wrap gap-1">
{#each agent.capabilities as capability}
- <span
- class="inline-flex items-center rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/20 dark:text-blue-400"
- >
+ <span class="inline-flex items-center rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/20 dark:text-blue-400">
{capability}
</span>
{:else}
@@ -1141,11 +1067,7 @@
<p class="text-sm font-medium">
{task.type.replace('_', ' ').replace(/\b\w/g, (l) => l.toUpperCase())}
</p>
- <span
- class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {getTaskStatusClasses(
- task.status
- )}"
- >
+ <span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {getTaskStatusClasses(task.status)}">
{task.status}
</span>
</div>
@@ -1169,15 +1091,9 @@
<!-- Show results for completed tasks -->
{#if task.status === 'completed' && task.result}
<details class="mt-2">
- <summary class="cursor-pointer text-xs text-green-600 hover:text-green-500">
- View Output
- </summary>
- <div
- class="bg-muted mt-2 max-h-32 overflow-y-auto rounded p-2 font-mono text-xs whitespace-pre-wrap"
- >
- {typeof task.result === 'string'
- ? task.result
- : JSON.stringify(task.result, null, 2)}
+ <summary class="cursor-pointer text-xs text-green-600 hover:text-green-500"> View Output </summary>
+ <div class="bg-muted mt-2 max-h-32 overflow-y-auto rounded p-2 font-mono text-xs whitespace-pre-wrap">
+ {typeof task.result === 'string' ? task.result : JSON.stringify(task.result, null, 2)}
</div>
</details>
{/if}
@@ -1185,12 +1101,8 @@
<!-- Show errors for failed tasks -->
{#if task.error}
<details class="mt-2">
- <summary class="cursor-pointer text-xs text-red-600 hover:text-red-500">
- View Error
- </summary>
- <div
- class="mt-2 max-h-32 overflow-y-auto rounded bg-red-50 p-2 text-xs text-red-600 dark:bg-red-900/20 dark:text-red-400"
- >
+ <summary class="cursor-pointer text-xs text-red-600 hover:text-red-500"> View Error </summary>
+ <div class="mt-2 max-h-32 overflow-y-auto rounded bg-red-50 p-2 text-xs text-red-600 dark:bg-red-900/20 dark:text-red-400">
{task.error}
</div>
</details>
@@ -1213,10 +1125,7 @@
<Alert.Root variant="destructive">
<AlertCircle class="size-4" />
<Alert.Title>Agent Offline</Alert.Title>
- <Alert.Description
- >This agent is not currently connected. Commands cannot be sent until the agent
- reconnects.</Alert.Description
- >
+ <Alert.Description>This agent is not currently connected. Commands cannot be sent until the agent reconnects.</Alert.Description>
</Alert.Root>
{/if}
{/if}
@@ -1234,12 +1143,7 @@
<div class="space-y-4">
<div>
<Label for="command-select">Command</Label>
- <Select.Root
- type="single"
- value={selectedCommand?.value}
- onValueChange={(v) =>
- (selectedCommand = predefinedCommands.find((cmd) => cmd.value === v))}
- >
+ <Select.Root type="single" value={selectedCommand?.value} onValueChange={(v) => (selectedCommand = predefinedCommands.find((cmd) => cmd.value === v))}>
<Select.Trigger>
<span>{selectedCommand?.label || 'Select a command'}</span>
</Select.Trigger>
@@ -1254,31 +1158,19 @@
{#if selectedCommand?.value === 'custom'}
<div>
<Label for="custom-command">Custom Command</Label>
- <Input
- id="custom-command"
- bind:value={customCommand}
- placeholder="docker ps -a"
- disabled={taskExecuting}
- />
+ <Input id="custom-command" bind:value={customCommand} placeholder="docker ps -a" disabled={taskExecuting} />
</div>
{/if}
{#if selectedCommand && selectedCommand.value !== 'agent_upgrade'}
<div>
<Label for="command-args">Additional Arguments (optional)</Label>
- <Input
- id="command-args"
- bind:value={commandArgs}
- placeholder="--format table"
- disabled={taskExecuting}
- />
+ <Input id="command-args" bind:value={commandArgs} placeholder="--format table" disabled={taskExecuting} />
</div>
{/if}
</div>
<Dialog.Footer>
- <Button variant="outline" onclick={() => (commandDialogOpen = false)} disabled={taskExecuting}
- >Cancel</Button
- >
+ <Button variant="outline" onclick={() => (commandDialogOpen = false)} disabled={taskExecuting}>Cancel</Button>
<Button onclick={sendCommand} disabled={!selectedCommand || taskExecuting}>
{#if taskExecuting}
<RefreshCw class="mr-2 size-4 animate-spin" />
@@ -1300,11 +1192,7 @@
<Dialog.Description>Choose a stack to deploy or create a new one</Dialog.Description>
</Dialog.Header>
- <StackDeploymentForm
- {agentId}
- onClose={() => (deployDialogOpen = false)}
- onDeploy={handleStackDeploy}
- />
+ <StackDeploymentForm {agentId} onClose={() => (deployDialogOpen = false)} onDeploy={handleStackDeploy} />
</Dialog.Content>
</Dialog.Root>
@@ -1328,10 +1216,6 @@
<Dialog.Description>Quickly start a container from an image</Dialog.Description>
</Dialog.Header>
- <QuickContainerForm
- {agentId}
- onClose={() => (containerDialogOpen = false)}
- onRun={handleContainerRun}
- />
+ <QuickContainerForm {agentId} onClose={() => (containerDialogOpen = false)} onRun={handleContainerRun} />
</Dialog.Content>
</Dialog.Root>
diff --git a/frontend/src/routes/agents/[agentId]/+page.ts b/frontend/src/routes/agents/[agentId]/+page.ts
index 22398dd90..bcb231a6b 100644
--- a/frontend/src/routes/agents/[agentId]/+page.ts
+++ b/frontend/src/routes/agents/[agentId]/+page.ts
@@ -7,11 +7,7 @@ export const load: PageLoad = async ({ params }) => {
try {
// Load all data in parallel using API services
- const [agent, tasks, deployments] = await Promise.allSettled([
- agentAPI.get(agentId),
- agentAPI.getTasks(agentId),
- deploymentAPI.getByAgent(agentId)
- ]);
+ const [agent, tasks, deployments] = await Promise.allSettled([agentAPI.get(agentId), agentAPI.getTasks(agentId), deploymentAPI.getByAgent(agentId)]);
// Handle agent not found
if (agent.status === 'rejected' || !agent.value) {
diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte
index 9158bd702..6c78ff8c4 100644
--- a/frontend/src/routes/auth/login/+page.svelte
+++ b/frontend/src/routes/auth/login/+page.svelte
@@ -54,9 +54,7 @@
const showDivider = $derived(showOidcLoginButton && showLocalLoginForm);
</script>
-<div
- class="bg-background/50 flex min-h-screen flex-col items-center justify-center px-4 py-12 sm:px-6 lg:px-8"
->
+<div class="bg-background/50 flex min-h-screen flex-col items-center justify-center px-4 py-12 sm:px-6 lg:px-8">
<div class="w-full max-w-md space-y-8">
<!-- Logo and Title -->
<div class="text-center">
@@ -84,8 +82,7 @@
{:else if data.error === 'oidc_missing_sub'}
Your OIDC provider did not return a subject identifier.
{:else if data.error === 'oidc_email_collision'}
- An account with your email already exists but is linked to a different OIDC identity.
- Please contact an administrator.
+ An account with your email already exists but is linked to a different OIDC identity. Please contact an administrator.
{:else if data.error === 'oidc_token_error'}
There was an error obtaining tokens from the OIDC provider.
{:else if data.error === 'user_processing_failed'}
@@ -109,20 +106,14 @@
<Alert.Root variant="destructive">
<AlertCircle class="mr-2 size-4" />
<Alert.Title>No Login Methods Configured</Alert.Title>
- <Alert.Description
- >There are currently no login methods enabled. Please contact an administrator.</Alert.Description
- >
+ <Alert.Description>There are currently no login methods enabled. Please contact an administrator.</Alert.Description>
</Alert.Root>
{/if}
<!-- OIDC Login Button (when only OIDC is available) -->
{#if showOidcLoginButton && !showLocalLoginForm}
<div class="pt-2">
- <Button
- onclick={handleOidcLogin}
- variant="default"
- class="arcane-button-restart w-full py-6 text-base"
- >
+ <Button onclick={handleOidcLogin} variant="default" class="arcane-button-restart w-full py-6 text-base">
<LogIn class="mr-3 size-5" />
Sign in with OIDC Provider
</Button>
@@ -137,22 +128,10 @@
<div>
<Label for="username" class="mb-1.5 block text-sm font-medium">Username</Label>
<div class="relative">
- <div
- class="text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
- >
+ <div class="text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<User class="size-4" />
</div>
- <Input
- id="username"
- name="username"
- type="text"
- autocomplete="username"
- required
- bind:value={username}
- class="pl-10"
- placeholder="Enter your username or email"
- disabled={loading}
- />
+ <Input id="username" name="username" type="text" autocomplete="username" required bind:value={username} class="pl-10" placeholder="Enter your username or email" disabled={loading} />
</div>
</div>
@@ -160,38 +139,19 @@
<div>
<Label for="password" class="mb-1.5 block text-sm font-medium">Password</Label>
<div class="relative">
- <div
- class="text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
- >
+ <div class="text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<Lock class="size-4" />
</div>
- <Input
- id="password"
- name="password"
- type="password"
- autocomplete="current-password"
- required
- bind:value={password}
- class="pl-10"
- placeholder="Enter your password"
- disabled={loading}
- />
+ <Input id="password" name="password" type="password" autocomplete="current-password" required bind:value={password} class="pl-10" placeholder="Enter your password" disabled={loading} />
</div>
</div>
</div>
<!-- Sign In Button -->
<div class="pt-2">
- <Button
- type="submit"
- class="arcane-button-create w-full py-6 text-base"
- disabled={loading}
- aria-busy={loading}
- >
+ <Button type="submit" class="arcane-button-create w-full py-6 text-base" disabled={loading} aria-busy={loading}>
{#if loading}
- <div
- class="mr-2 size-4 animate-spin rounded-full border-2 border-t-transparent"
- ></div>
+ <div class="mr-2 size-4 animate-spin rounded-full border-2 border-t-transparent"></div>
{/if}
Sign in
</Button>
@@ -212,11 +172,7 @@
<!-- OIDC Login Button (when both methods are available) -->
{#if showOidcLoginButton && showDivider}
- <Button
- onclick={handleOidcLogin}
- variant="outline"
- class="arcane-button-restart w-full py-5"
- >
+ <Button onclick={handleOidcLogin} variant="outline" class="arcane-button-restart w-full py-5">
<LogIn class="mr-2 size-4" />
Sign in with OIDC Provider
</Button>
@@ -226,12 +182,7 @@
<!-- Footer Text -->
<p class="text-muted-foreground text-center text-xs">
- <a
- href="https://github.com/ofkm/arcane"
- target="_blank"
- rel="noopener noreferrer"
- class="text-primary hover:underline">View on GitHub</a
- >
+ <a href="https://github.com/ofkm/arcane" target="_blank" rel="noopener noreferrer" class="text-primary hover:underline">View on GitHub</a>
</p>
</div>
</div>
diff --git a/frontend/src/routes/auth/oidc/callback/+page.svelte b/frontend/src/routes/auth/oidc/callback/+page.svelte
index 3c7d0d817..1c933f2d1 100644
--- a/frontend/src/routes/auth/oidc/callback/+page.svelte
+++ b/frontend/src/routes/auth/oidc/callback/+page.svelte
@@ -27,8 +27,7 @@
if (!authResult.success) {
console.error('OIDC authentication failed via backend:', authResult.error);
error = authResult.error || 'Authentication failed. Please try again.';
- const errorCode =
- authResult.error?.toLowerCase().replace(/\s+/g, '_') || 'oidc_auth_failed';
+ const errorCode = authResult.error?.toLowerCase().replace(/\s+/g, '_') || 'oidc_auth_failed';
setTimeout(() => goto(`/auth/login?error=${errorCode}`), 3000);
isProcessing = false;
return;
@@ -66,12 +65,7 @@
{:else if error}
<div class="text-red-600">
<svg class="mx-auto h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z"
- />
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z" />
</svg>
<h2 class="mt-6 text-2xl font-bold text-gray-900">Authentication Error</h2>
<p class="mt-2 text-sm text-gray-600">{error}</p>
diff --git a/frontend/src/routes/auth/oidc/login/+page.svelte b/frontend/src/routes/auth/oidc/login/+page.svelte
index 1357dae26..a5234bf70 100644
--- a/frontend/src/routes/auth/oidc/login/+page.svelte
+++ b/frontend/src/routes/auth/oidc/login/+page.svelte
@@ -39,18 +39,11 @@
{#if isRedirecting && !error}
<div class="mx-auto h-12 w-12 animate-spin rounded-full border-b-2 border-blue-600"></div>
<h2 class="mt-6 text-2xl font-bold text-gray-900">Redirecting to Login...</h2>
- <p class="mt-2 text-sm text-gray-600">
- Please wait while we redirect you to your identity provider.
- </p>
+ <p class="mt-2 text-sm text-gray-600">Please wait while we redirect you to your identity provider.</p>
{:else if error}
<div class="text-red-600">
<svg class="mx-auto h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z"
- />
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z" />
</svg>
<h2 class="mt-6 text-2xl font-bold text-gray-900">Login Error</h2>
<p class="mt-2 text-sm text-gray-600">{error}</p>
diff --git a/frontend/src/routes/compose/+page.svelte b/frontend/src/routes/compose/+page.svelte
index 63f0b60d8..c15742f01 100644
--- a/frontend/src/routes/compose/+page.svelte
+++ b/frontend/src/routes/compose/+page.svelte
@@ -2,18 +2,7 @@
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 {
- AlertCircle,
- Layers,
- FileStack,
- Loader2,
- Play,
- RotateCcw,
- StopCircle,
- Trash2,
- Ellipsis,
- Pen
- } from '@lucide/svelte';
+ import { AlertCircle, Layers, FileStack, Loader2, Play, RotateCcw, StopCircle, Trash2, Ellipsis, Pen } from '@lucide/svelte';
import UniversalTable from '$lib/components/universal-table.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import * as Table from '$lib/components/ui/table';
@@ -37,9 +26,7 @@
let stacks = $derived(Array.isArray(data.stacks) ? data.stacks : []);
- const isLoading = $state<
- Record<'start' | 'stop' | 'restart' | 'remove' | 'destroy' | 'pull' | 'update', boolean>
- >({
+ const isLoading = $state<Record<'start' | 'stop' | 'restart' | 'remove' | 'destroy' | 'pull' | 'update', boolean>>({
start: false,
stop: false,
restart: false,
@@ -204,19 +191,8 @@
</div>
<div class="flex items-center gap-2">
{#if stacks.length > 0}
- <ArcaneButton
- action="inspect"
- label="Update Compose Projects"
- onClick={() => handleCheckForUpdates()}
- loading={isLoading.update}
- loadingLabel="Updating..."
- disabled={isLoading.update}
- />
- <ArcaneButton
- action="create"
- customLabel="Create Compose Project"
- onClick={() => goto(`/compose/new`)}
- />
+ <ArcaneButton action="inspect" label="Update Compose Projects" onClick={() => handleCheckForUpdates()} loading={isLoading.update} loadingLabel="Updating..." disabled={isLoading.update} />
+ <ArcaneButton action="create" customLabel="Create Compose Project" onClick={() => goto(`/compose/new`)} />
{/if}
</div>
</div>
@@ -250,21 +226,14 @@
}}
>
{#snippet rows({ item })}
- {@const stateVariant = item.status
- ? statusVariantMap[item.status.toLowerCase()]
- : 'gray'}
+ {@const stateVariant = item.status ? statusVariantMap[item.status.toLowerCase()] : 'gray'}
<Table.Cell>
<a class="font-medium hover:underline" href="/compose/{item.id}/">
{item.name}
</a>
</Table.Cell>
<Table.Cell>{item.serviceCount || 0}</Table.Cell>
- <Table.Cell
- ><StatusBadge
- variant={stateVariant}
- text={capitalizeFirstLetter(item.status)}
- /></Table.Cell
- >
+ <Table.Cell><StatusBadge variant={stateVariant} text={capitalizeFirstLetter(item.status)} /></Table.Cell>
<Table.Cell>{formatFriendlyDate(item.createdAt || '')}</Table.Cell>
<Table.Cell>
<DropdownMenu.Root>
@@ -278,19 +247,13 @@
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end">
<DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/compose/${item.id}`)}
- disabled={isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => goto(`/compose/${item.id}`)} disabled={isAnyLoading}>
<Pen class="size-4" />
Edit
</DropdownMenu.Item>
{#if item.status !== 'running'}
- <DropdownMenu.Item
- onclick={() => performStackAction('start', item.id)}
- disabled={isLoading.start || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performStackAction('start', item.id)} disabled={isLoading.start || isAnyLoading}>
{#if isLoading.start}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -299,10 +262,7 @@
Start
</DropdownMenu.Item>
{:else}
- <DropdownMenu.Item
- onclick={() => performStackAction('restart', item.id)}
- disabled={isLoading.restart || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performStackAction('restart', item.id)} disabled={isLoading.restart || isAnyLoading}>
{#if isLoading.restart}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -311,10 +271,7 @@
Restart
</DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => performStackAction('stop', item.id)}
- disabled={isLoading.stop || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performStackAction('stop', item.id)} disabled={isLoading.stop || isAnyLoading}>
{#if isLoading.stop}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -324,10 +281,7 @@
</DropdownMenu.Item>
{/if}
- <DropdownMenu.Item
- onclick={() => performStackAction('pull', item.id)}
- disabled={isLoading.pull || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performStackAction('pull', item.id)} disabled={isLoading.pull || isAnyLoading}>
{#if isLoading.pull}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -338,11 +292,7 @@
<DropdownMenu.Separator />
- <DropdownMenu.Item
- class="focus:text-red-700! text-red-500"
- onclick={() => performStackAction('destroy', item.id)}
- disabled={isLoading.remove || isAnyLoading}
- >
+ <DropdownMenu.Item class="focus:text-red-700! text-red-500" onclick={() => performStackAction('destroy', item.id)} disabled={isLoading.remove || isAnyLoading}>
{#if isLoading.remove}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -360,16 +310,9 @@
<div class="flex flex-col items-center justify-center px-6 py-12 text-center">
<FileStack class="text-muted-foreground mb-4 size-12 opacity-40" />
<p class="text-lg font-medium">No Projects found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new stack using the "Create Project" button above
- </p>
+ <p class="text-muted-foreground mt-1 max-w-md text-sm">Create a new stack using the "Create Project" button above</p>
<div class="mt-4 flex gap-3">
- <ArcaneButton
- action="create"
- customLabel="Create Project"
- onClick={() => goto(`/compose/new`)}
- size="sm"
- />
+ <ArcaneButton action="create" customLabel="Create Project" onClick={() => goto(`/compose/new`)} size="sm" />
</div>
</div>
{/if}
diff --git a/frontend/src/routes/compose/[composeId]/+page.svelte b/frontend/src/routes/compose/[composeId]/+page.svelte
index 229b22367..21b00cd1e 100644
--- a/frontend/src/routes/compose/[composeId]/+page.svelte
+++ b/frontend/src/routes/compose/[composeId]/+page.svelte
@@ -3,27 +3,7 @@
import type { Stack, StackService, StackPort } from '$lib/types/docker/stack.type';
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- ArrowLeft,
- AlertCircle,
- FileStack,
- Layers,
- ArrowRight,
- ExternalLink,
- RefreshCw,
- Terminal,
- Settings,
- Activity,
- FileText,
- Play,
- Square,
- RotateCcw,
- Trash2,
- Send,
- Users,
- Loader2,
- TicketCheck
- } from '@lucide/svelte';
+ import { ArrowLeft, AlertCircle, FileStack, Layers, ArrowRight, ExternalLink, RefreshCw, Terminal, Settings, Activity, FileText, Play, Square, RotateCcw, Trash2, Send, Users, Loader2, TicketCheck } from '@lucide/svelte';
import * as Alert from '$lib/components/ui/alert/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import { Label } from '$lib/components/ui/label/index.js';
@@ -67,11 +47,7 @@
let originalComposeContent = $derived(editorState.originalComposeContent);
let originalEnvContent = $derived(editorState.originalEnvContent || '');
- let hasChanges = $derived(
- name !== originalName ||
- composeContent !== originalComposeContent ||
- envContent !== originalEnvContent
- );
+ let hasChanges = $derived(name !== originalName || composeContent !== originalComposeContent || envContent !== originalEnvContent);
const baseServerUrl = $derived(settings?.baseServerUrl || 'localhost');
@@ -115,9 +91,7 @@
await new Promise((resolve) => setTimeout(resolve, 200));
if (updatedStack && updatedStack.id !== currentStackId) {
- console.log(
- `Stack ID changed from ${currentStackId} to ${updatedStack.id}. Navigating...`
- );
+ console.log(`Stack ID changed from ${currentStackId} to ${updatedStack.id}. Navigating...`);
await goto(`/compose/${name}`, { invalidateAll: true });
} else {
await invalidateAll();
@@ -162,9 +136,7 @@
}
const result = await response.json();
- toast.success(
- `Stack "${data.stack?.name || 'Unknown'}" deployed to agent ${selectedAgent.hostname}!`
- );
+ toast.success(`Stack "${data.stack?.name || 'Unknown'}" deployed to agent ${selectedAgent.hostname}!`);
deployDialogOpen = false;
selectedAgentId = '';
} catch (error) {
@@ -189,11 +161,7 @@
return baseServerUrl;
}
- function getServicePortUrl(
- service: StackService,
- port: string | number | StackPort,
- protocol = 'http'
- ): string {
+ function getServicePortUrl(service: StackService, port: string | number | StackPort, protocol = 'http'): string {
const host = getHostForService(service);
if (typeof port === 'string') {
@@ -274,10 +242,7 @@
{stack.name}
</h1>
{#if stack.status}
- <StatusBadge
- variant={statusVariantMap[stack.status.toLowerCase()] || 'gray'}
- text={capitalizeFirstLetter(stack.status)}
- />
+ <StatusBadge variant={statusVariantMap[stack.status.toLowerCase()] || 'gray'} text={capitalizeFirstLetter(stack.status)} />
{/if}
</div>
</div>
@@ -296,12 +261,7 @@
onActionComplete={() => invalidateAll()}
/>
{#if onlineAgents.length > 0}
- <Button
- variant="outline"
- size="sm"
- onclick={() => (deployDialogOpen = true)}
- disabled={Object.values(isLoading).some(Boolean)}
- >
+ <Button variant="outline" size="sm" onclick={() => (deployDialogOpen = true)} disabled={Object.values(isLoading).some(Boolean)}>
<Send class="mr-2 size-4" />
Deploy to Agent
</Button>
@@ -332,9 +292,7 @@
<button
onclick={() => scrollToSection(section.id)}
class="flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors
- {activeSection === section.id
- ? 'bg-primary/10 text-primary border-primary/20 border'
- : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
+ {activeSection === section.id ? 'bg-primary/10 text-primary border-primary/20 border' : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
>
<IconComponent class="size-4 shrink-0" />
<span class="truncate">{section.label}</span>
@@ -411,12 +369,7 @@
<Card.Content>
<div class="flex flex-wrap gap-2">
{#each allUniquePorts as port (port)}
- <a
- href={getServicePortUrl(stack, port)}
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex items-center rounded-md bg-blue-500/10 px-3 py-2 font-medium text-blue-600 transition-colors hover:bg-blue-500/20 dark:text-blue-400"
- >
+ <a href={getServicePortUrl(stack, port)} target="_blank" rel="noopener noreferrer" class="inline-flex items-center rounded-md bg-blue-500/10 px-3 py-2 font-medium text-blue-600 transition-colors hover:bg-blue-500/20 dark:text-blue-400">
Port {port}
<ExternalLink class="ml-2 size-4" />
</a>
@@ -444,10 +397,7 @@
{#if service.container_id}
<!-- Service with Container ID (clickable) -->
- <a
- href={`/containers/${service.container_id}`}
- class="hover:bg-muted/50 flex items-center justify-between rounded-lg border p-4 transition-colors"
- >
+ <a href={`/containers/${service.container_id}`} class="hover:bg-muted/50 flex items-center justify-between rounded-lg border p-4 transition-colors">
<div class="flex items-center gap-3">
<div class="bg-primary/10 rounded-full p-2">
<Layers class="text-primary size-4" />
@@ -471,9 +421,7 @@
</a>
{:else}
<!-- Service without Container ID (not clickable) -->
- <div
- class="bg-muted/20 flex items-center justify-between rounded-lg border p-4"
- >
+ <div class="bg-muted/20 flex items-center justify-between rounded-lg border p-4">
<div class="flex items-center gap-3">
<div class="bg-muted/50 rounded-full p-2">
<Layers class="text-muted-foreground size-4" />
@@ -495,9 +443,7 @@
</div>
{:else}
<div class="py-12 text-center">
- <div
- class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full"
- >
+ <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
<Layers class="text-muted-foreground size-6" />
</div>
<div class="text-muted-foreground">No services found for this stack</div>
@@ -515,15 +461,7 @@
Configuration
</h2>
{#if hasChanges}
- <ArcaneButton
- action="save"
- loading={isLoading.saving}
- onClick={handleSaveChanges}
- disabled={!hasChanges}
- label="Save Changes"
- loadingLabel="Saving..."
- class="bg-green-600 text-white hover:bg-green-700"
- />
+ <ArcaneButton action="save" loading={isLoading.saving} onClick={handleSaveChanges} disabled={!hasChanges} label="Save Changes" loadingLabel="Saving..." class="bg-green-600 text-white hover:bg-green-700" />
{/if}
</div>
@@ -535,20 +473,9 @@
<Card.Content>
<div class="max-w-md">
<Label for="name" class="mb-2 block">Stack Name</Label>
- <Input
- type="text"
- id="name"
- name="name"
- bind:value={name}
- required
- disabled={isLoading.saving ||
- stack?.status === 'running' ||
- stack?.status === 'partially running'}
- />
+ <Input type="text" id="name" name="name" bind:value={name} required disabled={isLoading.saving || stack?.status === 'running' || stack?.status === 'partially running'} />
{#if stack?.status === 'running' || stack?.status === 'partially running'}
- <p class="text-muted-foreground mt-2 text-sm">
- Stack name cannot be changed while running. Please stop the stack first.
- </p>
+ <p class="text-muted-foreground mt-2 text-sm">Stack name cannot be changed while running. Please stop the stack first.</p>
{/if}
</div>
</Card.Content>
@@ -564,18 +491,10 @@
</Card.Header>
<Card.Content class="flex h-full flex-col p-4">
<div class="h-[590px] w-full flex-shrink-0 overflow-hidden rounded-md">
- <YamlEditor
- bind:value={composeContent}
- readOnly={isLoading.saving ||
- isLoading.deploying ||
- isLoading.stopping ||
- isLoading.restarting ||
- isLoading.removing}
- />
+ <YamlEditor bind:value={composeContent} readOnly={isLoading.saving || isLoading.deploying || isLoading.stopping || isLoading.restarting || isLoading.removing} />
</div>
<p class="text-muted-foreground flex-shrink-0 text-sm">
- Edit your <span class="font-medium">compose.yaml</span> file directly. Syntax
- errors will be highlighted.
+ Edit your <span class="font-medium">compose.yaml</span> file directly. Syntax errors will be highlighted.
</p>
</Card.Content>
</Card.Root>
@@ -589,18 +508,9 @@
</Card.Header>
<Card.Content class="flex h-full flex-col p-4">
<div class="h-[590px] w-full flex-shrink-0 overflow-hidden rounded-md">
- <EnvEditor
- bind:value={envContent}
- readOnly={isLoading.saving ||
- isLoading.deploying ||
- isLoading.stopping ||
- isLoading.restarting ||
- isLoading.removing}
- />
+ <EnvEditor bind:value={envContent} readOnly={isLoading.saving || isLoading.deploying || isLoading.stopping || isLoading.restarting || isLoading.removing} />
</div>
- <p class="text-muted-foreground flex-shrink-0 text-sm">
- Define environment variables in KEY=value format.
- </p>
+ <p class="text-muted-foreground flex-shrink-0 text-sm">Define environment variables in KEY=value format.</p>
</Card.Content>
</Card.Root>
</div>
@@ -619,26 +529,15 @@
<input type="checkbox" bind:checked={autoScrollStackLogs} class="size-4" />
Auto-scroll
</label>
- <Button variant="outline" size="sm" onclick={() => stackLogViewer?.clearLogs()}
- >Clear</Button
- >
+ <Button variant="outline" size="sm" onclick={() => stackLogViewer?.clearLogs()}>Clear</Button>
{#if isStackLogsStreaming}
<div class="flex items-center gap-2">
<div class="size-2 animate-pulse rounded-full bg-green-500"></div>
<span class="text-sm font-medium text-green-600">Live</span>
</div>
- <Button
- variant="outline"
- size="sm"
- onclick={() => stackLogViewer?.stopLogStream()}>Stop</Button
- >
+ <Button variant="outline" size="sm" onclick={() => stackLogViewer?.stopLogStream()}>Stop</Button>
{:else}
- <Button
- variant="outline"
- size="sm"
- onclick={() => stackLogViewer?.startLogStream()}
- disabled={!stack?.id}>Start</Button
- >
+ <Button variant="outline" size="sm" onclick={() => stackLogViewer?.startLogStream()} disabled={!stack?.id}>Start</Button>
{/if}
<Button
variant="outline"
@@ -683,10 +582,7 @@
<FileStack class="text-muted-foreground size-10" />
</div>
<h2 class="mb-3 text-2xl font-medium">Stack Not Found</h2>
- <p class="text-muted-foreground mb-8 max-w-md text-center">
- Could not load stack data. It may have been removed or the Docker engine is not
- accessible.
- </p>
+ <p class="text-muted-foreground mb-8 max-w-md text-center">Could not load stack data. It may have been removed or the Docker engine is not accessible.</p>
<Button variant="outline" href="/compose">
<ArrowLeft class="mr-2 size-4" />
Back to Stacks
@@ -723,15 +619,11 @@
{/each}
</Select.Content>
</Select.Root>
- <p class="text-muted-foreground text-xs">
- This will deploy the current stack configuration to the selected agent.
- </p>
+ <p class="text-muted-foreground text-xs">This will deploy the current stack configuration to the selected agent.</p>
</div>
</div>
<Dialog.Footer>
- <Button variant="outline" onclick={() => (deployDialogOpen = false)} disabled={deploying}
- >Cancel</Button
- >
+ <Button variant="outline" onclick={() => (deployDialogOpen = false)} disabled={deploying}>Cancel</Button>
<Button onclick={handleDeployToAgent} disabled={!selectedAgentId || deploying}>
{#if deploying}
<Loader2 class="mr-2 size-4 animate-spin" />
diff --git a/frontend/src/routes/compose/agent/[agentId]/[composeName]/+page.svelte b/frontend/src/routes/compose/agent/[agentId]/[composeName]/+page.svelte
index 1247dcc48..617803fe1 100644
--- a/frontend/src/routes/compose/agent/[agentId]/[composeName]/+page.svelte
+++ b/frontend/src/routes/compose/agent/[agentId]/[composeName]/+page.svelte
@@ -4,18 +4,7 @@
import { Button } from '$lib/components/ui/button';
import { Input } from '$lib/components/ui/input';
import { Label } from '$lib/components/ui/label';
- import {
- ArrowLeft,
- FileStack,
- Layers,
- Settings,
- Activity,
- Users,
- Play,
- Square,
- RotateCcw,
- Loader2
- } from '@lucide/svelte';
+ import { ArrowLeft, FileStack, Layers, Settings, Activity, Users, Play, Square, RotateCcw, Loader2 } from '@lucide/svelte';
import { invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
@@ -42,11 +31,7 @@
saving: false
});
- let hasChanges = $derived(
- name !== originalName ||
- composeContent !== originalComposeContent ||
- envContent !== originalEnvContent
- );
+ let hasChanges = $derived(name !== originalName || composeContent !== originalComposeContent || envContent !== originalEnvContent);
let activeSection = $state<string>('overview');
@@ -82,9 +67,7 @@
await invalidateAll();
} catch (error) {
console.error('Failed to save stack:', error);
- toast.error(
- `Failed to save stack: ${error instanceof Error ? error.message : 'Unknown error'}`
- );
+ toast.error(`Failed to save stack: ${error instanceof Error ? error.message : 'Unknown error'}`);
} finally {
isLoading.saving = false;
}
@@ -122,15 +105,11 @@
throw new Error(errorData.error || `Failed to ${action} stack`);
}
- toast.success(
- `Stack ${action === 'up' ? 'started' : action === 'down' ? 'stopped' : 'restarted'} successfully`
- );
+ toast.success(`Stack ${action === 'up' ? 'started' : action === 'down' ? 'stopped' : 'restarted'} successfully`);
await invalidateAll();
} catch (error) {
console.error(`Failed to ${action} stack:`, error);
- toast.error(
- `Failed to ${action} stack: ${error instanceof Error ? error.message : 'Unknown error'}`
- );
+ toast.error(`Failed to ${action} stack: ${error instanceof Error ? error.message : 'Unknown error'}`);
} finally {
isLoading[actionKey] = false;
}
@@ -174,22 +153,14 @@
{agent.hostname}
</span>
{#if stack.status}
- <StatusBadge
- variant={statusVariantMap[stack.status.toLowerCase()] || 'gray'}
- text={capitalizeFirstLetter(stack.status)}
- />
+ <StatusBadge variant={statusVariantMap[stack.status.toLowerCase()] || 'gray'} text={capitalizeFirstLetter(stack.status)} />
{/if}
</div>
</div>
<div class="flex items-center gap-2">
<!-- Agent Stack Actions -->
- <Button
- variant="outline"
- size="sm"
- onclick={() => handleStackAction('up')}
- disabled={Object.values(isLoading).some(Boolean) || stack.status === 'running'}
- >
+ <Button variant="outline" size="sm" onclick={() => handleStackAction('up')} disabled={Object.values(isLoading).some(Boolean) || stack.status === 'running'}>
{#if isLoading.deploying}
<Loader2 class="mr-2 size-4 animate-spin" />
{:else}
@@ -198,12 +169,7 @@
Start
</Button>
- <Button
- variant="outline"
- size="sm"
- onclick={() => handleStackAction('restart')}
- disabled={Object.values(isLoading).some(Boolean)}
- >
+ <Button variant="outline" size="sm" onclick={() => handleStackAction('restart')} disabled={Object.values(isLoading).some(Boolean)}>
{#if isLoading.restarting}
<Loader2 class="mr-2 size-4 animate-spin" />
{:else}
@@ -212,12 +178,7 @@
Restart
</Button>
- <Button
- variant="outline"
- size="sm"
- onclick={() => handleStackAction('down')}
- disabled={Object.values(isLoading).some(Boolean) || stack.status !== 'running'}
- >
+ <Button variant="outline" size="sm" onclick={() => handleStackAction('down')} disabled={Object.values(isLoading).some(Boolean) || stack.status !== 'running'}>
{#if isLoading.stopping}
<Loader2 class="mr-2 size-4 animate-spin" />
{:else}
@@ -240,9 +201,7 @@
<button
onclick={() => scrollToSection(section.id)}
class="flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors
- {activeSection === section.id
- ? 'bg-primary/10 text-primary border-primary/20 border'
- : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
+ {activeSection === section.id ? 'bg-primary/10 text-primary border-primary/20 border' : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
>
<IconComponent class="size-4 shrink-0" />
<span class="truncate">{section.label}</span>
@@ -325,9 +284,7 @@
{@const variant = statusVariantMap[status.toLowerCase()] || 'gray'}
<!-- Agent Service (not clickable) -->
- <div
- class="bg-muted/20 flex items-center justify-between rounded-lg border p-4"
- >
+ <div class="bg-muted/20 flex items-center justify-between rounded-lg border p-4">
<div class="flex items-center gap-3">
<div class="bg-muted/50 rounded-full p-2">
<Layers class="text-muted-foreground size-4" />
@@ -343,9 +300,7 @@
</div>
{:else}
<div class="py-12 text-center">
- <div
- class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full"
- >
+ <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
<Layers class="text-muted-foreground size-6" />
</div>
<div class="text-muted-foreground">No services defined in this stack</div>
@@ -365,15 +320,7 @@
</h2>
<!-- Save Button -->
{#if hasChanges}
- <ArcaneButton
- action="save"
- loading={isLoading.saving}
- onClick={handleSaveChanges}
- disabled={!hasChanges}
- label="Save Changes"
- loadingLabel="Saving..."
- class="bg-green-600 text-white hover:bg-green-700"
- />
+ <ArcaneButton action="save" loading={isLoading.saving} onClick={handleSaveChanges} disabled={!hasChanges} label="Save Changes" loadingLabel="Saving..." class="bg-green-600 text-white hover:bg-green-700" />
{/if}
</div>
@@ -385,17 +332,8 @@
<Card.Content>
<div class="max-w-md">
<Label for="name" class="mb-2 block">Stack Name</Label>
- <Input
- type="text"
- id="name"
- name="name"
- bind:value={name}
- required
- disabled={true}
- />
- <p class="text-muted-foreground mt-2 text-sm">
- Agent stack names cannot be changed from the web interface.
- </p>
+ <Input type="text" id="name" name="name" bind:value={name} required disabled={true} />
+ <p class="text-muted-foreground mt-2 text-sm">Agent stack names cannot be changed from the web interface.</p>
</div>
</Card.Content>
</Card.Root>
@@ -410,14 +348,10 @@
</Card.Header>
<Card.Content>
<div class="h-[600px] overflow-hidden rounded-lg border">
- <YamlEditor
- bind:value={composeContent}
- readOnly={Object.values(isLoading).some(Boolean)}
- />
+ <YamlEditor bind:value={composeContent} readOnly={Object.values(isLoading).some(Boolean)} />
</div>
<p class="text-muted-foreground mt-2 text-sm">
- Edit your <span class="font-medium">compose.yaml</span> file directly. Changes
- will be applied to the remote agent.
+ Edit your <span class="font-medium">compose.yaml</span> file directly. Changes will be applied to the remote agent.
</p>
</Card.Content>
</Card.Root>
@@ -431,15 +365,9 @@
</Card.Header>
<Card.Content>
<div class="h-[600px] overflow-hidden rounded-lg border">
- <EnvEditor
- bind:value={envContent}
- readOnly={Object.values(isLoading).some(Boolean)}
- />
+ <EnvEditor bind:value={envContent} readOnly={Object.values(isLoading).some(Boolean)} />
</div>
- <p class="text-muted-foreground mt-2 text-sm">
- Define environment variables in KEY=value format. Variables will be applied
- on the remote agent.
- </p>
+ <p class="text-muted-foreground mt-2 text-sm">Define environment variables in KEY=value format. Variables will be applied on the remote agent.</p>
</Card.Content>
</Card.Root>
</div>
@@ -457,10 +385,7 @@
<FileStack class="text-muted-foreground size-10" />
</div>
<h2 class="mb-3 text-2xl font-medium">Stack Not Found</h2>
- <p class="text-muted-foreground mb-8 max-w-md text-center">
- Could not load agent stack data. The stack may not exist on the agent or the agent may be
- offline.
- </p>
+ <p class="text-muted-foreground mb-8 max-w-md text-center">Could not load agent stack data. The stack may not exist on the agent or the agent may be offline.</p>
<Button variant="outline" href="/compose">
<ArrowLeft class="mr-2 size-4" />
Back to Stacks
diff --git a/frontend/src/routes/compose/new/+page.svelte b/frontend/src/routes/compose/new/+page.svelte
index 8dfccc840..b2f9d75ec 100644
--- a/frontend/src/routes/compose/new/+page.svelte
+++ b/frontend/src/routes/compose/new/+page.svelte
@@ -105,9 +105,7 @@
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
- throw new Error(
- errorData.error || `Failed to deploy Compose Project: ${response.statusText}`
- );
+ throw new Error(errorData.error || `Failed to deploy Compose Project: ${response.statusText}`);
}
const result = await response.json();
@@ -205,32 +203,15 @@
</div>
<!-- Docker Run to Compose Converter -->
- <DropdownCard
- id="docker-run-converter"
- title="Docker Run to Compose Converter"
- description="Convert existing docker run commands to Docker Compose format"
- icon={Terminal}
- >
+ <DropdownCard id="docker-run-converter" title="Docker Run to Compose Converter" description="Convert existing docker run commands to Docker Compose format" icon={Terminal}>
<div class="space-y-4">
<div class="space-y-2">
<Label for="dockerRunCommand">Docker Run Command</Label>
- <Textarea
- id="dockerRunCommand"
- bind:value={dockerRunCommand}
- placeholder="docker run -d --name my-app -p 8080:80 nginx:alpine"
- rows={3}
- disabled={converting}
- class="font-mono text-sm"
- />
+ <Textarea id="dockerRunCommand" bind:value={dockerRunCommand} placeholder="docker run -d --name my-app -p 8080:80 nginx:alpine" rows={3} disabled={converting} class="font-mono text-sm" />
</div>
<div class="flex items-center gap-2">
- <Button
- type="button"
- disabled={!dockerRunCommand.trim() || converting}
- size="sm"
- onclick={handleConvertDockerRun}
- >
+ <Button type="button" disabled={!dockerRunCommand.trim() || converting} size="sm" onclick={handleConvertDockerRun}>
{#if converting}
<Loader2 class="mr-2 size-4 animate-spin" />
Converting...
@@ -245,13 +226,7 @@
<Label class="text-muted-foreground text-xs">Example Commands:</Label>
<div class="space-y-1">
{#each exampleCommands as command}
- <Button
- type="button"
- variant="ghost"
- size="sm"
- class="h-auto w-full justify-start p-2 text-left font-mono text-xs"
- onclick={() => useExample(command)}
- >
+ <Button type="button" variant="ghost" size="sm" class="h-auto w-full justify-start p-2 text-left font-mono text-xs" onclick={() => useExample(command)}>
<Copy class="mr-2 size-3" />
{command}
</Button>
@@ -271,27 +246,16 @@
</div>
<div>
<Card.Title>Compose Project Configuration</Card.Title>
- <Card.Description
- >Create a new Docker Compose Project with environment variables</Card.Description
- >
+ <Card.Description>Create a new Docker Compose Project with environment variables</Card.Description>
</div>
</div>
<div class="flex items-center gap-2">
- <ArcaneButton
- action="template"
- onClick={() => (showTemplateDialog = true)}
- loading={saving}
- disabled={saving || converting}
- />
+ <ArcaneButton action="template" onClick={() => (showTemplateDialog = true)} loading={saving} disabled={saving || converting} />
{#if onlineAgents.length > 0}
<DropdownButton.DropdownRoot>
<DropdownButton.Root>
- <DropdownButton.Main
- variant="default"
- disabled={!name || !composeContent || saving}
- onclick={handleDeployButtonClick}
- >
+ <DropdownButton.Main variant="default" disabled={!name || !composeContent || saving} onclick={handleDeployButtonClick}>
{#if saving}
<Loader2 class="mr-2 size-4 animate-spin" />
{:else}
@@ -301,18 +265,12 @@
</DropdownButton.Main>
<DropdownButton.DropdownTrigger>
- <DropdownButton.Trigger
- variant="default"
- disabled={!name || !composeContent || saving}
- />
+ <DropdownButton.Trigger variant="default" disabled={!name || !composeContent || saving} />
</DropdownButton.DropdownTrigger>
</DropdownButton.Root>
<DropdownButton.Content align="end" class="min-w-[200px]">
- <DropdownButton.Item
- onclick={() => handleAgentSelect({ id: '', label: 'Deploy Locally' })}
- >Deploy Locally</DropdownButton.Item
- >
+ <DropdownButton.Item onclick={() => handleAgentSelect({ id: '', label: 'Deploy Locally' })}>Deploy Locally</DropdownButton.Item>
{#if agentOptions.length > 0}
<DropdownButton.Separator />
@@ -325,12 +283,7 @@
</DropdownButton.Content>
</DropdownButton.DropdownRoot>
{:else}
- <ArcaneButton
- action="create"
- onClick={handleSubmit}
- loading={saving}
- disabled={!name || !composeContent}
- />
+ <ArcaneButton action="create" onClick={handleSubmit} loading={saving} disabled={!name || !composeContent} />
{/if}
</div>
</div>
@@ -339,15 +292,7 @@
<div class="space-y-4">
<div class="grid w-full max-w-sm items-center gap-1.5">
<Label for="name">Compose Project Name</Label>
- <Input
- type="text"
- id="name"
- name="name"
- bind:value={name}
- required
- placeholder="e.g., my-web-app"
- disabled={saving}
- />
+ <Input type="text" id="name" name="name" bind:value={name} required placeholder="e.g., my-web-app" disabled={saving} />
</div>
<Resizable.PaneGroup direction="horizontal">
@@ -375,12 +320,7 @@
</div>
</Card.Content>
<Card.Footer class="flex justify-between">
- <Button
- variant="outline"
- type="button"
- onclick={() => window.history.back()}
- disabled={saving}
- >
+ <Button variant="outline" type="button" onclick={() => window.history.back()} disabled={saving}>
<ArrowLeft class="mr-2 size-4" />
Cancel
</Button>
@@ -390,8 +330,4 @@
</div>
<!-- Template Selection Dialog -->
-<TemplateSelectionDialog
- bind:open={showTemplateDialog}
- templates={data.composeTemplates || []}
- onSelect={handleTemplateSelect}
-/>
+<TemplateSelectionDialog bind:open={showTemplateDialog} templates={data.composeTemplates || []} onSelect={handleTemplateSelect} />
diff --git a/frontend/src/routes/containers/+page.svelte b/frontend/src/routes/containers/+page.svelte
index 1737e3023..5994c85da 100644
--- a/frontend/src/routes/containers/+page.svelte
+++ b/frontend/src/routes/containers/+page.svelte
@@ -1,22 +1,12 @@
<script lang="ts">
- import {
- ScanSearch,
- Play,
- RotateCcw,
- StopCircle,
- Trash2,
- Loader2,
- Box,
- RefreshCw,
- Ellipsis
- } from '@lucide/svelte';
+ import { ScanSearch, Play, RotateCcw, StopCircle, Trash2, Loader2, Box, RefreshCw, Ellipsis } from '@lucide/svelte';
import { Button } from '$lib/components/ui/button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import UniversalTable from '$lib/components/universal-table.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import * as Table from '$lib/components/ui/table';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import CreateContainerDialog from './create-container-dialog.svelte';
+ import CreateContainerSheet from '$lib/components/sheets/create-container-sheet.svelte';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { containerAPI, imageAPI } from '$lib/services/api';
@@ -47,19 +37,13 @@
checking: false
});
const isAnyLoading = $derived(Object.values(isLoading).some((loading) => loading));
- const runningContainers = $derived(
- containers?.filter((c: ContainerInfo) => c.State === 'running').length || 0
- );
- const stoppedContainers = $derived(
- containers?.filter((c: ContainerInfo) => c.State === 'exited').length || 0
- );
+ const runningContainers = $derived(containers?.filter((c: ContainerInfo) => c.State === 'running').length || 0);
+ const stoppedContainers = $derived(containers?.filter((c: ContainerInfo) => c.State === 'exited').length || 0);
const totalContainers = $derived(containers?.length || 0);
function getContainerDisplayName(container: ContainerInfo): string {
if (container.Names && container.Names.length > 0) {
- return container.Names[0].startsWith('/')
- ? container.Names[0].substring(1)
- : container.Names[0];
+ return container.Names[0].startsWith('/') ? container.Names[0].substring(1) : container.Names[0];
}
return shortId(container.Id);
}
@@ -170,38 +154,16 @@
</div>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
- <StatCard
- title="Total"
- value={totalContainers}
- icon={Box}
- class="border-l-primary border-l-4 transition-shadow hover:shadow-lg"
- />
- <StatCard
- title="Running"
- value={runningContainers}
- icon={Box}
- iconColor="text-green-500"
- bgColor="bg-green-500/10"
- class="border-l-4 border-l-green-500"
- />
- <StatCard
- title="Stopped"
- value={stoppedContainers}
- icon={Box}
- iconColor="text-amber-500"
- class="border-l-4 border-l-amber-500"
- />
+ <StatCard title="Total" value={totalContainers} icon={Box} class="border-l-primary border-l-4 transition-shadow hover:shadow-lg" />
+ <StatCard title="Running" value={runningContainers} icon={Box} iconColor="text-green-500" bgColor="bg-green-500/10" class="border-l-4 border-l-green-500" />
+ <StatCard title="Stopped" value={stoppedContainers} icon={Box} iconColor="text-amber-500" class="border-l-4 border-l-amber-500" />
</div>
{#if containers?.length === 0}
- <div
- class="bg-card flex flex-col items-center justify-center rounded-lg border px-6 py-12 text-center"
- >
+ <div class="bg-card flex flex-col items-center justify-center rounded-lg border px-6 py-12 text-center">
<Box class="text-muted-foreground mb-4 size-12 opacity-40" />
<p class="text-lg font-medium">No containers found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new container using the "Create Container" button above or use the Docker CLI
- </p>
+ <p class="text-muted-foreground mt-1 max-w-md text-sm">Create a new container using the "Create Container" button above or use the Docker CLI</p>
<div class="mt-4 flex gap-3">
<Button variant="secondary" onclick={refreshData}>
<RefreshCw class="size-4" />
@@ -218,14 +180,7 @@
<Card.Title>Container List</Card.Title>
</div>
<div class="flex items-center gap-2">
- <ArcaneButton
- action="inspect"
- label="Update Containers"
- onClick={() => handleCheckForUpdates()}
- loading={isLoading.checking}
- loadingLabel="Updating..."
- disabled={isLoading.checking}
- />
+ <ArcaneButton action="inspect" label="Update Containers" onClick={() => handleCheckForUpdates()} loading={isLoading.checking} loadingLabel="Updating..." disabled={isLoading.checking} />
<ArcaneButton action="create" label="Create Container" onClick={openCreateDialog} />
</div>
</div>
@@ -263,17 +218,9 @@
}}
bind:selectedIds
>
- {#snippet rows({
- item
- }: {
- item: ContainerInfo & { displayName: string; statusSortValue: number };
- })}
+ {#snippet rows({ item }: { item: ContainerInfo & { displayName: string; statusSortValue: number } })}
{@const stateVariant = statusVariantMap[item.State.toLowerCase()]}
- <Table.Cell
- ><a class="font-medium hover:underline" href="/containers/{item.Id}/"
- >{item.displayName}</a
- ></Table.Cell
- >
+ <Table.Cell><a class="font-medium hover:underline" href="/containers/{item.Id}/">{item.displayName}</a></Table.Cell>
<Table.Cell>{shortId(item.Id)}</Table.Cell>
<Table.Cell>{item.Image}</Table.Cell>
<Table.Cell>
@@ -292,19 +239,13 @@
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end">
<DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/containers/${item.Id}`)}
- disabled={isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => goto(`/containers/${item.Id}`)} disabled={isAnyLoading}>
<ScanSearch class="size-4" />
Inspect
</DropdownMenu.Item>
{#if item.State !== 'running'}
- <DropdownMenu.Item
- onclick={() => performContainerAction('start', item.Id)}
- disabled={isLoading.start || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performContainerAction('start', item.Id)} disabled={isLoading.start || isAnyLoading}>
{#if isLoading.start}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -313,10 +254,7 @@
Start
</DropdownMenu.Item>
{:else}
- <DropdownMenu.Item
- onclick={() => performContainerAction('restart', item.Id)}
- disabled={isLoading.restart || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performContainerAction('restart', item.Id)} disabled={isLoading.restart || isAnyLoading}>
{#if isLoading.restart}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -325,10 +263,7 @@
Restart
</DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => performContainerAction('stop', item.Id)}
- disabled={isLoading.stop || isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => performContainerAction('stop', item.Id)} disabled={isLoading.stop || isAnyLoading}>
{#if isLoading.stop}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -340,11 +275,7 @@
<DropdownMenu.Separator />
- <DropdownMenu.Item
- class="focus:text-red-700! text-red-500"
- onclick={() => handleRemoveContainer(item.Id)}
- disabled={isLoading.remove || isAnyLoading}
- >
+ <DropdownMenu.Item class="focus:text-red-700! text-red-500" onclick={() => handleRemoveContainer(item.Id)} disabled={isLoading.remove || isAnyLoading}>
{#if isLoading.remove}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -362,10 +293,15 @@
</Card.Root>
{/if}
- <CreateContainerDialog
+ <CreateContainerSheet
bind:open={isCreateDialogOpen}
- volumes={Array.isArray(data.volumes) ? data.volumes : []}
- networks={Array.isArray(data.networks) ? data.networks : []}
- images={Array.isArray(data.images) ? data.images : []}
+ availableVolumes={Array.isArray(data.volumes) ? data.volumes : []}
+ availableNetworks={Array.isArray(data.networks) ? data.networks : []}
+ availableImages={Array.isArray(data.images) ? data.images : []}
+ onSubmit={async () => {
+ await invalidateAll();
+ isCreateDialogOpen = false;
+ }}
+ isLoading={false}
/>
</div>
diff --git a/frontend/src/routes/containers/+page.ts b/frontend/src/routes/containers/+page.ts
index 768f64b1b..5ae7410a0 100644
--- a/frontend/src/routes/containers/+page.ts
+++ b/frontend/src/routes/containers/+page.ts
@@ -3,12 +3,7 @@ import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
try {
- const [containers, volumes, networks, images] = await Promise.all([
- containerAPI.list(true),
- volumeAPI.list(),
- networkAPI.list(),
- imageAPI.list()
- ]);
+ const [containers, volumes, networks, images] = await Promise.all([containerAPI.list(true), volumeAPI.list(), networkAPI.list(), imageAPI.list()]);
return {
containers,
diff --git a/frontend/src/routes/containers/[id]/+page.svelte b/frontend/src/routes/containers/[id]/+page.svelte
index f03b08994..cf3c3c545 100644
--- a/frontend/src/routes/containers/[id]/+page.svelte
+++ b/frontend/src/routes/containers/[id]/+page.svelte
@@ -2,19 +2,7 @@
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 {
- ArrowLeft,
- AlertCircle,
- RefreshCw,
- HardDrive,
- Clock,
- Network,
- Terminal,
- Settings,
- Activity,
- FileText,
- Database
- } from '@lucide/svelte';
+ import { ArrowLeft, AlertCircle, RefreshCw, HardDrive, Clock, Network, Terminal, Settings, Activity, FileText, Database } from '@lucide/svelte';
import { invalidateAll } from '$app/navigation';
import { Badge } from '$lib/components/ui/badge/index.js';
import ActionButtons from '$lib/components/action-buttons.svelte';
@@ -125,13 +113,9 @@
return 0;
}
- const cpuDelta =
- statsData.cpu_stats.cpu_usage.total_usage -
- (statsData.precpu_stats.cpu_usage?.total_usage || 0);
- const systemDelta =
- statsData.cpu_stats.system_cpu_usage - (statsData.precpu_stats.system_cpu_usage || 0);
- const numberCPUs =
- statsData.cpu_stats.online_cpus || statsData.cpu_stats.cpu_usage?.percpu_usage?.length || 1;
+ const cpuDelta = statsData.cpu_stats.cpu_usage.total_usage - (statsData.precpu_stats.cpu_usage?.total_usage || 0);
+ const systemDelta = statsData.cpu_stats.system_cpu_usage - (statsData.precpu_stats.system_cpu_usage || 0);
+ const numberCPUs = statsData.cpu_stats.online_cpus || statsData.cpu_stats.cpu_usage?.percpu_usage?.length || 1;
if (systemDelta > 0 && cpuDelta > 0) {
const cpuPercent = (cpuDelta / systemDelta) * numberCPUs * 100.0;
@@ -145,13 +129,9 @@
const memoryLimitBytes = $derived(stats?.memory_stats?.limit || 0);
const memoryUsageFormatted = $derived(formatBytes(memoryUsageBytes));
const memoryLimitFormatted = $derived(formatBytes(memoryLimitBytes));
- const memoryUsagePercent = $derived(
- memoryLimitBytes > 0 ? (memoryUsageBytes / memoryLimitBytes) * 100 : 0
- );
+ const memoryUsagePercent = $derived(memoryLimitBytes > 0 ? (memoryUsageBytes / memoryLimitBytes) * 100 : 0);
- const getPrimaryIpAddress = (
- networkSettings: ContainerInspectInfo['NetworkSettings'] | undefined | null
- ): string => {
+ const getPrimaryIpAddress = (networkSettings: ContainerInspectInfo['NetworkSettings'] | undefined | null): string => {
if (!networkSettings) return 'N/A';
if (networkSettings.IPAddress) {
@@ -242,14 +222,7 @@
{containerDisplayName}
</h1>
{#if container?.State}
- <StatusBadge
- variant={container.State.Status === 'running'
- ? 'green'
- : container.State.Status === 'exited'
- ? 'red'
- : 'amber'}
- text={container.State.Status}
- />
+ <StatusBadge variant={container.State.Status === 'running' ? 'green' : container.State.Status === 'exited' ? 'red' : 'amber'} text={container.State.Status} />
{/if}
</div>
</div>
@@ -287,9 +260,7 @@
<button
onclick={() => scrollToSection(section.id)}
class="flex w-full items-center gap-2 rounded-md px-3 py-2 text-sm font-medium transition-colors
- {activeSection === section.id
- ? 'bg-primary/10 text-primary border-primary/20 border'
- : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
+ {activeSection === section.id ? 'bg-primary/10 text-primary border-primary/20 border' : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'}"
>
<IconComponent class="size-4 shrink-0" />
<span class="truncate">{section.label}</span>
@@ -372,29 +343,9 @@
</Card.Header>
<Card.Content class="space-y-6">
{#if stats && container.State?.Running}
- <Meter
- label="CPU Usage"
- valueLabel="{cpuUsagePercent.toFixed(1)}%"
- value={cpuUsagePercent}
- max={100}
- variant={cpuUsagePercent > 80
- ? 'destructive'
- : cpuUsagePercent > 60
- ? 'warning'
- : 'default'}
- />
-
- <Meter
- label="Memory Usage"
- valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted}"
- value={memoryUsagePercent}
- max={100}
- variant={memoryUsagePercent > 80
- ? 'destructive'
- : memoryUsagePercent > 60
- ? 'warning'
- : 'default'}
- />
+ <Meter label="CPU Usage" valueLabel="{cpuUsagePercent.toFixed(1)}%" value={cpuUsagePercent} max={100} variant={cpuUsagePercent > 80 ? 'destructive' : cpuUsagePercent > 60 ? 'warning' : 'default'} />
+
+ <Meter label="Memory Usage" valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted}" value={memoryUsagePercent} max={100} variant={memoryUsagePercent > 80 ? 'destructive' : memoryUsagePercent > 60 ? 'warning' : 'default'} />
{:else}
<div class="text-muted-foreground py-8 text-center">
{container.State?.Running ? 'Loading stats...' : 'Container not running'}
@@ -437,19 +388,10 @@
<div>
<div class="text-muted-foreground mb-2 text-sm">Health Status</div>
<div class="flex items-center gap-3">
- <StatusBadge
- variant={container.State.Health.Status === 'healthy'
- ? 'green'
- : container.State.Health.Status === 'unhealthy'
- ? 'red'
- : 'amber'}
- text={container.State.Health.Status}
- />
+ <StatusBadge variant={container.State.Health.Status === 'healthy' ? 'green' : container.State.Health.Status === 'unhealthy' ? 'red' : 'amber'} text={container.State.Health.Status} />
{#if container.State.Health.Log && container.State.Health.Log.length > 0}
<span class="text-muted-foreground text-sm">
- Last check: {new Date(
- container.State.Health.Log[0].Start
- ).toLocaleString()}
+ Last check: {new Date(container.State.Health.Log[0].Start).toLocaleString()}
</span>
{/if}
</div>
@@ -472,33 +414,9 @@
<div class="grid grid-cols-1 gap-8 lg:grid-cols-2">
<!-- CPU and Memory -->
<div class="space-y-6">
- <Meter
- label="CPU Usage"
- valueLabel="{cpuUsagePercent.toFixed(2)}%"
- value={cpuUsagePercent}
- max={100}
- variant={cpuUsagePercent > 80
- ? 'destructive'
- : cpuUsagePercent > 60
- ? 'warning'
- : 'default'}
- size="lg"
- />
-
- <Meter
- label="Memory Usage"
- valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted} ({memoryUsagePercent.toFixed(
- 1
- )}%)"
- value={memoryUsagePercent}
- max={100}
- variant={memoryUsagePercent > 80
- ? 'destructive'
- : memoryUsagePercent > 60
- ? 'warning'
- : 'default'}
- size="lg"
- />
+ <Meter label="CPU Usage" valueLabel="{cpuUsagePercent.toFixed(2)}%" value={cpuUsagePercent} max={100} variant={cpuUsagePercent > 80 ? 'destructive' : cpuUsagePercent > 60 ? 'warning' : 'default'} size="lg" />
+
+ <Meter label="Memory Usage" valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted} ({memoryUsagePercent.toFixed(1)}%)" value={memoryUsagePercent} max={100} variant={memoryUsagePercent > 80 ? 'destructive' : memoryUsagePercent > 60 ? 'warning' : 'default'} size="lg" />
</div>
<!-- Network I/O -->
@@ -530,21 +448,13 @@
<div class="bg-muted/30 rounded p-4">
<div class="text-muted-foreground text-sm">Read</div>
<div class="mt-1 font-medium">
- {formatBytes(
- stats.blkio_stats.io_service_bytes_recursive
- .filter((item) => item.op === 'Read')
- .reduce((acc, item) => acc + item.value, 0)
- )}
+ {formatBytes(stats.blkio_stats.io_service_bytes_recursive.filter((item) => item.op === 'Read').reduce((acc, item) => acc + item.value, 0))}
</div>
</div>
<div class="bg-muted/30 rounded p-4">
<div class="text-muted-foreground text-sm">Write</div>
<div class="mt-1 font-medium">
- {formatBytes(
- stats.blkio_stats.io_service_bytes_recursive
- .filter((item) => item.op === 'Write')
- .reduce((acc, item) => acc + item.value, 0)
- )}
+ {formatBytes(stats.blkio_stats.io_service_bytes_recursive.filter((item) => item.op === 'Write').reduce((acc, item) => acc + item.value, 0))}
</div>
</div>
</div>
@@ -562,9 +472,7 @@
</div>
{/if}
{:else if !container.State?.Running}
- <div class="text-muted-foreground py-12 text-center">
- Container is not running. Stats unavailable.
- </div>
+ <div class="text-muted-foreground py-12 text-center">Container is not running. Stats unavailable.</div>
{:else}
<div class="text-muted-foreground py-12 text-center">Loading stats...</div>
{/if}
@@ -584,43 +492,22 @@
<input type="checkbox" bind:checked={autoScrollLogs} class="size-4" />
Auto-scroll
</label>
- <Button variant="outline" size="sm" onclick={() => logViewer?.clearLogs()}
- >Clear</Button
- >
+ <Button variant="outline" size="sm" onclick={() => logViewer?.clearLogs()}>Clear</Button>
{#if isStreaming}
<div class="flex items-center gap-2">
<div class="size-2 animate-pulse rounded-full bg-green-500"></div>
<span class="text-sm font-medium text-green-600">Live</span>
</div>
- <Button variant="outline" size="sm" onclick={() => logViewer?.stopLogStream()}
- >Stop</Button
- >
+ <Button variant="outline" size="sm" onclick={() => logViewer?.stopLogStream()}>Stop</Button>
{:else}
- <Button
- variant="outline"
- size="sm"
- onclick={() => logViewer?.startLogStream()}
- disabled={!container?.Id}>Start</Button
- >
+ <Button variant="outline" size="sm" onclick={() => logViewer?.startLogStream()} disabled={!container?.Id}>Start</Button>
{/if}
</div>
</div>
<Card.Root class="border">
<Card.Content class="p-0">
- <LogViewer
- bind:this={logViewer}
- bind:autoScroll={autoScrollLogs}
- type="container"
- containerId={container?.Id}
- maxLines={500}
- showTimestamps={true}
- height="400px"
- onStart={handleLogStart}
- onStop={handleLogStop}
- onClear={handleLogClear}
- onToggleAutoScroll={handleToggleAutoScroll}
- />
+ <LogViewer bind:this={logViewer} bind:autoScroll={autoScrollLogs} type="container" containerId={container?.Id} maxLines={500} showTimestamps={true} height="400px" onStart={handleLogStart} onStop={handleLogStop} onClear={handleLogClear} onToggleAutoScroll={handleToggleAutoScroll} />
</Card.Content>
</Card.Root>
</section>
@@ -647,9 +534,7 @@
{@const value = valueParts.join('=')}
<div class="border-muted/30 flex border-b py-2">
<span class="w-1/3 truncate pr-3 font-medium" title={key}>{key}</span>
- <span class="text-muted-foreground w-2/3 truncate" title={value}
- >{value}</span
- >
+ <span class="text-muted-foreground w-2/3 truncate" title={value}>{value}</span>
</div>
{:else}
<div class="border-muted/30 border-b py-2">{env}</div>
@@ -657,9 +542,7 @@
{/each}
</div>
{:else}
- <div class="text-muted-foreground py-8 text-center">
- No environment variables
- </div>
+ <div class="text-muted-foreground py-8 text-center">No environment variables</div>
{/if}
</Card.Content>
</Card.Root>
@@ -708,10 +591,7 @@
{#each Object.entries(container.Config.Labels) as [key, value] (key)}
<div class="border-muted/30 flex border-b py-2">
<span class="w-1/3 truncate pr-3 font-medium" title={key}>{key}</span>
- <span
- class="text-muted-foreground w-2/3 truncate"
- title={value?.toString()}>{value?.toString() || ''}</span
- >
+ <span class="text-muted-foreground w-2/3 truncate" title={value?.toString()}>{value?.toString() || ''}</span>
</div>
{/each}
</div>
@@ -753,9 +633,7 @@
<div>
<div class="text-muted-foreground text-sm">Subnet</div>
<div class="font-mono">
- {networkConfig.IPPrefixLen
- ? `${networkConfig.IPAddress}/${networkConfig.IPPrefixLen}`
- : 'N/A'}
+ {networkConfig.IPPrefixLen ? `${networkConfig.IPAddress}/${networkConfig.IPPrefixLen}` : 'N/A'}
</div>
</div>
{#if networkConfig.Aliases && networkConfig.Aliases.length > 0}
@@ -790,13 +668,7 @@
<div class="overflow-hidden rounded border">
<div class="bg-muted/20 flex items-center justify-between p-4">
<div class="flex items-center gap-3">
- <div
- class="rounded p-2 {mount.Type === 'volume'
- ? 'bg-purple-100 dark:bg-purple-950'
- : mount.Type === 'bind'
- ? 'bg-blue-100 dark:bg-blue-950'
- : 'bg-amber-100 dark:bg-amber-950'}"
- >
+ <div class="rounded p-2 {mount.Type === 'volume' ? 'bg-purple-100 dark:bg-purple-950' : mount.Type === 'bind' ? 'bg-blue-100 dark:bg-blue-950' : 'bg-amber-100 dark:bg-amber-950'}">
{#if mount.Type === 'volume'}
<Database class="size-4 text-purple-600" />
{:else if mount.Type === 'bind'}
@@ -807,11 +679,7 @@
</div>
<div>
<div class="font-medium">
- {mount.Type === 'tmpfs'
- ? 'Temporary filesystem'
- : mount.Type === 'volume'
- ? mount.Name || 'Docker volume'
- : 'Host directory'}
+ {mount.Type === 'tmpfs' ? 'Temporary filesystem' : mount.Type === 'volume' ? mount.Name || 'Docker volume' : 'Host directory'}
</div>
<div class="text-muted-foreground text-sm">
{mount.Type} mount {mount.RW ? '(read-write)' : '(read-only)'}
@@ -825,21 +693,13 @@
<div class="space-y-3 p-4">
<div class="flex">
<span class="text-muted-foreground w-24 font-medium">Container:</span>
- <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono"
- >{mount.Destination}</span
- >
+ <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono">{mount.Destination}</span>
</div>
<div class="flex">
<span class="text-muted-foreground w-24 font-medium">
- {mount.Type === 'volume'
- ? 'Volume:'
- : mount.Type === 'bind'
- ? 'Host:'
- : 'Source:'}
+ {mount.Type === 'volume' ? 'Volume:' : mount.Type === 'bind' ? 'Host:' : 'Source:'}
</span>
- <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono"
- >{mount.Source}</span
- >
+ <span class="bg-muted/50 flex-1 rounded px-2 py-1 font-mono">{mount.Source}</span>
</div>
</div>
</div>
@@ -847,9 +707,7 @@
</div>
{:else}
<div class="py-12 text-center">
- <div
- class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full"
- >
+ <div class="bg-muted/50 mx-auto mb-4 flex size-16 items-center justify-center rounded-full">
<Database class="text-muted-foreground size-6" />
</div>
<div class="text-muted-foreground">No volumes or mounts configured</div>
@@ -869,10 +727,7 @@
<AlertCircle class="text-muted-foreground size-10" />
</div>
<h2 class="mb-3 text-2xl font-medium">Container Not Found</h2>
- <p class="text-muted-foreground mb-8 max-w-md text-center">
- Could not load container data. It may have been removed or the Docker engine is not
- accessible.
- </p>
+ <p class="text-muted-foreground mb-8 max-w-md text-center">Could not load container data. It may have been removed or the Docker engine is not accessible.</p>
<div class="flex justify-center gap-4">
<Button variant="outline" href="/containers">
<ArrowLeft class="mr-2 size-4" />
diff --git a/frontend/src/routes/containers/create-container-dialog.svelte b/frontend/src/routes/containers/create-container-dialog.svelte
deleted file mode 100644
index 1a7e42239..000000000
--- a/frontend/src/routes/containers/create-container-dialog.svelte
+++ /dev/null
@@ -1,881 +0,0 @@
-<script lang="ts">
- import { Button } from '$lib/components/ui/button/index.js';
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import { AlertCircle, Eye, EyeOff, Plus, Trash } from '@lucide/svelte';
- import * as Select from '$lib/components/ui/select/index.js';
- import * as Tabs from '$lib/components/ui/tabs/index.js';
- import { parseBytes } from '$lib/utils/bytes.util';
- import { toast } from 'svelte-sonner';
- import { invalidateAll } from '$app/navigation';
- import Switch from '$lib/components/ui/switch/switch.svelte';
- import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
- import { tryCatch } from '$lib/utils/try-catch';
- import ContainerAPIService from '$lib/services/api/container-api-service';
- import type { ServiceImage } from '$lib/types/docker';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
- import type { CreateContainerRequest } from '$lib/services/api/container-api-service';
- import type { VolumeInspectInfo, NetworkInspectInfo } from 'dockerode';
-
- interface Props {
- open?: boolean;
- volumes?: VolumeInspectInfo[];
- networks?: NetworkInspectInfo[];
- images?: ServiceImage[];
- onClose?: () => void;
- }
-
- let {
- open = $bindable(false),
- volumes = [],
- networks = [],
- images = [],
- onClose: onCloseProp = () => {}
- }: Props = $props();
-
- const containerApi = new ContainerAPIService();
-
- let isCreating = $state(false);
- let containerName = $state('');
- let selectedImage = $state('');
- let selectedTab = $state('basic');
-
- let ports = $state<
- {
- hostPort: string;
- containerPort: string;
- protocol?: 'tcp' | 'udp' | 'sctp';
- hostError?: string;
- containerError?: string;
- }[]
- >([{ hostPort: '', containerPort: '', protocol: 'tcp' }]);
-
- let volumeMounts = $state<{ source: string; target: string; readOnly?: boolean }[]>([
- { source: '', target: '', readOnly: false }
- ]);
-
- let envVars = $state<{ key: string; value: string; sensitive?: boolean }[]>([
- { key: '', value: '', sensitive: true }
- ]);
-
- const restartPolicyOptions = [
- { value: 'no', label: 'No' },
- { value: 'always', label: 'Always' },
- { value: 'on-failure', label: 'On Failure' },
- { value: 'unless-stopped', label: 'Unless Stopped' }
- ];
-
- let networkMode = $state('');
- let restartPolicy = $state('unless-stopped');
-
- const selectedRestartPolicyLabel = $derived(
- restartPolicyOptions.find((opt) => opt.value === restartPolicy)?.label || restartPolicy
- );
-
- let ipv4Address = $state('');
- let ipv6Address = $state('');
-
- let enableHealthcheck = $state(false);
- let healthcheckTest = $state<string[]>(['']);
- let healthcheckInterval = $state<number | undefined>(undefined);
- let healthcheckTimeout = $state<number | undefined>(undefined);
- let healthcheckRetries = $state<number | undefined>(undefined);
- let healthcheckStartPeriod = $state<number | undefined>(undefined);
-
- let labels = $state<{ key: string; value: string }[]>([{ key: '', value: '' }]);
-
- let commandOverride = $state('');
- let runAsUser = $state('');
- let memoryLimitStr = $state('');
- let cpuLimitStr = $state('');
-
- let autoUpdate = $state(false);
-
- function handleClose() {
- open = false;
- if (onCloseProp) {
- onCloseProp();
- }
- }
-
- function validatePortNumber(port: string | number): {
- isValid: boolean;
- error?: string;
- } {
- const portStr = typeof port === 'number' ? port.toString() : port;
- if (!portStr || !portStr.trim()) return { isValid: true };
- const portNum = parseInt(portStr, 10);
- if (isNaN(portNum) || portNum.toString() !== portStr.trim()) {
- return { isValid: false, error: 'Invalid port number' };
- }
- if (portNum < 1 || portNum > 65535) {
- return { isValid: false, error: 'Port must be between 1-65535' };
- }
- return { isValid: true };
- }
-
- $effect(() => {
- ports.forEach((port, index) => {
- if (port.hostPort !== undefined && port.hostPort !== '') {
- const hostValidation = validatePortNumber(port.hostPort);
- ports[index].hostError = hostValidation.error;
- } else {
- ports[index].hostError = undefined;
- }
-
- if (port.containerPort !== undefined && port.containerPort !== '') {
- const containerValidation = validatePortNumber(port.containerPort);
- ports[index].containerError = containerValidation.error;
- } else {
- ports[index].containerError = undefined;
- }
- });
- });
-
- function addPort() {
- ports = [...ports, { hostPort: '', containerPort: '', protocol: 'tcp' }];
- }
-
- function removePort(index: number) {
- ports = ports.filter((_, i) => i !== index);
- if (ports.length === 0) addPort();
- }
-
- function addVolumeMount() {
- volumeMounts = [...volumeMounts, { source: '', target: '', readOnly: false }];
- }
-
- function removeVolumeMount(index: number) {
- volumeMounts = volumeMounts.filter((_, i) => i !== index);
- if (volumeMounts.length === 0) addVolumeMount();
- }
-
- function addEnvVar() {
- envVars = [...envVars, { key: '', value: '', sensitive: true }];
- }
-
- function removeEnvVar(index: number) {
- envVars = envVars.filter((_, i) => i !== index);
- if (envVars.length === 0) addEnvVar();
- }
-
- function addLabel() {
- labels = [...labels, { key: '', value: '' }];
- }
-
- function removeLabel(index: number) {
- labels = labels.filter((_, i) => i !== index);
- if (labels.length === 0) addLabel();
- }
-
- const isUserDefinedNetworkSelected = $derived(
- networkMode &&
- networkMode !== '' &&
- networkMode !== 'host' &&
- networkMode !== 'none' &&
- networkMode !== 'bridge'
- );
-
- async function handleSubmit() {
- if (!selectedImage) {
- toast.error('Image selection is required');
- return;
- }
-
- if (!containerName.trim()) {
- toast.error('Container name is required');
- return;
- }
-
- if (isCreating) {
- return;
- }
-
- let hasInvalidPort = false;
- ports.forEach((port) => {
- if (
- (port.hostPort &&
- validatePortNumber(port.hostPort).error &&
- validatePortNumber(port.hostPort).error !== 'Privileged port (<1024)') ||
- (port.containerPort &&
- validatePortNumber(port.containerPort).error &&
- validatePortNumber(port.containerPort).error !== 'Privileged port (<1024)')
- ) {
- hasInvalidPort = true;
- }
- });
-
- if (hasInvalidPort) {
- toast.error('Please fix invalid port numbers before submitting.');
- return;
- }
-
- isCreating = true;
-
- const portsObj: Record<string, string> = {};
- ports
- .filter((p) => p.hostPort.trim() && p.containerPort.trim())
- .forEach((p) => {
- const containerPortKey =
- p.protocol && p.protocol !== 'tcp'
- ? `${p.containerPort.trim()}/${p.protocol}`
- : p.containerPort.trim();
- portsObj[containerPortKey] = p.hostPort.trim();
- });
-
- const volumesArray: string[] = volumeMounts
- .filter((v) => v.source.trim() && v.target.trim())
- .map((v) => `${v.source.trim()}:${v.target.trim()}${v.readOnly ? ':ro' : ''}`);
-
- const environmentArray: string[] = envVars
- .filter((e) => e.key.trim())
- .map((e) => `${e.key.trim()}=${e.value}`);
-
- const networksArray: string[] = [];
- if (networkMode && networkMode !== '' && networkMode !== 'bridge') {
- networksArray.push(networkMode);
- }
-
- let memoryBytes: number | undefined;
- if (memoryLimitStr.trim()) {
- try {
- memoryBytes = parseBytes(memoryLimitStr.trim());
- } catch (e) {
- console.error('Invalid memory format:', e);
- toast.error(`Invalid memory format: ${memoryLimitStr}`);
- isCreating = false;
- return;
- }
- }
-
- let cpuLimit: number | undefined;
- if (cpuLimitStr.trim()) {
- try {
- const cpuVal = parseFloat(cpuLimitStr.trim());
- if (isNaN(cpuVal) || cpuVal <= 0) {
- throw new Error('CPU Limit must be a positive number');
- }
- cpuLimit = cpuVal;
- } catch (e: any) {
- console.error('Invalid CPU format:', e);
- toast.error(e.message || `Invalid CPU format: ${cpuLimitStr}`);
- isCreating = false;
- return;
- }
- }
-
- const createRequest: CreateContainerRequest = {
- name: containerName.trim(),
- image: selectedImage,
- command: commandOverride.trim() ? commandOverride.trim().split(/\s+/) : undefined,
- user: runAsUser.trim() || undefined,
- environment: environmentArray.length > 0 ? environmentArray : undefined,
- ports: Object.keys(portsObj).length > 0 ? portsObj : undefined,
- volumes: volumesArray.length > 0 ? volumesArray : undefined,
- networks: networksArray.length > 0 ? networksArray : undefined,
- restartPolicy: restartPolicy as 'no' | 'always' | 'on-failure' | 'unless-stopped',
- memory: memoryBytes,
- cpus: cpuLimit,
- privileged: false,
- autoRemove: false
- };
-
- Object.keys(createRequest).forEach((key) => {
- if (createRequest[key as keyof CreateContainerRequest] === undefined) {
- delete createRequest[key as keyof CreateContainerRequest];
- }
- });
-
- handleApiResultWithCallbacks({
- result: await tryCatch(containerApi.create(createRequest)),
- message: 'Failed to Create Container',
- setLoadingState: (value) => (isCreating = value),
- onSuccess: async () => {
- toast.success(`Container "${createRequest.name}" created successfully!`);
- await invalidateAll();
- handleClose();
- },
- onError: () => {
- isCreating = false;
- }
- });
- }
-</script>
-
-<Dialog.Root bind:open>
- <Dialog.Content class="sm:max-w-[700px]">
- <Dialog.Header>
- <Dialog.Title>Create Container</Dialog.Title>
- <Dialog.Description>Configure and run a new Docker container</Dialog.Description>
- </Dialog.Header>
-
- <Tabs.Root value={selectedTab} class="w-full">
- <Tabs.List class="grid w-full grid-cols-7">
- <Tabs.Trigger value="basic" class="px-1 text-xs sm:text-sm">Basic</Tabs.Trigger>
- <Tabs.Trigger value="ports" class="px-1 text-xs sm:text-sm">Ports</Tabs.Trigger>
- <Tabs.Trigger value="volumes" class="px-1 text-xs sm:text-sm">Volumes</Tabs.Trigger>
- <Tabs.Trigger value="env" class="px-1 text-xs sm:text-sm">Environment</Tabs.Trigger>
- <Tabs.Trigger value="network" class="px-1 text-xs sm:text-sm">Network</Tabs.Trigger>
- <Tabs.Trigger value="healthcheck" class="px-1 text-xs sm:text-sm">Healthcheck</Tabs.Trigger>
- <Tabs.Trigger value="advanced" class="px-1 text-xs sm:text-sm">Advanced</Tabs.Trigger>
- </Tabs.List>
-
- <div class="max-h-[60vh] overflow-y-auto p-4">
- <div class="space-y-6">
- <Tabs.Content value="basic">
- <div class="space-y-4">
- <div class="grid grid-cols-1 gap-2">
- <Label for="container-name">Name</Label>
- <Input
- id="container-name"
- bind:value={containerName}
- placeholder="e.g., my-container"
- disabled={isCreating}
- />
- </div>
-
- <div class="grid grid-cols-1 gap-2">
- <Label for="container-image">Image</Label>
- <Select.Root type="single" bind:value={selectedImage} disabled={isCreating}>
- <Select.Trigger class="w-full">
- <span>{selectedImage || 'Select an image'}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Group>
- {#each images as image (image.Id)}
- {#if image.RepoTags && image.RepoTags.length > 0}
- {#each image.RepoTags as tag}
- <Select.Item value={tag}>{tag}</Select.Item>
- {/each}
- {:else}
- <Select.Item value={image.Id}>{image.Id}</Select.Item>
- {/if}
- {/each}
- </Select.Group>
- </Select.Content>
- </Select.Root>
- </div>
-
- <div class="grid grid-cols-1 gap-2">
- <Label for="restart-policy">Restart Policy</Label>
- <Select.Root type="single" bind:value={restartPolicy} disabled={isCreating}>
- <Select.Trigger class="w-full">
- <span>{selectedRestartPolicyLabel}</span>
- </Select.Trigger>
- <Select.Content>
- {#each restartPolicyOptions as option (option.value)}
- <Select.Item label={option.label} value={option.value}
- >{option.label}</Select.Item
- >
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
- </div>
- </Tabs.Content>
-
- <Tabs.Content value="ports">
- <div class="space-y-4">
- {#each ports as port, index (index)}
- <div class="flex items-end space-x-3">
- <div class="grid flex-1 grid-cols-3 gap-4">
- <div>
- <Label for={`host-port-${index}`} class="mb-2 block text-sm">Host Port</Label>
- <Input
- id={`host-port-${index}`}
- bind:value={port.hostPort}
- placeholder="e.g., 8080"
- disabled={isCreating}
- type="text"
- pattern="[0-9]*"
- inputmode="numeric"
- class={port.hostError &&
- port.hostPort &&
- port.hostError !== 'Privileged port (<1024)'
- ? 'border-red-500'
- : ''}
- />
- {#if port.hostError && port.hostPort}
- <div
- class="mt-1 flex items-center text-xs {port.hostError ===
- 'Privileged port (<1024)'
- ? 'text-amber-600'
- : 'text-red-500'}"
- >
- <AlertCircle class="mr-1 size-3" />
- {port.hostError}
- </div>
- {/if}
- </div>
-
- <div>
- <Label for={`container-port-${index}`} class="mb-2 block text-sm"
- >Container Port</Label
- >
- <Input
- id={`container-port-${index}`}
- bind:value={port.containerPort}
- placeholder="e.g., 80"
- disabled={isCreating}
- type="text"
- pattern="[0-9]*"
- inputmode="numeric"
- class={port.containerError &&
- port.containerPort &&
- port.containerError !== 'Privileged port (<1024)'
- ? 'border-red-500'
- : ''}
- />
- {#if port.containerError && port.containerPort}
- <div
- class="mt-1 flex items-center text-xs {port.containerError ===
- 'Privileged port (<1024)'
- ? 'text-amber-600'
- : 'text-red-500'}"
- >
- <AlertCircle class="mr-1 size-3" />
- {port.containerError}
- </div>
- {/if}
- </div>
- <div>
- <Label for={`port-protocol-${index}`} class="mb-2 block text-sm"
- >Protocol</Label
- >
- <Select.Root type="single" bind:value={port.protocol} disabled={isCreating}>
- <Select.Trigger class="w-full">
- <span>{port.protocol?.toUpperCase() || 'TCP'}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="tcp">TCP</Select.Item>
- <Select.Item value="udp">UDP</Select.Item>
- <Select.Item value="sctp">SCTP</Select.Item>
- </Select.Content>
- </Select.Root>
- </div>
- </div>
-
- <Button
- variant="destructive"
- size="icon"
- type="button"
- onclick={() => removePort(index)}
- disabled={(ports.length <= 1 &&
- !ports[0].hostPort &&
- !ports[0].containerPort) ||
- isCreating}
- class="shrink-0"
- >
- <Trash class="size-4" />
- </Button>
- </div>
- {/each}
- <Button
- variant="outline"
- type="button"
- onclick={addPort}
- class="w-full"
- disabled={isCreating}
- >
- <Plus class="mr-2 size-4" /> Add Port Mapping
- </Button>
- </div>
- </Tabs.Content>
-
- <Tabs.Content value="volumes">
- <div class="space-y-4">
- {#each volumeMounts as mount, index (index)}
- <div class="flex items-end space-x-3">
- <div class="grid flex-1 grid-cols-2 items-center gap-4">
- <div>
- <Label for={`volume-source-${index}`} class="mb-2 block"
- >Host Path / Volume Name</Label
- >
- <Input
- id={`volume-source-${index}`}
- bind:value={mount.source}
- placeholder="e.g., /path/on/host or my_volume"
- disabled={isCreating}
- />
- </div>
- <div>
- <Label for={`volume-target-${index}`} class="mb-2 block">Container Path</Label
- >
- <Input
- id={`volume-target-${index}`}
- bind:value={mount.target}
- placeholder="/data_in_container"
- disabled={isCreating}
- />
- </div>
- </div>
- <div class="flex items-center pt-6">
- <Switch
- id={`volume-readonly-${index}`}
- bind:checked={mount.readOnly}
- disabled={isCreating}
- />
- <Label for={`volume-readonly-${index}`} class="ml-2 text-sm">Read-only</Label>
- </div>
- <Button
- variant="destructive"
- size="icon"
- type="button"
- onclick={() => removeVolumeMount(index)}
- disabled={(volumeMounts.length <= 1 &&
- !volumeMounts[0].source &&
- !volumeMounts[0].target) ||
- isCreating}
- class="shrink-0"
- >
- <Trash class="size-4" />
- </Button>
- </div>
- {/each}
- <Button
- variant="outline"
- type="button"
- onclick={addVolumeMount}
- class="w-full"
- disabled={isCreating}
- >
- <Plus class="mr-2 size-4" /> Add Volume Mount
- </Button>
- </div>
- </Tabs.Content>
-
- <Tabs.Content value="env">
- <div class="space-y-4">
- {#each envVars as env, index (index)}
- <div class="flex items-end space-x-3">
- <div class="grid flex-1 grid-cols-2 gap-4">
- <div>
- <Label for={`env-key-${index}`} class="mb-2 block">Key</Label>
- <Input
- id={`env-key-${index}`}
- bind:value={env.key}
- placeholder="MYSQL_ROOT_PASSWORD"
- disabled={isCreating}
- />
- </div>
- <div>
- <Label for={`env-value-${index}`} class="mb-2 block">Value</Label>
- <div class="flex items-center gap-2">
- <Input
- id={`env-value-${index}`}
- bind:value={env.value}
- type={env.sensitive ? 'password' : 'text'}
- placeholder="secret"
- disabled={isCreating}
- />
- <Button
- variant="outline"
- size="icon"
- type="button"
- onclick={() => {
- env.sensitive = !env.sensitive;
- }}
- disabled={isCreating}
- title={env.sensitive ? 'Show value' : 'Hide value'}
- >
- {#if env.sensitive}
- <Eye class="size-4" />
- {:else}
- <EyeOff class="size-4" />
- {/if}
- </Button>
- </div>
- </div>
- </div>
- <Button
- variant="destructive"
- size="icon"
- type="button"
- onclick={() => removeEnvVar(index)}
- disabled={(envVars.length <= 1 && !envVars[0].key && !envVars[0].value) ||
- isCreating}
- class="shrink-0"
- >
- <Trash class="size-4" />
- </Button>
- </div>
- {/each}
- <Button
- variant="outline"
- type="button"
- onclick={addEnvVar}
- class="w-full"
- disabled={isCreating}
- >
- <Plus class="mr-2 size-4" /> Add Environment Variable
- </Button>
- </div>
- </Tabs.Content>
-
- <Tabs.Content value="network">
- <div class="space-y-4">
- <div class="grid grid-cols-1 gap-2">
- <Label for="container-network">Network Mode / Name</Label>
- <Select.Root type="single" bind:value={networkMode} disabled={isCreating}>
- <Select.Trigger class="w-full">
- <span>{networkMode || 'Default (bridge)'}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="">Default (bridge)</Select.Item>
- <Select.Item value="host">Host</Select.Item>
- <Select.Item value="none">None</Select.Item>
- {#each networks.filter((n) => n.Name !== 'bridge' && n.Name !== 'host' && n.Name !== 'none') as net (net.Id)}
- <Select.Item value={net.Name}>
- {net.Name} ({net.Driver})
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
-
- {#if isUserDefinedNetworkSelected}
- <div class="mt-4 space-y-4 border-t pt-4">
- <p class="text-muted-foreground text-sm">
- Optional: Assign static IP addresses (requires network with IPAM configured).
- </p>
- <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- <div class="grid grid-cols-1 gap-2">
- <Label for="ipv4-address">IPv4 Address</Label>
- <Input
- id="ipv4-address"
- bind:value={ipv4Address}
- placeholder="e.g., 172.20.0.10"
- disabled={isCreating}
- />
- </div>
- <div class="grid grid-cols-1 gap-2">
- <Label for="ipv6-address">IPv6 Address</Label>
- <Input
- id="ipv6-address"
- bind:value={ipv6Address}
- placeholder="e.g., 2001:db8::10"
- disabled={isCreating}
- />
- </div>
- </div>
- </div>
- {/if}
- </div>
- </Tabs.Content>
-
- <Tabs.Content value="healthcheck">
- <div class="space-y-4">
- <div class="flex items-center space-x-2">
- <Switch
- id="enable-healthcheck"
- bind:checked={enableHealthcheck}
- disabled={isCreating}
- />
- <Label for="enable-healthcheck" class="cursor-pointer">Enable Healthcheck</Label>
- </div>
-
- {#if enableHealthcheck}
- <div class="mt-4 space-y-6 border-t pt-6">
- <div class="space-y-2">
- <Label for="healthcheck-test">Test Command</Label>
- <Input
- id="healthcheck-test"
- bind:value={healthcheckTest[0]}
- placeholder="e.g., CMD-SHELL curl -f http://localhost:80 || exit 1"
- disabled={isCreating}
- />
- <p class="text-muted-foreground text-xs">
- Command to run inside the container. Use `CMD` or `CMD-SHELL`. For multiple
- arguments, use advanced settings or configure directly in compose.
- </p>
- </div>
-
- <div class="grid grid-cols-2 gap-4 md:grid-cols-4">
- <div class="space-y-2">
- <Label for="healthcheck-interval">Interval (s)</Label>
- <Input
- id="healthcheck-interval"
- type="number"
- min="1"
- bind:value={healthcheckInterval}
- placeholder="e.g., 30"
- disabled={isCreating}
- />
- </div>
- <div class="space-y-2">
- <Label for="healthcheck-timeout">Timeout (s)</Label>
- <Input
- id="healthcheck-timeout"
- type="number"
- min="1"
- bind:value={healthcheckTimeout}
- placeholder="e.g., 10"
- disabled={isCreating}
- />
- </div>
- <div class="space-y-2">
- <Label for="healthcheck-retries">Retries</Label>
- <Input
- id="healthcheck-retries"
- type="number"
- min="1"
- bind:value={healthcheckRetries}
- placeholder="e.g., 3"
- disabled={isCreating}
- />
- </div>
- <div class="space-y-2">
- <Label for="healthcheck-start-period">Start Period (s)</Label>
- <Input
- id="healthcheck-start-period"
- type="number"
- min="0"
- bind:value={healthcheckStartPeriod}
- placeholder="e.g., 60"
- disabled={isCreating}
- />
- <p class="text-muted-foreground text-xs">Grace period for startup.</p>
- </div>
- </div>
- </div>
- {/if}
- </div>
- </Tabs.Content>
-
- <Tabs.Content value="advanced">
- <div class="space-y-6">
- <div class="space-y-4 border-b pb-6">
- <h3 class="text-lg font-medium">Labels</h3>
- {#each labels as label, index (index)}
- <div class="flex items-end space-x-3">
- <div class="grid flex-1 grid-cols-2 gap-4">
- <div>
- <Label for={`label-key-${index}`} class="mb-2 block text-sm">Key</Label>
- <Input
- id={`label-key-${index}`}
- bind:value={label.key}
- placeholder="e.g., com.example.project"
- disabled={isCreating}
- />
- </div>
- <div>
- <Label for={`label-value-${index}`} class="mb-2 block text-sm">Value</Label>
- <Input
- id={`label-value-${index}`}
- bind:value={label.value}
- placeholder="e.g., my-app"
- disabled={isCreating}
- />
- </div>
- </div>
- <Button
- variant="destructive"
- size="icon"
- type="button"
- onclick={() => removeLabel(index)}
- disabled={(labels.length <= 1 && !labels[0].key && !labels[0].value) ||
- isCreating}
- class="shrink-0"
- >
- <Trash class="size-4" />
- </Button>
- </div>
- {/each}
- <Button
- variant="outline"
- type="button"
- onclick={addLabel}
- class="w-full"
- disabled={isCreating}
- >
- <Plus class="mr-2 size-4" /> Add Label
- </Button>
- </div>
-
- <div class="space-y-4 border-b pb-6">
- <h3 class="text-lg font-medium">Execution</h3>
- <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- <div class="space-y-2">
- <Label for="command-override">Command Override</Label>
- <Input
- id="command-override"
- bind:value={commandOverride}
- placeholder="e.g., /app/run --config /etc/config.yml"
- disabled={isCreating}
- />
- <p class="text-muted-foreground text-xs">
- Overrides the image's default command. Separate arguments with spaces.
- </p>
- </div>
- <div class="space-y-2">
- <Label for="run-as-user">Run as User</Label>
- <Input
- id="run-as-user"
- bind:value={runAsUser}
- placeholder="e.g., 1000:1000 or node"
- disabled={isCreating}
- />
- <p class="text-muted-foreground text-xs">Specify user/group ID or name.</p>
- </div>
- </div>
- </div>
-
- <div class="space-y-4">
- <h3 class="text-lg font-medium">Resource Limits</h3>
- <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- <div class="space-y-2">
- <Label for="memory-limit">Memory Limit</Label>
- <Input
- id="memory-limit"
- bind:value={memoryLimitStr}
- placeholder="e.g., 512m, 1g"
- disabled={isCreating}
- />
- <p class="text-muted-foreground text-xs">
- Format: number + unit (b, k, m, g). Minimum 4m.
- </p>
- </div>
- <div class="space-y-2">
- <Label for="cpu-limit">CPU Limit (cores)</Label>
- <Input
- id="cpu-limit"
- bind:value={cpuLimitStr}
- placeholder="e.g., 0.5, 1, 2"
- disabled={isCreating}
- type="number"
- step="0.1"
- min="0.01"
- />
- <p class="text-muted-foreground text-xs">
- Number of CPU cores (e.g., 1.5 = 1.5 cores).
- </p>
- </div>
- </div>
- </div>
-
- <div class="flex items-center space-x-2 border-t py-4">
- <Switch id="auto-update" name="autoUpdate" bind:checked={autoUpdate} />
- <Label for="auto-update" class="font-medium">Enable auto-update</Label>
- <p class="text-muted-foreground text-xs">
- When enabled, Arcane will periodically check for newer versions of this
- container's image and automatically update it.
- </p>
- </div>
- </div>
- </Tabs.Content>
- </div>
- </div>
- </Tabs.Root>
-
- <Dialog.Footer class="pt-4">
- <ArcaneButton action="cancel" onClick={handleClose} disabled={isCreating} class="mr-2" />
- <ArcaneButton
- action="create"
- loading={isCreating}
- onClick={handleSubmit}
- disabled={isCreating || !containerName.trim() || !selectedImage}
- />
- </Dialog.Footer>
- </Dialog.Content>
-</Dialog.Root>
diff --git a/frontend/src/routes/customize/registries/+page.svelte b/frontend/src/routes/customize/registries/+page.svelte
index 373849036..f89ad138a 100644
--- a/frontend/src/routes/customize/registries/+page.svelte
+++ b/frontend/src/routes/customize/registries/+page.svelte
@@ -5,18 +5,12 @@
import UniversalTable from '$lib/components/universal-table.svelte';
import * as Table from '$lib/components/ui/table';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import ContainerRegistryFormDialog from '$lib/components/dialogs/container-registry-form-dialog.svelte';
+ import ContainerRegistryFormSheet from '$lib/components/sheets/container-registry-sheet.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { toast } from 'svelte-sonner';
- import { invalidateAll } from '$app/navigation';
import type { ContainerRegistry } from '$lib/models/container-registry';
- import type {
- ContainerRegistryCreateDto,
- ContainerRegistryUpdateDto
- } from '$lib/dto/container-registry-dto';
- import ContainerRegistryAPIService from '$lib/services/api/container-registry-api-service';
-
- const containerRegistryAPI = new ContainerRegistryAPIService();
+ import type { ContainerRegistryCreateDto, ContainerRegistryUpdateDto } from '$lib/dto/container-registry-dto';
+ import { containerRegistryAPI } from '$lib/services/api';
let { data } = $props();
let registries = $state<ContainerRegistry[]>(data.registries || []);
@@ -45,19 +39,13 @@
}
// Updated function signature - now receives detail directly
- async function handleRegistryDialogSubmit(detail: {
- registry: ContainerRegistryCreateDto | ContainerRegistryUpdateDto;
- isEditMode: boolean;
- }) {
+ async function handleRegistryDialogSubmit(detail: { registry: ContainerRegistryCreateDto | ContainerRegistryUpdateDto; isEditMode: boolean }) {
const { registry, isEditMode } = detail;
isLoadingAction = true;
try {
if (isEditMode && registryToEdit?.id) {
- await containerRegistryAPI.updateRegistry(
- registryToEdit.id,
- registry as ContainerRegistryUpdateDto
- );
+ await containerRegistryAPI.updateRegistry(registryToEdit.id, registry as ContainerRegistryUpdateDto);
toast.success('Registry updated successfully');
} else {
await containerRegistryAPI.createRegistry(registry as ContainerRegistryCreateDto);
@@ -124,20 +112,13 @@
<title>Container Registries - Arcane</title>
</svelte:head>
-<ContainerRegistryFormDialog
- bind:open={isRegistryDialogOpen}
- bind:registryToEdit
- onSubmit={handleRegistryDialogSubmit}
- isLoading={isLoadingAction}
-/>
+<ContainerRegistryFormSheet bind:open={isRegistryDialogOpen} bind:registryToEdit onSubmit={handleRegistryDialogSubmit} isLoading={isLoadingAction} />
<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">Container Registries</h1>
- <p class="text-muted-foreground mt-1 text-sm">
- Configure access credentials for private Docker registries and container repositories
- </p>
+ <p class="text-muted-foreground mt-1 text-sm">Configure access credentials for private Docker registries and container repositories</p>
</div>
<div class="flex gap-2">
@@ -145,11 +126,7 @@
<RefreshCw class="size-4" />
Refresh
</Button>
- <Button
- onclick={openCreateRegistryDialog}
- disabled={isLoadingAction}
- class="arcane-button-save h-10"
- >
+ <Button onclick={openCreateRegistryDialog} disabled={isLoadingAction} class="arcane-button-save h-10">
{#if isLoadingAction}
<RefreshCw class="size-4 animate-spin" />
Processing...
@@ -169,26 +146,18 @@
</div>
<div>
<Card.Title>Docker Registry Credentials</Card.Title>
- <Card.Description>
- Manage authentication credentials for private Docker registries like Docker Hub, GitHub
- Container Registry, Google Container Registry, and custom registries
- </Card.Description>
+ <Card.Description>Manage authentication credentials for private Docker registries like Docker Hub, GitHub Container Registry, Google Container Registry, and custom registries</Card.Description>
</div>
</div>
</Card.Header>
<Card.Content>
{#if !registries || registries.length === 0}
<div class="py-12 text-center">
- <div
- class="bg-muted/30 mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full"
- >
+ <div class="bg-muted/30 mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full">
<Key class="text-muted-foreground size-8" />
</div>
<h3 class="mb-2 text-lg font-medium">No Registry Credentials</h3>
- <p class="text-muted-foreground mx-auto mb-4 max-w-sm text-sm">
- Add registry credentials to authenticate with private Docker registries when pulling
- images.
- </p>
+ <p class="text-muted-foreground mx-auto mb-4 max-w-sm text-sm">Add registry credentials to authenticate with private Docker registries when pulling images.</p>
<Button onclick={openCreateRegistryDialog} class="arcane-button-save">
<Plus class="size-4" />
Add Your First Registry
@@ -252,11 +221,7 @@
</span>
</Table.Cell>
<Table.Cell>
- <span
- class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium {item.enabled
- ? 'bg-green-100 text-green-800'
- : 'bg-gray-100 text-gray-800'}"
- >
+ <span class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium {item.enabled ? 'bg-green-100 text-green-800' : 'bg-gray-100 text-gray-800'}">
{item.enabled ? 'Enabled' : 'Disabled'}
</span>
</Table.Cell>
@@ -279,10 +244,7 @@
<Pencil class="mr-2 size-4" />
Edit
</DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => confirmRemoveRegistry(item)}
- class="focus:bg-destructive/10 text-red-500 focus:text-red-700!"
- >
+ <DropdownMenu.Item onclick={() => confirmRemoveRegistry(item)} class="focus:bg-destructive/10 text-red-500 focus:text-red-700!">
<Trash2 class="mr-2 size-4" />
Remove
</DropdownMenu.Item>
diff --git a/frontend/src/routes/customize/templates/+page.svelte b/frontend/src/routes/customize/templates/+page.svelte
index 95c557be8..a992a3d17 100644
--- a/frontend/src/routes/customize/templates/+page.svelte
+++ b/frontend/src/routes/customize/templates/+page.svelte
@@ -1,30 +1,16 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
import { Card } from '$lib/components/ui/card/index.js';
import { Badge } from '$lib/components/ui/badge/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
import { Separator } from '$lib/components/ui/separator/index.js';
import { Switch } from '$lib/components/ui/switch/index.js';
- import { Textarea } from '$lib/components/ui/textarea/index.js';
- import {
- Trash2,
- Plus,
- ExternalLink,
- RefreshCw,
- FileText,
- Globe,
- FolderOpen,
- Users,
- Copy,
- AlertCircle,
- CheckCircle
- } from '@lucide/svelte';
- import type { PageData } from '../../settings/templates/$types';
+ import { Trash2, Plus, ExternalLink, RefreshCw, FileText, Globe, FolderOpen, Users, Copy } from '@lucide/svelte';
+ import type { PageData } from './$types';
import { templateAPI } from '$lib/services/api';
import { toast } from 'svelte-sonner';
import { invalidateAll } from '$app/navigation';
+ import AddTemplateRegistrySheet from '$lib/components/sheets/add-template-registry-sheet.svelte';
let { data }: { data: PageData } = $props();
@@ -32,117 +18,21 @@
let templates = $state(data.templates || []);
let registries = $state(data.registries || []);
- // Form state for new registry
- let newRegistry = $state({
- name: '',
- url: '',
- description: '',
- enabled: true
- });
-
// Loading states
let isLoading = $state({
addingRegistry: false,
- refreshing: new Set<number>(),
removing: new Set<number>(),
- updating: new Set<number>(),
- validating: false
+ updating: new Set<number>()
});
- // Validation state
- let validationResult = $state<{
- valid: boolean;
- errors: string[];
- warnings: string[];
- } | null>(null);
+ let showAddRegistrySheet = $state(false);
// Computed values
const localTemplateCount = $derived(templates.filter((t) => !t.isRemote).length);
const remoteTemplateCount = $derived(templates.filter((t) => t.isRemote).length);
- // Validate registry URL
- async function validateRegistryUrl(url: string) {
- if (!url.trim()) {
- validationResult = null;
- return;
- }
-
- isLoading.validating = true;
- try {
- new URL(url);
-
- const data = await templateAPI.fetchRegistry(url);
-
- if (!data.name || !data.templates || !Array.isArray(data.templates)) {
- throw new Error('Invalid registry format: missing required fields (name, templates)');
- }
-
- validationResult = {
- valid: true,
- errors: [],
- warnings: data.templates.length === 0 ? ['Registry contains no templates'] : []
- };
-
- if (!newRegistry.name.trim()) {
- newRegistry.name = data.name;
- }
- } catch (error) {
- validationResult = {
- valid: false,
- errors: [error instanceof Error ? error.message : 'Invalid registry URL'],
- warnings: []
- };
- } finally {
- isLoading.validating = false;
- }
- }
-
- // Add new registry
- async function addRegistry() {
- if (!newRegistry.url.trim() || !newRegistry.name.trim()) {
- toast.error('Registry URL and name are required');
- return;
- }
-
- if (validationResult && !validationResult.valid) {
- toast.error('Please fix validation errors before adding the registry');
- return;
- }
-
- if (isLoading.addingRegistry) return;
- isLoading.addingRegistry = true;
-
- try {
- const created = await templateAPI.addRegistry({
- name: newRegistry.name.trim(),
- url: newRegistry.url.trim(),
- description: newRegistry.description.trim() || undefined,
- enabled: newRegistry.enabled
- });
-
- registries = [...registries, created];
-
- // Clear form
- newRegistry = {
- name: '',
- url: '',
- description: '',
- enabled: true
- };
- validationResult = null;
-
- toast.success('Registry added successfully');
- await invalidateAll();
- } catch (error) {
- console.error('Error adding registry:', error);
- toast.error(error instanceof Error ? error.message : 'Failed to add registry');
- } finally {
- isLoading.addingRegistry = false;
- }
- }
-
// Update registry
- async function updateRegistry(id: number, updates: Partial<typeof newRegistry>) {
+ async function updateRegistry(id: number, updates: { enabled?: boolean }) {
if (isLoading.updating.has(id)) return;
isLoading.updating.add(id);
@@ -154,9 +44,9 @@
}
await templateAPI.updateRegistry(id, {
- name: updates.name ?? registry.name,
- url: updates.url ?? registry.url,
- description: updates.description ?? registry.description,
+ name: registry.name,
+ url: registry.url,
+ description: registry.description,
enabled: updates.enabled ?? registry.enabled
});
@@ -213,18 +103,30 @@
});
}
- // Watch URL changes for validation
- $effect(() => {
- if (newRegistry.url.trim()) {
- const timeoutId = setTimeout(() => {
- validateRegistryUrl(newRegistry.url);
- }, 500); // Debounce validation
+ // Handle registry form submission
+ async function handleRegistrySubmit(registry: { name: string; url: string; description?: string; enabled: boolean }) {
+ isLoading.addingRegistry = true;
+
+ try {
+ const created = await templateAPI.addRegistry({
+ name: registry.name.trim(),
+ url: registry.url.trim(),
+ description: registry.description?.trim() || undefined,
+ enabled: registry.enabled
+ });
- return () => clearTimeout(timeoutId);
- } else {
- validationResult = null;
+ registries = [...registries, created];
+ showAddRegistrySheet = false;
+
+ toast.success('Registry added successfully');
+ await invalidateAll();
+ } catch (error) {
+ console.error('Error adding registry:', error);
+ toast.error(error instanceof Error ? error.message : 'Failed to add registry');
+ } finally {
+ isLoading.addingRegistry = false;
}
- });
+ }
</script>
<svelte:head>
@@ -237,10 +139,7 @@
<h1 class="text-3xl font-bold tracking-tight">Template Settings</h1>
<p class="text-muted-foreground mt-1 text-sm">
Manage Docker Compose template sources and registries
- <a
- href="https://arcane.ofkm.dev/docs/templates/use-templates"
- class="text-primary ml-1 hover:underline">→ Learn more</a
- >
+ <a href="https://arcane.ofkm.dev/docs/templates/use-templates" class="text-primary ml-1 hover:underline">→ Learn more</a>
</p>
</div>
@@ -289,10 +188,7 @@
<Alert.Root>
<FolderOpen class="size-4" />
<Alert.Title>Local Template Directory</Alert.Title>
- <Alert.Description
- >Local templates are stored in the database and can be managed through the templates page.
- You can create, edit, and delete custom templates that are stored locally on your server.</Alert.Description
- >
+ <Alert.Description>Local templates are stored in the database and can be managed through the templates page. You can create, edit, and delete custom templates that are stored locally on your server.</Alert.Description>
</Alert.Root>
</div>
@@ -302,15 +198,16 @@
<div class="space-y-4">
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold">Remote Template Registries</h2>
+ <Button onclick={() => (showAddRegistrySheet = true)}>
+ <Plus class="mr-2 size-4" />
+ Add Registry
+ </Button>
</div>
<Alert.Root>
<Globe class="size-4" />
<Alert.Title>Remote Registries</Alert.Title>
- <Alert.Description
- >Add remote template registries to access community templates. Registries should provide a
- JSON manifest with template definitions and download URLs.</Alert.Description
- >
+ <Alert.Description>Add remote template registries to access community templates. Registries should provide a JSON manifest with template definitions and download URLs.</Alert.Description>
</Alert.Root>
<Alert.Root class="border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950">
@@ -319,14 +216,8 @@
<Alert.Description class="space-y-2">
<p>Get started quickly with our community registry containing popular templates:</p>
<div class="mt-2 flex items-center gap-2">
- <code class="rounded bg-white px-2 py-1 text-xs dark:bg-gray-800">
- https://templates.arcane.ofkm.dev/registry.json
- </code>
- <Button
- size="sm"
- variant="outline"
- onclick={() => copyToClipboard('https://templates.arcane.ofkm.dev/registry.json')}
- >
+ <code class="rounded bg-white px-2 py-1 text-xs dark:bg-gray-800"> https://templates.arcane.ofkm.dev/registry.json </code>
+ <Button size="sm" variant="outline" onclick={() => copyToClipboard('https://templates.arcane.ofkm.dev/registry.json')}>
<Copy class="mr-1 size-3" />
Copy
</Button>
@@ -334,99 +225,6 @@
</Alert.Description>
</Alert.Root>
- <!-- Add New Registry Form -->
- <Card class="p-4">
- <h3 class="mb-3 font-medium">Add Registry</h3>
- <div class="space-y-4">
- <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- <div>
- <Label for="registry-url">Registry URL *</Label>
- <Input
- id="registry-url"
- bind:value={newRegistry.url}
- type="url"
- placeholder="https://raw.githubusercontent.com/username/repo/main/registry.json"
- disabled={isLoading.addingRegistry}
- class={validationResult && !validationResult.valid ? 'border-red-500' : ''}
- required
- />
- {#if isLoading.validating}
- <p class="text-muted-foreground mt-1 flex items-center gap-1 text-xs">
- <RefreshCw class="size-3 animate-spin" />
- Validating...
- </p>
- {:else if validationResult}
- {#if validationResult.valid}
- <p class="mt-1 flex items-center gap-1 text-xs text-green-600">
- <CheckCircle class="size-3" />
- Valid registry
- </p>
- {:else}
- <p class="mt-1 flex items-center gap-1 text-xs text-red-600">
- <AlertCircle class="size-3" />
- {validationResult.errors[0]}
- </p>
- {/if}
- {/if}
- </div>
- <div>
- <Label for="registry-name">Registry Name *</Label>
- <Input
- id="registry-name"
- bind:value={newRegistry.name}
- placeholder="My Template Registry"
- disabled={isLoading.addingRegistry}
- required
- />
- <p class="text-muted-foreground mt-1 text-xs">Auto-filled from registry manifest</p>
- </div>
- </div>
-
- <div>
- <Label for="registry-description">Description (Optional)</Label>
- <Textarea
- id="registry-description"
- bind:value={newRegistry.description}
- placeholder="A collection of useful Docker Compose templates"
- disabled={isLoading.addingRegistry}
- rows={2}
- />
- </div>
-
- <div class="flex items-center gap-2">
- <Switch bind:checked={newRegistry.enabled} disabled={isLoading.addingRegistry} />
- <Label>Enable registry</Label>
- </div>
-
- {#if validationResult && validationResult.warnings.length > 0}
- <Alert.Root
- class="border-yellow-200 bg-yellow-50 dark:border-yellow-800 dark:bg-yellow-950"
- >
- <AlertCircle class="size-4" />
- <Alert.Title>Warnings</Alert.Title>
- <Alert.Description>
- <ul class="list-inside list-disc">
- {#each validationResult.warnings as warning}
- <li>{warning}</li>
- {/each}
- </ul>
- </Alert.Description>
- </Alert.Root>
- {/if}
-
- <Button
- onclick={addRegistry}
- disabled={isLoading.addingRegistry ||
- !newRegistry.url.trim() ||
- !newRegistry.name.trim() ||
- (validationResult && !validationResult.valid)}
- >
- <Plus class="mr-2 size-4" />
- {isLoading.addingRegistry ? 'Adding Registry...' : 'Add Registry'}
- </Button>
- </div>
- </Card>
-
<!-- Registry List -->
{#if registries.length > 0}
<div class="space-y-3">
@@ -450,28 +248,15 @@
</div>
<div class="flex items-center gap-2">
<!-- Toggle enabled/disabled -->
- <Switch
- checked={registry.enabled}
- onCheckedChange={(checked) => updateRegistry(registry.id, { enabled: checked })}
- disabled={isLoading.updating.has(registry.id)}
- />
+ <Switch checked={registry.enabled} onCheckedChange={(checked) => updateRegistry(registry.id, { enabled: checked })} disabled={isLoading.updating.has(registry.id)} />
<!-- Open registry URL -->
- <Button
- variant="outline"
- size="sm"
- onclick={() => window.open(registry.url, '_blank')}
- >
+ <Button variant="outline" size="sm" onclick={() => window.open(registry.url, '_blank')}>
<ExternalLink class="size-4" />
</Button>
<!-- Remove registry -->
- <Button
- variant="destructive"
- size="sm"
- onclick={() => removeRegistry(registry.id)}
- disabled={isLoading.removing.has(registry.id)}
- >
+ <Button variant="destructive" size="sm" onclick={() => removeRegistry(registry.id)} disabled={isLoading.removing.has(registry.id)}>
{#if isLoading.removing.has(registry.id)}
<RefreshCw class="size-4 animate-spin" />
{:else}
@@ -491,4 +276,7 @@
</div>
{/if}
</div>
+
+ <!-- Add Template Registry Sheet -->
+ <AddTemplateRegistrySheet bind:open={showAddRegistrySheet} onSubmit={handleRegistrySubmit} isLoading={isLoading.addingRegistry} />
</div>
diff --git a/frontend/src/routes/customize/templates/+page.ts b/frontend/src/routes/customize/templates/+page.ts
index 42d4b2228..eebeebe7e 100644
--- a/frontend/src/routes/customize/templates/+page.ts
+++ b/frontend/src/routes/customize/templates/+page.ts
@@ -2,10 +2,7 @@ import { templateAPI } from '$lib/services/api';
export const load = async () => {
try {
- const [templates, registries] = await Promise.all([
- templateAPI.loadAll().catch(() => []),
- templateAPI.getRegistries().catch(() => [])
- ]);
+ const [templates, registries] = await Promise.all([templateAPI.loadAll().catch(() => []), templateAPI.getRegistries().catch(() => [])]);
const localTemplateCount = templates.filter((t) => !t.isRemote).length;
const remoteTemplateCount = templates.filter((t) => t.isRemote).length;
diff --git a/frontend/src/routes/images/+page.svelte b/frontend/src/routes/images/+page.svelte
index 3ec6cb092..bad4fc3dd 100644
--- a/frontend/src/routes/images/+page.svelte
+++ b/frontend/src/routes/images/+page.svelte
@@ -3,22 +3,12 @@
import type { EnhancedImageInfo } from '$lib/types/docker';
import UniversalTable from '$lib/components/universal-table.svelte';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- Download,
- AlertCircle,
- HardDrive,
- Trash2,
- Loader2,
- ChevronDown,
- Ellipsis,
- ScanSearch,
- Funnel
- } from '@lucide/svelte';
+ import { Download, AlertCircle, HardDrive, Trash2, Loader2, ChevronDown, Ellipsis, ScanSearch, Funnel } from '@lucide/svelte';
import * as Alert from '$lib/components/ui/alert/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
- import PullImageDialog from './pull-image-dialog.svelte';
+ import ImagePullSheet from '$lib/components/sheets/image-pull-sheet.svelte';
import { formatBytes } from '$lib/utils/bytes.util';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -31,12 +21,7 @@
import ArcaneButton from '$lib/components/arcane-button.svelte';
import { tablePersistence } from '$lib/stores/table-store';
import MaturityItem from '$lib/components/maturity-item.svelte';
- import {
- maturityStore,
- triggerBulkMaturityCheck,
- enhanceImagesWithMaturity,
- loadImageMaturityBatch
- } from '$lib/stores/maturity-store';
+ import { maturityStore, triggerBulkMaturityCheck, enhanceImagesWithMaturity, loadImageMaturityBatch } from '$lib/stores/maturity-store';
let { data }: { data: PageData } = $props();
let images = $derived(data.images || []);
@@ -68,11 +53,7 @@
const enhancedImages = $derived(enhanceImagesWithMaturity(images, $maturityStore.maturityData));
- const filteredImages = $derived(
- enhancedImages.filter(
- (img) => (imageFilters.showUsed && img.InUse) || (imageFilters.showUnused && !img.InUse)
- ) as EnhancedImageInfo[]
- );
+ const filteredImages = $derived(enhancedImages.filter((img) => (imageFilters.showUsed && img.InUse) || (imageFilters.showUnused && !img.InUse)) as EnhancedImageInfo[]);
$effect(() => {
if (images && images.length > 0) {
@@ -204,13 +185,8 @@
});
if (!response.ok || !response.body) {
- const errorData = await response
- .json()
- .catch(() => ({ error: 'Failed to pull image. Server returned an error.' }));
- const errorMessage =
- typeof errorData.error === 'string'
- ? errorData.error
- : errorData.message || `HTTP error ${response.status}`;
+ const errorData = await response.json().catch(() => ({ error: 'Failed to pull image. Server returned an error.' }));
+ const errorMessage = typeof errorData.error === 'string' ? errorData.error : errorData.message || `HTTP error ${response.status}`;
throw new Error(errorMessage);
}
@@ -232,10 +208,7 @@
const data = JSON.parse(line);
if (data.error) {
console.error('Error in stream:', data.error);
- pullError =
- typeof data.error === 'string'
- ? data.error
- : data.error.message || 'An error occurred during pull.';
+ pullError = typeof data.error === 'string' ? data.error : data.error.message || 'An error occurred during pull.';
lastStatusText = `Error: ${pullError}`;
toast.error(lastStatusText, { id: `pull-${imageIdentifier}` });
continue;
@@ -376,37 +349,11 @@
</DropdownMenu.Content>
</DropdownMenu.Root>
{#if selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- onClick={() => handleDeleteSelected()}
- loading={isLoading.removing}
- disabled={isLoading.removing}
- />
+ <ArcaneButton action="remove" onClick={() => handleDeleteSelected()} loading={isLoading.removing} disabled={isLoading.removing} />
{/if}
- <ArcaneButton
- action="remove"
- label="Prune Unused"
- onClick={() => (isConfirmPruneDialogOpen = true)}
- loading={isLoading.pruning}
- loadingLabel="Pruning..."
- disabled={isLoading.pruning}
- />
- <ArcaneButton
- action="pull"
- label="Pull Image"
- onClick={() => (isPullDialogOpen = true)}
- loading={isLoading.pulling}
- loadingLabel="Pulling..."
- disabled={isLoading.pulling}
- />
- <ArcaneButton
- action="inspect"
- label="Recheck Maturities"
- onClick={() => handleTriggerBulkMaturityCheck()}
- loading={isLoading.checking}
- loadingLabel="Checking..."
- disabled={isLoading.checking}
- />
+ <ArcaneButton action="remove" label="Prune Unused" onClick={() => (isConfirmPruneDialogOpen = true)} loading={isLoading.pruning} loadingLabel="Pruning..." disabled={isLoading.pruning} />
+ <ArcaneButton action="pull" label="Pull Image" onClick={() => (isPullDialogOpen = true)} loading={isLoading.pulling} loadingLabel="Pulling..." disabled={isLoading.pulling} />
+ <ArcaneButton action="inspect" label="Recheck Maturities" onClick={() => handleTriggerBulkMaturityCheck()} loading={isLoading.checking} loadingLabel="Checking..." disabled={isLoading.checking} />
</div>
</div>
</Card.Header>
@@ -442,13 +389,7 @@
<Table.Cell>
<div class="flex items-center gap-2">
<div class="flex flex-1 items-center">
- <MaturityItem
- maturity={item.maturity}
- imageId={item.Id}
- repo={item.repo}
- tag={item.tag}
- isLoadingInBackground={$maturityStore.isChecking}
- />
+ <MaturityItem maturity={item.maturity} imageId={item.Id} repo={item.repo} tag={item.tag} isLoadingInBackground={$maturityStore.isChecking} />
<a class="shrink truncate font-medium hover:underline" href="/images/{item.Id}/">
{item.repo}
</a>
@@ -481,10 +422,7 @@
<ScanSearch class="size-4" />
Inspect
</DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => handleInlineImagePull(item.Id, item.RepoTags?.[0] || '')}
- disabled={isPullingInline[item.Id] || !item.RepoTags?.[0]}
- >
+ <DropdownMenu.Item onclick={() => handleInlineImagePull(item.Id, item.RepoTags?.[0] || '')} disabled={isPullingInline[item.Id] || !item.RepoTags?.[0]}>
{#if isPullingInline[item.Id]}
<Loader2 class="size-4 animate-spin" />
Pulling...
@@ -493,10 +431,7 @@
Pull
{/if}
</DropdownMenu.Item>
- <DropdownMenu.Item
- class="focus:text-red-700! text-red-500"
- onclick={() => handleImageRemove(item.Id)}
- >
+ <DropdownMenu.Item class="focus:text-red-700! text-red-500" onclick={() => handleImageRemove(item.Id)}>
<Trash2 class="size-4" />
Remove
</DropdownMenu.Item>
@@ -509,14 +444,10 @@
</Card.Content>
</Card.Root>
{:else if !error}
- <div
- class="bg-card flex flex-col items-center justify-center rounded-lg border px-6 py-12 text-center"
- >
+ <div class="bg-card flex flex-col items-center justify-center rounded-lg border px-6 py-12 text-center">
<HardDrive class="text-muted-foreground mb-4 size-12 opacity-40" />
<p class="text-lg font-medium">No images found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Pull a new image using the "Pull Image" button above or use the Docker CLI
- </p>
+ <p class="text-muted-foreground mt-1 max-w-md text-sm">Pull a new image using the "Pull Image" button above or use the Docker CLI</p>
<div class="mt-4 flex gap-3">
<Button variant="outline" size="sm" onclick={() => (isPullDialogOpen = true)}>
<Download class="size-4" />
@@ -526,23 +457,16 @@
</div>
{/if}
- <PullImageDialog bind:open={isPullDialogOpen} onPullFinished={() => invalidateAll()} />
+ <ImagePullSheet bind:open={isPullDialogOpen} onPullFinished={() => invalidateAll()} />
<Dialog.Root bind:open={isConfirmPruneDialogOpen}>
<Dialog.Content>
<Dialog.Header>
<Dialog.Title>Prune Unused Images</Dialog.Title>
- <Dialog.Description
- >Are you sure you want to remove all unused (dangling) Docker images? This will free up
- disk space but cannot be undone. Images actively used by containers will not be affected.</Dialog.Description
- >
+ <Dialog.Description>Are you sure you want to remove all unused (dangling) Docker images? This will free up disk space but cannot be undone. Images actively used by containers will not be affected.</Dialog.Description>
</Dialog.Header>
<div class="flex justify-end gap-3 pt-6">
- <Button
- variant="outline"
- onclick={() => (isConfirmPruneDialogOpen = false)}
- disabled={isLoading.pruning}>Cancel</Button
- >
+ <Button variant="outline" onclick={() => (isConfirmPruneDialogOpen = false)} disabled={isLoading.pruning}>Cancel</Button>
<Button variant="destructive" onclick={handlePruneImages} disabled={isLoading.pruning}>
{#if isLoading.pruning}
<Loader2 class="mr-2 size-4 animate-spin" /> Pruning...
diff --git a/frontend/src/routes/images/+page.ts b/frontend/src/routes/images/+page.ts
index 1047aa2a4..eee27afda 100644
--- a/frontend/src/routes/images/+page.ts
+++ b/frontend/src/routes/images/+page.ts
@@ -10,10 +10,7 @@ type ImageData = {
export const load = async (): Promise<ImageData> => {
try {
- const [images, settings] = await Promise.all([
- imageAPI.list() as Promise<EnhancedImageInfo[]>,
- settingsAPI.getSettings()
- ]);
+ const [images, settings] = await Promise.all([imageAPI.list() as Promise<EnhancedImageInfo[]>, settingsAPI.getSettings()]);
const enhancedImages = await Promise.all(
images.map(async (image): Promise<EnhancedImageInfo> => {
diff --git a/frontend/src/routes/images/[imageId]/+page.svelte b/frontend/src/routes/images/[imageId]/+page.svelte
index 5545121e9..4f5908207 100644
--- a/frontend/src/routes/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/images/[imageId]/+page.svelte
@@ -2,17 +2,7 @@
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 {
- ArrowLeft,
- HardDrive,
- Clock,
- Tag,
- Layers,
- Hash,
- Trash2,
- Loader2,
- Cpu
- } from '@lucide/svelte';
+ import { ArrowLeft, HardDrive, Clock, Tag, Layers, Hash, Trash2, Loader2, Cpu } from '@lucide/svelte';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import { goto } from '$app/navigation';
import { Separator } from '$lib/components/ui/separator/index.js';
@@ -86,13 +76,7 @@
</div>
<div class="flex flex-wrap gap-2">
- <ArcaneButton
- action="remove"
- onClick={() => handleImageRemove(image.Id)}
- loading={isLoading.removing}
- disabled={isLoading.removing}
- size="sm"
- />
+ <ArcaneButton action="remove" onClick={() => handleImageRemove(image.Id)} loading={isLoading.removing} disabled={isLoading.removing} size="sm" />
</div>
</div>
@@ -106,9 +90,7 @@
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
<!-- ID -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
<Hash class="size-5 text-gray-500" />
</div>
<div class="min-w-0 flex-1">
@@ -119,9 +101,7 @@
<!-- Size -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
<HardDrive class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
@@ -132,9 +112,7 @@
<!-- Created -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
<Clock class="size-5 text-green-500" />
</div>
<div class="min-w-0 flex-1">
@@ -145,9 +123,7 @@
<!-- Architecture -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2">
<Cpu class="size-5 text-orange-500" />
</div>
<div class="min-w-0 flex-1">
@@ -158,9 +134,7 @@
<!-- OS -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
<Layers class="size-5 text-indigo-500" />
</div>
<div class="min-w-0 flex-1">
@@ -176,9 +150,7 @@
{#if image.RepoTags && image.RepoTags.length > 0}
<Card.Root class="border shadow-sm">
<Card.Header>
- <Card.Title class="flex items-center gap-2"
- ><Tag class="text-muted-foreground size-5" /> Tags</Card.Title
- >
+ <Card.Title class="flex items-center gap-2"><Tag class="text-muted-foreground size-5" /> Tags</Card.Title>
</Card.Header>
<Card.Content>
<div class="flex flex-wrap gap-2">
@@ -199,9 +171,7 @@
<Card.Content class="space-y-2">
{#each Object.entries(image.Config.Labels) as [key, value] (key)}
<div class="flex flex-col text-sm sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full font-medium break-all sm:w-1/4"
- >{key}:</span
- >
+ <span class="text-muted-foreground w-full font-medium break-all sm:w-1/4">{key}:</span>
<span class="w-full font-mono text-xs break-all sm:w-3/4 sm:text-sm">{value}</span>
</div>
{#if !Object.is(Object.keys(image.Config.Labels).length - 1, Object.keys(image.Config.Labels).indexOf(key))}
@@ -215,13 +185,7 @@
{:else}
<div class="py-12 text-center">
<p class="text-muted-foreground text-lg font-medium">Image not found.</p>
- <ArcaneButton
- action="cancel"
- customLabel="Back to Images"
- onClick={() => goto('/images')}
- size="sm"
- class="mt-4"
- />
+ <ArcaneButton action="cancel" customLabel="Back to Images" onClick={() => goto('/images')} size="sm" class="mt-4" />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/networks/+page.svelte b/frontend/src/routes/networks/+page.svelte
index bbfeb983e..a2cab1951 100644
--- a/frontend/src/routes/networks/+page.svelte
+++ b/frontend/src/routes/networks/+page.svelte
@@ -1,28 +1,20 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
- import {
- Plus,
- AlertCircle,
- Network,
- Trash2,
- Loader2,
- ScanSearch,
- Ellipsis
- } from '@lucide/svelte';
+ import { Plus, AlertCircle, Network, Trash2, Loader2, ScanSearch, Ellipsis } from '@lucide/svelte';
import UniversalTable from '$lib/components/universal-table.svelte';
import type { PageData } from './$types';
import * as Alert from '$lib/components/ui/alert/index.js';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import CreateNetworkDialog from './CreateNetworkDialog.svelte';
+ import CreateNetworkSheet from '$lib/components/sheets/create-network-sheet.svelte';
import * as Table from '$lib/components/ui/table';
import type { NetworkCreateOptions, NetworkInspectInfo } from 'dockerode';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import NetworkAPIService from '$lib/services/api/network-api-service';
+ import { networkAPI } from '$lib/services/api';
import { DEFAULT_NETWORK_NAMES } from '$lib/constants';
import ArcaneButton from '$lib/components/arcane-button.svelte';
import { tablePersistence } from '$lib/stores/table-store';
@@ -51,18 +43,12 @@
const totalNetworks = $derived(networkPageStates.networks.length);
// NetworkInfo uses 'Driver' (capital D)
- const bridgeNetworks = $derived(
- networkPageStates.networks.filter((n) => n.Driver === 'bridge').length
- );
- const overlayNetworks = $derived(
- networkPageStates.networks.filter((n) => n.Driver === 'overlay').length
- );
-
- const networkApi = new NetworkAPIService();
+ const bridgeNetworks = $derived(networkPageStates.networks.filter((n) => n.Driver === 'bridge').length);
+ const overlayNetworks = $derived(networkPageStates.networks.filter((n) => n.Driver === 'overlay').length);
async function handleCreateNetworkSubmit(options: NetworkCreateOptions) {
handleApiResultWithCallbacks({
- result: await tryCatch(networkApi.create(options)),
+ result: await tryCatch(networkAPI.create(options)),
message: `Failed to Create Network "${options.Name}"`,
setLoadingState: (value) => (isLoading.create = value),
onSuccess: async () => {
@@ -86,7 +72,7 @@
destructive: true,
action: async () => {
handleApiResultWithCallbacks({
- result: await tryCatch(networkApi.remove(encodeURIComponent(id))),
+ result: await tryCatch(networkAPI.remove(encodeURIComponent(id))),
message: `Failed to Remove Network "${name}"`,
setLoadingState: (value) => (isLoading.remove = value),
onSuccess: async () => {
@@ -130,7 +116,7 @@
for (const network of selectedNetworkDetails) {
// Iterate over details which includes name
- const result = await tryCatch(networkApi.remove(encodeURIComponent(network.id)));
+ const result = await tryCatch(networkAPI.remove(encodeURIComponent(network.id)));
// The setLoadingState in a loop like this will just toggle the global remove state
// For individual item loading, a more complex state management would be needed.
if (result.data) {
@@ -138,9 +124,7 @@
successCount++;
} else if (result.error) {
const error = result.error as any;
- toast.error(
- `Failed to delete network "${network.name}": ${error.message || 'Unknown error'}`
- );
+ toast.error(`Failed to delete network "${network.name}": ${error.message || 'Unknown error'}`);
failureCount++;
}
}
@@ -159,12 +143,7 @@
}
function getNetworkSubnet(network: NetworkInspectInfo): string {
- if (
- network.IPAM &&
- network.IPAM.Config &&
- network.IPAM.Config.length > 0 &&
- network.IPAM.Config[0].Subnet
- ) {
+ if (network.IPAM && network.IPAM.Config && network.IPAM.Config.length > 0 && network.IPAM.Config[0].Subnet) {
return network.IPAM.Config[0].Subnet;
}
return 'N/A';
@@ -233,21 +212,9 @@
</div>
<div class="flex items-center gap-2">
{#if networkPageStates.selectedNetworks.length > 0}
- <ArcaneButton
- action="remove"
- customLabel="Delete Selected ({networkPageStates.selectedNetworks.length})"
- onClick={() => handleDeleteSelected()}
- loading={isLoading.remove}
- loadingLabel="Processing..."
- disabled={isLoading.remove}
- />
+ <ArcaneButton action="remove" customLabel="Delete Selected ({networkPageStates.selectedNetworks.length})" onClick={() => handleDeleteSelected()} loading={isLoading.remove} loadingLabel="Processing..." disabled={isLoading.remove} />
{/if}
- <ArcaneButton
- action="create"
- customLabel="Create Network"
- onClick={() => (networkPageStates.isCreateDialogOpen = true)}
- disabled={isLoading.create}
- />
+ <ArcaneButton action="create" customLabel="Create Network" onClick={() => (networkPageStates.isCreateDialogOpen = true)} disabled={isLoading.create} />
</div>
</div>
</Card.Header>
@@ -280,12 +247,7 @@
>
{#snippet rows({ item }: { item: NetworkInspectInfo })}
{@const isDefaultNetwork = DEFAULT_NETWORK_NAMES.has(item.Name)}
- <Table.Cell
- ><a
- class="font-medium hover:underline"
- href="/networks/{encodeURIComponent(item.Id)}/">{item.Name}</a
- ></Table.Cell
- >
+ <Table.Cell><a class="font-medium hover:underline" href="/networks/{encodeURIComponent(item.Id)}/">{item.Name}</a></Table.Cell>
<Table.Cell>{item.Driver}</Table.Cell>
<Table.Cell>{item.Scope}</Table.Cell>
<Table.Cell>{getNetworkSubnet(item)}</Table.Cell>
@@ -301,20 +263,13 @@
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end">
<DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/networks/${encodeURIComponent(item.Id)}`)}
- disabled={isAnyLoading}
- >
+ <DropdownMenu.Item onclick={() => goto(`/networks/${encodeURIComponent(item.Id)}`)} disabled={isAnyLoading}>
<ScanSearch class="size-4" />
Inspect
</DropdownMenu.Item>
{#if !isDefaultNetwork}
<DropdownMenu.Separator />
- <DropdownMenu.Item
- class="text-red-500 focus:text-red-700!"
- onclick={() => handleDeleteNetwork(item.Id, item.Name)}
- disabled={isLoading.remove || isAnyLoading}
- >
+ <DropdownMenu.Item class="text-red-500 focus:text-red-700!" onclick={() => handleDeleteNetwork(item.Id, item.Name)} disabled={isLoading.remove || isAnyLoading}>
{#if isLoading.remove && networkPageStates.selectedNetworks.includes(item.Id)}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -333,25 +288,14 @@
<div class="flex flex-col items-center justify-center px-6 py-12 text-center">
<Network class="text-muted-foreground mb-4 size-12 opacity-40" />
<p class="text-lg font-medium">No networks found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new network using the "Create Network" button above or use the Docker CLI
- </p>
+ <p class="text-muted-foreground mt-1 max-w-md text-sm">Create a new network using the "Create Network" button above or use the Docker CLI</p>
<div class="mt-4 flex gap-3">
- <ArcaneButton
- action="create"
- customLabel="Create Network"
- onClick={() => (networkPageStates.isCreateDialogOpen = true)}
- size="sm"
- />
+ <ArcaneButton action="create" customLabel="Create Network" onClick={() => (networkPageStates.isCreateDialogOpen = true)} size="sm" />
</div>
</div>
{/if}
</Card.Content>
</Card.Root>
- <CreateNetworkDialog
- bind:open={networkPageStates.isCreateDialogOpen}
- isCreating={isLoading.create}
- onSubmit={handleCreateNetworkSubmit}
- />
+ <CreateNetworkSheet bind:open={networkPageStates.isCreateDialogOpen} isLoading={isLoading.create} onSubmit={handleCreateNetworkSubmit} />
</div>
diff --git a/frontend/src/routes/networks/+page.ts b/frontend/src/routes/networks/+page.ts
index eabe4e2e7..1248535b9 100644
--- a/frontend/src/routes/networks/+page.ts
+++ b/frontend/src/routes/networks/+page.ts
@@ -15,8 +15,7 @@ export const load: PageLoad = async (): Promise<NetworkPageData> => {
};
} catch (err: unknown) {
console.error('Failed to load networks:', err);
- const message =
- err instanceof Error ? err.message : 'Failed to connect to Docker or list networks.';
+ const message = err instanceof Error ? err.message : 'Failed to connect to Docker or list networks.';
return {
networks: [],
error: message
diff --git a/frontend/src/routes/networks/CreateNetworkDialog.svelte b/frontend/src/routes/networks/CreateNetworkDialog.svelte
deleted file mode 100644
index 22df6b3d6..000000000
--- a/frontend/src/routes/networks/CreateNetworkDialog.svelte
+++ /dev/null
@@ -1,223 +0,0 @@
-<script lang="ts">
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import * as Select from '$lib/components/ui/select/index.js';
- import { Checkbox } from '$lib/components/ui/checkbox/index.js';
- import { X } from '@lucide/svelte';
- import type { NetworkCreateOptions } from 'dockerode';
- import { preventDefault } from '$lib/utils/form.utils';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
-
- type Props = {
- open: boolean;
- isCreating: boolean;
- onSubmit: (options: NetworkCreateOptions) => void;
- };
-
- let { open = $bindable(), isCreating = false, onSubmit }: Props = $props();
-
- let name = $state('');
- let driver = $state('bridge');
- let checkDuplicate = $state(true);
- let internal = $state(false);
- let labels = $state<{ key: string; value: string }[]>([{ key: '', value: '' }]);
- let enableIpam = $state(false);
- let subnet = $state('');
- let gateway = $state('');
-
- function addLabel() {
- labels = [...labels, { key: '', value: '' }];
- }
-
- function removeLabel(index: number) {
- labels = labels.filter((_, i) => i !== index);
- }
-
- function handleSubmit() {
- const finalLabels: Record<string, string> = {};
- labels.forEach((label) => {
- if (label.key.trim()) {
- finalLabels[label.key.trim()] = label.value.trim();
- }
- });
-
- const options: NetworkCreateOptions = {
- Name: name.trim(),
- Driver: driver,
- CheckDuplicate: checkDuplicate,
- Internal: internal,
- Labels: Object.keys(finalLabels).length > 0 ? finalLabels : undefined
- };
-
- if (enableIpam && (subnet.trim() || gateway.trim())) {
- const ipamConfig: { Subnet?: string; Gateway?: string } = {};
- const trimmedSubnet = subnet.trim();
- const trimmedGateway = gateway.trim();
-
- if (trimmedSubnet) {
- ipamConfig.Subnet = trimmedSubnet;
- }
- if (trimmedGateway) {
- ipamConfig.Gateway = trimmedGateway;
- }
-
- if (Object.keys(ipamConfig).length > 0) {
- options.IPAM = {
- Driver: 'default',
- Config: [ipamConfig]
- };
- }
- }
-
- onSubmit(options);
- }
-
- $effect(() => {
- if (!open) {
- name = '';
- driver = 'bridge';
- checkDuplicate = true;
- internal = false;
- labels = [{ key: '', value: '' }];
- enableIpam = false;
- subnet = '';
- gateway = '';
- }
- });
-</script>
-
-<Dialog.Root bind:open>
- <Dialog.Content class="sm:max-w-[600px]">
- <Dialog.Header>
- <Dialog.Title data-testid="create-network-dialog-header">Create Network</Dialog.Title>
- <Dialog.Description>Configure and create a new Docker network.</Dialog.Description>
- </Dialog.Header>
-
- <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="network-name" class="text-right">Name</Label>
- <Input
- id="network-name"
- bind:value={name}
- required
- class="col-span-3"
- placeholder="e.g., my-app-network"
- disabled={isCreating}
- />
- </div>
-
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="network-driver" class="text-right">Driver</Label>
- <Select.Root type="single" bind:value={driver}>
- <Select.Trigger class="col-span-3" id="network-driver" disabled={isCreating}>
- <span>{driver}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="bridge">bridge</Select.Item>
- <Select.Item value="overlay">overlay</Select.Item>
- <Select.Item value="macvlan">macvlan</Select.Item>
- <Select.Item value="ipvlan">ipvlan</Select.Item>
- <Select.Item value="none">none</Select.Item>
- </Select.Content>
- </Select.Root>
- </div>
-
- <div class="grid grid-cols-4 items-center gap-4">
- <span class="text-right text-sm font-medium">Options</span>
- <div class="col-span-3 flex items-center space-x-4">
- <div class="flex items-center space-x-2">
- <Checkbox id="check-duplicate" bind:checked={checkDuplicate} disabled={isCreating} />
- <Label for="check-duplicate" class="text-sm font-normal">Check Duplicate</Label>
- </div>
- <div class="flex items-center space-x-2">
- <Checkbox id="internal" bind:checked={internal} disabled={isCreating} />
- <Label for="internal" class="text-sm font-normal">Internal</Label>
- </div>
- </div>
- </div>
-
- <div class="grid grid-cols-4 items-start gap-4">
- <Label class="pt-2 text-right">Labels</Label>
- <div class="col-span-3 space-y-2">
- {#each labels as label, index (index)}
- <div class="flex items-center gap-2">
- <Input
- placeholder="Key"
- bind:value={label.key}
- class="flex-1"
- disabled={isCreating}
- />
- <Input
- placeholder="Value"
- bind:value={label.value}
- class="flex-1"
- disabled={isCreating}
- />
- <Button
- type="button"
- variant="ghost"
- size="icon"
- onclick={() => removeLabel(index)}
- disabled={isCreating || labels.length <= 1}
- class="text-destructive hover:text-destructive"
- title="Remove Label"
- >
- <X class="size-4" />
- </Button>
- </div>
- {/each}
- <ArcaneButton
- action="create"
- customLabel="Add Label"
- onClick={addLabel}
- disabled={isCreating}
- size="sm"
- />
- </div>
- </div>
-
- <div class="mt-2 grid grid-cols-4 items-start gap-4 border-t pt-4">
- <div class="col-span-4 flex items-center space-x-2">
- <Checkbox id="enable-ipam" bind:checked={enableIpam} disabled={isCreating} />
- <Label for="enable-ipam" class="text-sm font-medium">Enable IPAM Configuration</Label>
- </div>
- {#if enableIpam}
- <div class="col-span-4 grid grid-cols-4 items-center gap-4">
- <Label for="subnet" class="text-right">Subnet</Label>
- <Input
- id="subnet"
- bind:value={subnet}
- placeholder="e.g., 172.20.0.0/16"
- class="col-span-3"
- disabled={isCreating}
- />
- </div>
- <div class="col-span-4 grid grid-cols-4 items-center gap-4">
- <Label for="gateway" class="text-right">Gateway</Label>
- <Input
- id="gateway"
- bind:value={gateway}
- placeholder="e.g., 172.20.0.1"
- class="col-span-3"
- disabled={isCreating}
- />
- </div>
- {/if}
- </div>
-
- <Dialog.Footer>
- <ArcaneButton action="cancel" onClick={() => (open = false)} disabled={isCreating} />
- <ArcaneButton
- action="create"
- customLabel="Create Network"
- onClick={handleSubmit}
- loading={isCreating}
- loadingLabel="Creating..."
- disabled={isCreating || !name.trim()}
- />
- </Dialog.Footer>
- </form>
- </Dialog.Content>
-</Dialog.Root>
diff --git a/frontend/src/routes/networks/[networkId]/+page.svelte b/frontend/src/routes/networks/[networkId]/+page.svelte
index e4c7c42b2..dd355e7ab 100644
--- a/frontend/src/routes/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/networks/[networkId]/+page.svelte
@@ -1,19 +1,7 @@
<script lang="ts">
import type { PageData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
- import {
- AlertCircle,
- HardDrive,
- Clock,
- Tag,
- Layers,
- Hash,
- Network,
- Globe,
- Settings,
- ListTree,
- Container
- } from '@lucide/svelte';
+ import { AlertCircle, HardDrive, Clock, Tag, Layers, Hash, Network, Globe, Settings, ListTree, Container } from '@lucide/svelte';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
@@ -36,13 +24,9 @@
const shortId = $derived(network?.Id?.substring(0, 12) || 'N/A');
const createdDate = $derived(network?.Created ? formatDate(network.Created) : 'N/A');
- const connectedContainers = $derived(
- network?.Containers ? Object.values(network.Containers) : []
- );
+ const connectedContainers = $derived(network?.Containers ? Object.values(network.Containers) : []);
const inUse = $derived(connectedContainers.length > 0);
- const isPredefined = $derived(
- network?.Name === 'bridge' || network?.Name === 'host' || network?.Name === 'none'
- );
+ const isPredefined = $derived(network?.Name === 'bridge' || network?.Name === 'host' || network?.Name === 'none');
function triggerRemove() {
if (isPredefined) {
@@ -124,14 +108,7 @@
</div>
<div class="self-start">
- <ArcaneButton
- action="remove"
- customLabel="Remove Network"
- onClick={triggerRemove}
- loading={isRemoving}
- disabled={isRemoving || isPredefined}
- label={isPredefined ? 'Cannot remove predefined networks' : 'Delete Network'}
- />
+ <ArcaneButton action="remove" customLabel="Remove Network" onClick={triggerRemove} loading={isRemoving} disabled={isRemoving || isPredefined} label={isPredefined ? 'Cannot remove predefined networks' : 'Delete Network'} />
</div>
</div>
</div>
@@ -157,9 +134,7 @@
<Card.Content class="pt-6">
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-2 lg:grid-cols-3">
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
<Hash class="size-5 text-gray-500" />
</div>
<div class="min-w-0 flex-1">
@@ -169,9 +144,7 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
<Network class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
@@ -181,9 +154,7 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2">
<HardDrive class="size-5 text-orange-500" />
</div>
<div class="min-w-0 flex-1">
@@ -193,9 +164,7 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
<Globe class="size-5 text-purple-500" />
</div>
<div class="min-w-0 flex-1">
@@ -205,9 +174,7 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
<Clock class="size-5 text-green-500" />
</div>
<div class="min-w-0 flex-1">
@@ -217,52 +184,37 @@
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-yellow-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-yellow-500/10 p-2">
<Layers class="size-5 text-yellow-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Attachable</p>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.Attachable ? 'green' : 'gray'}
- text={network.Attachable ? 'Yes' : 'No'}
- />
+ <StatusBadge variant={network.Attachable ? 'green' : 'gray'} text={network.Attachable ? 'Yes' : 'No'} />
</p>
</div>
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-red-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-red-500/10 p-2">
<Settings class="size-5 text-red-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">Internal</p>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.Internal ? 'blue' : 'gray'}
- text={network.Internal ? 'Yes' : 'No'}
- />
+ <StatusBadge variant={network.Internal ? 'blue' : 'gray'} text={network.Internal ? 'Yes' : 'No'} />
</p>
</div>
</div>
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
<ListTree class="size-5 text-indigo-500" />
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">IPv6 Enabled</p>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.EnableIPv6 ? 'indigo' : 'gray'}
- text={network.EnableIPv6 ? 'Yes' : 'No'}
- />
+ <StatusBadge variant={network.EnableIPv6 ? 'indigo' : 'gray'} text={network.EnableIPv6 ? 'Yes' : 'No'} />
</p>
</div>
</div>
@@ -285,12 +237,8 @@
<div class="space-y-2">
{#if config.Subnet}
<div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >Subnet:</span
- >
- <code
- class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm"
- >
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24">Subnet:</span>
+ <code class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm">
{config.Subnet}
</code>
</div>
@@ -298,12 +246,8 @@
{#if config.Gateway}
<div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >Gateway:</span
- >
- <code
- class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm"
- >
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24">Gateway:</span>
+ <code class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm">
{config.Gateway}
</code>
</div>
@@ -311,12 +255,8 @@
{#if config.IPRange}
<div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >IP Range:</span
- >
- <code
- class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm"
- >
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24">IP Range:</span>
+ <code class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm">
{config.IPRange}
</code>
</div>
@@ -324,16 +264,12 @@
{#if config.AuxiliaryAddresses && Object.keys(config.AuxiliaryAddresses).length > 0}
<div class="mt-3">
- <p class="text-muted-foreground mb-1 text-sm font-medium">
- Auxiliary Addresses:
- </p>
+ <p class="text-muted-foreground mb-1 text-sm font-medium">Auxiliary Addresses:</p>
<ul class="ml-4 space-y-1">
{#each Object.entries(config.AuxiliaryAddresses) as [name, addr] (name)}
<li class="flex font-mono text-xs">
<span class="text-muted-foreground mr-2">{name}:</span>
- <code class="bg-muted text-muted-foreground rounded px-1 py-0.5"
- >{addr}</code
- >
+ <code class="bg-muted text-muted-foreground rounded px-1 py-0.5">{addr}</code>
</li>
{/each}
</ul>
@@ -375,8 +311,7 @@
Connected Containers
</Card.Title>
<Card.Description>
- {connectedContainers.length} container{connectedContainers.length === 1 ? '' : 's'} connected
- to this network
+ {connectedContainers.length} container{connectedContainers.length === 1 ? '' : 's'} connected to this network
</Card.Description>
</Card.Header>
<Card.Content class="pt-6">
@@ -384,18 +319,13 @@
{#each connectedContainers as container (container.Name)}
<div class="flex flex-col p-3 sm:flex-row sm:items-center">
<div class="mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
- <a
- href="/containers/{container.Name}"
- class="text-primary flex items-center hover:underline"
- >
+ <a href="/containers/{container.Name}" class="text-primary flex items-center hover:underline">
<Container class="text-muted-foreground mr-1.5 size-3.5" />
{container.Name}
</a>
</div>
<div class="w-full pl-0 sm:w-2/3 sm:pl-4">
- <code
- class="bg-muted text-muted-foreground rounded px-1.5 py-0.5 font-mono text-xs break-all sm:text-sm"
- >
+ <code class="bg-muted text-muted-foreground rounded px-1.5 py-0.5 font-mono text-xs break-all sm:text-sm">
{container.IPv4Address || container.IPv6Address || 'N/A'}
</code>
</div>
@@ -419,14 +349,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(network.Labels) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -449,14 +375,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(network.Options) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -472,15 +394,8 @@
<Network class="text-muted-foreground size-10 opacity-70" />
</div>
<h2 class="mb-2 text-xl font-medium">Network Not Found</h2>
- <p class="text-muted-foreground mb-6">
- The requested network could not be found or is no longer available.
- </p>
- <ArcaneButton
- action="cancel"
- customLabel="Back to Networks"
- onClick={() => goto('/networks')}
- size="sm"
- />
+ <p class="text-muted-foreground mb-6">The requested network could not be found or is no longer available.</p>
+ <ArcaneButton action="cancel" customLabel="Back to Networks" onClick={() => goto('/networks')} size="sm" />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/onboarding/+layout.svelte b/frontend/src/routes/onboarding/+layout.svelte
index 6187b43c0..8277cd720 100644
--- a/frontend/src/routes/onboarding/+layout.svelte
+++ b/frontend/src/routes/onboarding/+layout.svelte
@@ -30,15 +30,10 @@
<div class="mb-8 flex items-center justify-between">
{#each steps as step, i (step.id)}
<div class="flex flex-col items-center">
- <div
- class={`flex size-10 items-center justify-center rounded-full ${i <= currentStep ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}
- >
+ <div class={`flex size-10 items-center justify-center rounded-full ${i <= currentStep ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}>
<step.icon class="size-5" />
</div>
- <span
- class={`mt-2 text-sm ${i <= currentStep ? 'text-foreground' : 'text-muted-foreground'}`}
- >{step.label}</span
- >
+ <span class={`mt-2 text-sm ${i <= currentStep ? 'text-foreground' : 'text-muted-foreground'}`}>{step.label}</span>
</div>
{#if i < steps.length - 1}
diff --git a/frontend/src/routes/onboarding/complete/+page.svelte b/frontend/src/routes/onboarding/complete/+page.svelte
index 4aa51fc33..bf479a028 100644
--- a/frontend/src/routes/onboarding/complete/+page.svelte
+++ b/frontend/src/routes/onboarding/complete/+page.svelte
@@ -15,9 +15,7 @@
<div class="prose dark:prose-invert mx-auto mb-8 max-w-xl">
<p>Congratulations! You've successfully completed the initial setup for Arcane.</p>
- <p>
- You can now start using the application to manage your Docker containers and compose stacks.
- </p>
+ <p>You can now start using the application to manage your Docker containers and compose stacks.</p>
</div>
<Button onclick={() => goto('/', { invalidateAll: true })} size="lg">Go to Dashboard</Button>
diff --git a/frontend/src/routes/onboarding/password/+page.svelte b/frontend/src/routes/onboarding/password/+page.svelte
index 45d524047..526962f52 100644
--- a/frontend/src/routes/onboarding/password/+page.svelte
+++ b/frontend/src/routes/onboarding/password/+page.svelte
@@ -79,9 +79,7 @@
<h1 class="mb-8 text-center text-3xl font-bold">Change Admin Password</h1>
<div class="mb-8 space-y-2">
- <p class="text-md text-center">
- For security reasons, please change the default admin password.
- </p>
+ <p class="text-md text-center">For security reasons, please change the default admin password.</p>
</div>
{#if error}
@@ -96,35 +94,19 @@
<div class="space-y-6">
<div class="space-y-4">
<Label for="password" class="mb-2 block text-base">New Password</Label>
- <Input
- id="password"
- type="password"
- bind:value={password}
- placeholder="Enter new password"
- class="bg-muted/10 h-12 px-4"
- required
- />
+ <Input id="password" type="password" bind:value={password} placeholder="Enter new password" class="bg-muted/10 h-12 px-4" required />
</div>
<div class="space-y-4">
<Label for="confirmPassword" class="mb-2 block text-base">Confirm Password</Label>
- <Input
- id="confirmPassword"
- type="password"
- bind:value={confirmPassword}
- placeholder="Confirm new password"
- class="bg-muted/10 h-12 px-4"
- required
- />
+ <Input id="confirmPassword" type="password" bind:value={confirmPassword} placeholder="Confirm new password" class="bg-muted/10 h-12 px-4" required />
</div>
</div>
<div class="flex justify-center pt-8">
<Button type="submit" disabled={loading} class="flex h-12 w-[80%] items-center px-8">
{#if loading}
- <span
- class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"
- ></span>
+ <span class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"></span>
{/if}
Continue
<ChevronRight class="size-4" />
diff --git a/frontend/src/routes/onboarding/settings/+page.svelte b/frontend/src/routes/onboarding/settings/+page.svelte
index 975f2d7e3..b616d5a06 100644
--- a/frontend/src/routes/onboarding/settings/+page.svelte
+++ b/frontend/src/routes/onboarding/settings/+page.svelte
@@ -56,9 +56,7 @@
<div class="mx-auto max-w-2xl">
<h1 class="mb-4 text-3xl font-bold">Initial Setup</h1>
- <p class="text-muted-foreground mb-6">
- Configure basic settings for Arcane. You can change these later from the Settings page.
- </p>
+ <p class="text-muted-foreground mb-6">Configure basic settings for Arcane. You can change these later from the Settings page.</p>
{#if error}
<Alert.Root class="mb-6" variant="destructive">
@@ -77,16 +75,9 @@
<Card.Content class="pt-0 pb-4">
<div class="space-y-3">
<Label for="dockerHost" class="mb-2 block text-base">Docker Host</Label>
- <Input
- id="dockerHost"
- bind:value={dockerHost}
- placeholder="unix:///var/run/docker.sock"
- class="bg-muted/10 h-12 px-4"
- />
+ <Input id="dockerHost" bind:value={dockerHost} placeholder="unix:///var/run/docker.sock" class="bg-muted/10 h-12 px-4" />
<p class="text-muted-foreground text-xs">
- Examples: Unix: <code class="bg-muted/30 rounded px-1 py-0.5"
- >unix:///var/run/docker.sock</code
- >
+ Examples: Unix: <code class="bg-muted/30 rounded px-1 py-0.5">unix:///var/run/docker.sock</code>
</p>
</div>
</Card.Content>
@@ -103,26 +94,13 @@
<Label for="pollingSwitch" class="font-medium">Container Status Polling</Label>
<p class="text-muted-foreground text-sm">Periodically check container status</p>
</div>
- <Switch
- id="pollingSwitch"
- checked={pollingEnabled}
- onCheckedChange={(checked) => (pollingEnabled = checked)}
- />
+ <Switch id="pollingSwitch" checked={pollingEnabled} onCheckedChange={(checked) => (pollingEnabled = checked)} />
</div>
{#if pollingEnabled}
<div class="px-4">
- <Label for="pollingInterval" class="mb-2 block text-base"
- >Polling Interval (minutes)</Label
- >
- <Input
- id="pollingInterval"
- type="number"
- bind:value={pollingInterval}
- min="5"
- max="60"
- class="bg-muted/10 h-12 px-4"
- />
+ <Label for="pollingInterval" class="mb-2 block text-base">Polling Interval (minutes)</Label>
+ <Input id="pollingInterval" type="number" bind:value={pollingInterval} min="5" max="60" class="bg-muted/10 h-12 px-4" />
<p class="text-muted-foreground mt-1 text-xs">Set between 5-60 minutes.</p>
</div>
{/if}
@@ -130,15 +108,9 @@
<div class="flex items-center justify-between rounded-lg border p-4">
<div>
<Label for="autoUpdateSwitch" class="font-medium">Auto Update Containers</Label>
- <p class="text-muted-foreground text-sm">
- Update containers when newer images are available
- </p>
+ <p class="text-muted-foreground text-sm">Update containers when newer images are available</p>
</div>
- <Switch
- id="autoUpdateSwitch"
- checked={autoUpdate}
- onCheckedChange={(checked) => (autoUpdate = checked)}
- />
+ <Switch id="autoUpdateSwitch" checked={autoUpdate} onCheckedChange={(checked) => (autoUpdate = checked)} />
</div>
</Card.Content>
</Card.Root>
@@ -146,9 +118,7 @@
<div class="flex justify-center pt-4">
<Button type="submit" disabled={loading} class="flex h-12 w-[80%] items-center gap-2 px-8">
{#if loading}
- <span
- class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"
- ></span>
+ <span class="inline-block size-4 animate-spin rounded-full border-2 border-white border-t-transparent"></span>
{/if}
Continue
<ChevronRight class="size-4" />
diff --git a/frontend/src/routes/onboarding/welcome/+page.svelte b/frontend/src/routes/onboarding/welcome/+page.svelte
index cfc5f8a0a..63643b6eb 100644
--- a/frontend/src/routes/onboarding/welcome/+page.svelte
+++ b/frontend/src/routes/onboarding/welcome/+page.svelte
@@ -36,9 +36,7 @@
<h1 class="mb-6 text-3xl font-bold">Welcome to Arcane</h1>
<div class="mb-8 space-y-6">
- <p class="text-xl">
- Thank you for installing Arcane! Let's get you set up with a few quick steps.
- </p>
+ <p class="text-xl">Thank you for installing Arcane! Let's get you set up with a few quick steps.</p>
<div class="space-y-4">
<p class="text-lg font-medium">This wizard will help you:</p>
@@ -71,11 +69,7 @@
</div>
<div class="flex justify-center pt-8">
- <Button
- type="button"
- onclick={() => continueToNextStep()}
- class="flex h-12 w-[80%] items-center gap-2 px-8"
- >
+ <Button type="button" onclick={() => continueToNextStep()} class="flex h-12 w-[80%] items-center gap-2 px-8">
Continue
<ChevronRight class="size-4" />
</Button>
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 24e9aed2d..7b4d58a62 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -87,15 +87,9 @@
autoUpdateIntervalInput.value = currentSettings.autoUpdateInterval;
});
- let isPollingConfigValid = $derived(
- !pollingEnabledSwitch.value ||
- (pollingIntervalInput.value >= 5 && pollingIntervalInput.value <= 1440)
- );
+ let isPollingConfigValid = $derived(!pollingEnabledSwitch.value || (pollingIntervalInput.value >= 5 && pollingIntervalInput.value <= 1440));
- let isAutoUpdateConfigValid = $derived(
- !autoUpdateSwitch.value ||
- (autoUpdateIntervalInput.value >= 5 && autoUpdateIntervalInput.value <= 1440)
- );
+ let isAutoUpdateConfigValid = $derived(!autoUpdateSwitch.value || (autoUpdateIntervalInput.value >= 5 && autoUpdateIntervalInput.value <= 1440));
let canSave = $derived(isPollingConfigValid && isAutoUpdateConfigValid);
</script>
@@ -109,17 +103,11 @@
<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>
+ <p class="settings-description">Configure Docker automation behavior and container management settings</p>
</div>
<div class="settings-actions">
- <Button
- onclick={() => handleDockerSettingUpdates()}
- disabled={isLoading.saving || !canSave}
- class="arcane-button-save"
- >
+ <Button onclick={() => handleDockerSettingUpdates()} disabled={isLoading.saving || !canSave} class="arcane-button-save">
{#if isLoading.saving}
<RefreshCw class="size-4 animate-spin" />
Saving...
@@ -137,9 +125,7 @@
<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.Description>Automatic container updates are active with polling enabled</Alert.Description>
</Alert.Root>
</div>
{/if}
@@ -160,63 +146,29 @@
</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 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">
- <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)"
- />
+ <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">
<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.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={autoUpdateSwitch}
- type="switch"
- id="autoUpdateSwitch"
- label="Auto-update Containers"
- description="Automatically update containers when newer images are found"
- />
+ <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={autoUpdateSwitch} type="switch" id="autoUpdateSwitch" label="Auto-update Containers" description="Automatically update containers when newer images are found" />
</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)"
- />
+ <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>
@@ -267,32 +219,22 @@
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"
- >
+ <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
- >)
+ 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"
- >
+ <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>
+ <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
- >)
+ 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>
@@ -300,11 +242,8 @@
<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.'}
+ <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>
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index adde745ff..82a92c8e7 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -81,16 +81,10 @@
<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 and manages your containers
- </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="h-10 min-w-[120px]"
- >
+ <Button onclick={() => handleGeneralSettingUpdates()} disabled={isLoading.saving} class="h-10 min-w-[120px]">
{#if isLoading.saving}
<RefreshCw class="size-4 animate-spin" />
Saving...
@@ -117,12 +111,7 @@
</div>
</Card.Header>
<Card.Content>
- <FormInput
- label="Stacks Directory"
- placeholder="data/stacks"
- bind:input={stacksDirectoryInput}
- helpText="Directory where Docker Compose stack files are stored"
- />
+ <FormInput label="Stacks Directory" placeholder="data/stacks" bind:input={stacksDirectoryInput} helpText="Directory where Docker Compose stack files are stored" />
</Card.Content>
</Card.Root>
@@ -140,12 +129,7 @@
</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)"
- />
+ <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>
@@ -163,13 +147,7 @@
</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"
- />
+ <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>
diff --git a/frontend/src/routes/settings/rbac/+page.svelte b/frontend/src/routes/settings/rbac/+page.svelte
index 847157a66..1d093fd50 100644
--- a/frontend/src/routes/settings/rbac/+page.svelte
+++ b/frontend/src/routes/settings/rbac/+page.svelte
@@ -18,27 +18,13 @@
id: 1,
name: 'Admin',
description: 'Full system access',
- permissions: [
- 'containers:manage',
- 'stacks:manage',
- 'volumes:manage',
- 'networks:manage',
- 'settings:manage',
- 'users:manage'
- ]
+ permissions: ['containers:manage', 'stacks:manage', 'volumes:manage', 'networks:manage', 'settings:manage', 'users:manage']
},
{
id: 2,
name: 'User',
description: 'Container and stack operations',
- permissions: [
- 'containers:view',
- 'containers:manage',
- 'stacks:view',
- 'stacks:manage',
- 'volumes:view',
- 'networks:view'
- ]
+ permissions: ['containers:view', 'containers:manage', 'stacks:view', 'stacks:manage', 'volumes:view', 'networks:view']
},
{
id: 3,
@@ -104,19 +90,10 @@
<div class="mb-6">
<div class="bg-muted/30 flex items-center justify-between rounded-lg border p-4">
<div class="space-y-0.5">
- <label for="rbacEnabledSwitch" class="text-base font-medium"
- >Enable Role-Based Access Control</label
- >
- <p class="text-muted-foreground text-sm">
- Control user permissions with customizable roles
- </p>
+ <label for="rbacEnabledSwitch" class="text-base font-medium">Enable Role-Based Access Control</label>
+ <p class="text-muted-foreground text-sm">Control user permissions with customizable roles</p>
</div>
- <Switch
- id="rbacEnabledSwitch"
- name="rbacEnabled"
- checked={$settingsStore.auth?.rbacEnabled}
- onCheckedChange={() => {}}
- />
+ <Switch id="rbacEnabledSwitch" name="rbacEnabled" checked={$settingsStore.auth?.rbacEnabled} onCheckedChange={() => {}} />
</div>
</div>
@@ -139,20 +116,10 @@
<Card.Content>
<div class="space-y-2">
{#each roles as role (role.id)}
- <button
- class="flex w-full items-center justify-between rounded-md border p-3 text-left transition-colors {selectedRole.id ===
- role.id
- ? 'bg-primary text-primary-foreground border-primary'
- : 'hover:bg-muted/50'}"
- onclick={() => (selectedRole = role)}
- >
+ <button class="flex w-full items-center justify-between rounded-md border p-3 text-left transition-colors {selectedRole.id === role.id ? 'bg-primary text-primary-foreground border-primary' : 'hover:bg-muted/50'}" onclick={() => (selectedRole = role)}>
<div>
<div class="font-medium">{role.name}</div>
- <div
- class="text-xs {selectedRole.id === role.id
- ? 'text-primary-foreground/90'
- : 'text-muted-foreground'}"
- >
+ <div class="text-xs {selectedRole.id === role.id ? 'text-primary-foreground/90' : 'text-muted-foreground'}">
{role.description}
</div>
</div>
@@ -189,21 +156,11 @@
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div class="space-y-2">
<label for="roleName" class="text-sm font-medium">Role Name</label>
- <Input
- id="roleName"
- name="roleName"
- value={selectedRole.name}
- placeholder="Enter role name"
- />
+ <Input id="roleName" name="roleName" value={selectedRole.name} placeholder="Enter role name" />
</div>
<div class="space-y-2">
<label for="roleDescription" class="text-sm font-medium">Description</label>
- <Input
- id="roleDescription"
- name="roleDescription"
- value={selectedRole.description}
- placeholder="Brief description"
- />
+ <Input id="roleDescription" name="roleDescription" value={selectedRole.description} placeholder="Brief description" />
</div>
</div>
@@ -217,11 +174,7 @@
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
{#each category.permissions as permission (permission)}
<label class="flex items-center space-x-2 text-sm">
- <input
- type="checkbox"
- class="text-primary focus:ring-primary rounded border-gray-300"
- checked={selectedRole.permissions.includes(permission)}
- />
+ <input type="checkbox" class="text-primary focus:ring-primary rounded border-gray-300" checked={selectedRole.permissions.includes(permission)} />
<span>{permission.split(':')[1]}</span>
</label>
{/each}
diff --git a/frontend/src/routes/settings/rbac/+page.ts b/frontend/src/routes/settings/rbac/+page.ts
index 600c3d565..5b0721811 100644
--- a/frontend/src/routes/settings/rbac/+page.ts
+++ b/frontend/src/routes/settings/rbac/+page.ts
@@ -3,11 +3,7 @@ import { settingsAPI, userAPI } from '$lib/services/api';
export const load: PageLoad = async () => {
try {
- const [settings, users, roles] = await Promise.all([
- settingsAPI.getSettings(),
- userAPI.list().catch(() => []),
- userAPI.getRoles().catch(() => [])
- ]);
+ const [settings, users, roles] = await Promise.all([settingsAPI.getSettings(), userAPI.list().catch(() => []), userAPI.getRoles().catch(() => [])]);
return {
settings,
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index 26aa812e0..26709531c 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -91,8 +91,7 @@
// Update OIDC form
oidcConfigForm.clientId = currentSettings.auth?.oidc?.clientId || '';
- oidcConfigForm.redirectUri =
- currentSettings.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback';
+ 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 || '';
@@ -112,10 +111,8 @@
if (!isOidcViewMode) {
oidcConfigForm.clientId = currentSettings.auth?.oidc?.clientId || '';
oidcConfigForm.clientSecret = '';
- oidcConfigForm.redirectUri =
- currentSettings.auth?.oidc?.redirectUri || 'http://localhost:3000/auth/oidc/callback';
- oidcConfigForm.authorizationEndpoint =
- currentSettings.auth?.oidc?.authorizationEndpoint || '';
+ 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';
@@ -146,17 +143,11 @@
<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>
+ <p class="settings-description">Configure authentication methods, session policies, and security settings</p>
</div>
<div class="settings-actions">
- <Button
- onclick={() => handleSecuritySettingUpdates()}
- disabled={isLoading.saving}
- class="arcane-button-save"
- >
+ <Button onclick={() => handleSecuritySettingUpdates()} disabled={isLoading.saving} class="arcane-button-save">
{#if isLoading.saving}
<RefreshCw class="size-4 animate-spin" />
Saving...
@@ -179,9 +170,7 @@
</div>
<div>
<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>
+ <Card.Description class="settings-card-description">Configure how users sign in to Arcane</Card.Description>
</div>
</div>
</Card.Header>
@@ -189,15 +178,9 @@
<div class="space-y-4">
<div class="bg-muted/30 flex items-center justify-between rounded-lg border p-4">
<div class="space-y-0.5">
- <label for="localAuthSwitch" class="text-base font-medium">Local Authentication</label
- >
- <p class="text-muted-foreground text-sm">
- Username and password stored in the system
- </p>
- <p class="text-muted-foreground mt-1 text-xs">
- This is recommended to be enabled as a fallback option if OIDC authentication is
- unavailable.
- </p>
+ <label for="localAuthSwitch" class="text-base font-medium">Local Authentication</label>
+ <p class="text-muted-foreground text-sm">Username and password stored in the system</p>
+ <p class="text-muted-foreground mt-1 text-xs">This is recommended to be enabled as a fallback option if OIDC authentication is unavailable.</p>
</div>
<Switch
id="localAuthSwitch"
@@ -213,66 +196,39 @@
<p class="text-muted-foreground text-sm">
Use an External OIDC Provider
{#if 'envForced' in data.oidcStatus && data.oidcStatus.envForced}
- <span class="text-muted-foreground text-xs"
- >(Forced ON by server environment)</span
- >
+ <span class="text-muted-foreground text-xs">(Forced ON by server environment)</span>
{/if}
</p>
{#if 'envForced' in data.oidcStatus && (data.oidcStatus.effectivelyEnabled || data.oidcStatus.envForced)}
{#if data.oidcStatus.envForced && !data.oidcStatus.envConfigured}
- <Button
- variant="link"
- class="text-destructive h-auto p-0 text-xs hover:underline"
- onclick={openOidcDialog}
- >
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
<AlertTriangle 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}
- >
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
<Info 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}
- >
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
<Info 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}
- >
+ <Button variant="link" class="text-destructive h-auto p-0 text-xs hover:underline" onclick={openOidcDialog}>
<AlertTriangle class="mr-1 size-3" />
OIDC enabled, but app settings incomplete. Configure.
</Button>
{/if}
{:else if 'enabled' in data.oidcStatus && data.oidcStatus.enabled}
- <Button
- variant="link"
- class="h-auto p-0 text-xs text-sky-600 hover:underline"
- onclick={openOidcDialog}
- >
+ <Button variant="link" class="h-auto p-0 text-xs text-sky-600 hover:underline" onclick={openOidcDialog}>
<Info class="mr-1 size-3" />
OIDC enabled (legacy mode). Manage.
</Button>
{/if}
</div>
- <Switch
- id="oidcAuthSwitch"
- checked={oidcEnabled}
- disabled={'envForced' in data.oidcStatus && data.oidcStatus.envForced}
- onCheckedChange={handleOidcSwitchChange}
- />
+ <Switch id="oidcAuthSwitch" checked={oidcEnabled} disabled={'envForced' in data.oidcStatus && data.oidcStatus.envForced} onCheckedChange={handleOidcSwitchChange} />
</div>
</div>
</Card.Content>
@@ -284,27 +240,18 @@
<Dialog.Header>
<Dialog.Title>
{#if isOidcViewMode}OIDC Server Configuration Status
- {:else if data.oidcStatus.envForced && !data.oidcStatus.envConfigured}Configure OIDC
- (Server Override Warning)
+ {:else if data.oidcStatus.envForced && !data.oidcStatus.envConfigured}Configure OIDC (Server Override Warning)
{:else}Configure OIDC Provider{/if}
</Dialog.Title>
<Dialog.Description>
{#if isOidcViewMode}
- OIDC authentication is configured and forced ON by server-side environment variables.
- These settings are read-only.
- <p class="mt-2">
- The following OIDC settings are loaded from the server environment:
- </p>
+ OIDC authentication is configured and forced ON by server-side environment variables. These settings are read-only.
+ <p class="mt-2">The following OIDC settings are loaded from the server environment:</p>
{:else if data.oidcStatus.envForced && !data.oidcStatus.envConfigured}
- OIDC usage is forced ON by the server environment (<code
- >PUBLIC_OIDC_ENABLED=true</code
- >), but critical server-side OIDC environment variables appear to be missing or
- incomplete. The settings below are from your application database. While you can save
- them here, 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.
+ OIDC usage is forced ON by the server environment (<code>PUBLIC_OIDC_ENABLED=true</code>), but critical server-side OIDC environment variables appear to be missing or incomplete. The settings below are from your application database. While you can save them here, 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.
{:else}
- Configure the OIDC settings for your application. These settings will be saved to the
- database and used for OIDC authentication.
+ Configure the OIDC settings for your application. These settings will be saved to the database and used for OIDC authentication.
{/if}
</Dialog.Description>
</Dialog.Header>
@@ -331,82 +278,42 @@
<li><strong>Scopes:</strong> {currentSettings.auth.oidc.scopes}</li>
{:else}
<li>
- <span class="text-destructive"
- >OIDC configuration details not found in effective settings.</span
- >
+ <span class="text-destructive">OIDC configuration details not found in effective settings.</span>
</li>
{/if}
</ul>
- <p class="text-muted-foreground mt-3 text-xs">
- Changes to these settings must be made in your server's environment configuration.
- </p>
+ <p class="text-muted-foreground mt-3 text-xs">Changes to these settings must be made in your server's environment configuration.</p>
</div>
{:else}
<!-- Form for setup/configuration -->
<div class="grid max-h-[50vh] gap-4 overflow-y-auto py-4 pr-2">
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcClientId" class="col-span-1 text-right">Client ID</Label>
- <Input
- id="oidcClientId"
- bind:value={oidcConfigForm.clientId}
- class="col-span-3"
- placeholder="Provided by your OIDC Provider"
- />
+ <Input id="oidcClientId" bind:value={oidcConfigForm.clientId} class="col-span-3" placeholder="Provided by your OIDC Provider" />
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcClientSecret" class="col-span-1 text-right">Client Secret</Label>
- <Input
- id="oidcClientSecret"
- type="password"
- bind:value={oidcConfigForm.clientSecret}
- class="col-span-3"
- placeholder="Provided by your OIDC Provider (leave blank to keep existing if any)"
- />
+ <Input id="oidcClientSecret" type="password" bind:value={oidcConfigForm.clientSecret} class="col-span-3" placeholder="Provided by your OIDC Provider (leave blank to keep existing if any)" />
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcRedirectUri" class="col-span-1 text-right">Redirect URI</Label>
- <Input
- id="oidcRedirectUri"
- bind:value={oidcConfigForm.redirectUri}
- placeholder="e.g., http://localhost:3000/auth/oidc/callback"
- class="col-span-3"
- />
+ <Input id="oidcRedirectUri" bind:value={oidcConfigForm.redirectUri} placeholder="e.g., http://localhost:3000/auth/oidc/callback" class="col-span-3" />
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcAuthEndpoint" class="col-span-1 text-right">Authorization URL</Label>
- <Input
- id="oidcAuthEndpoint"
- bind:value={oidcConfigForm.authorizationEndpoint}
- class="col-span-3"
- placeholder="OIDC Provider's Authorization Endpoint"
- />
+ <Input id="oidcAuthEndpoint" bind:value={oidcConfigForm.authorizationEndpoint} class="col-span-3" placeholder="OIDC Provider's Authorization Endpoint" />
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcTokenEndpoint" class="col-span-1 text-right">Token URL</Label>
- <Input
- id="oidcTokenEndpoint"
- bind:value={oidcConfigForm.tokenEndpoint}
- class="col-span-3"
- placeholder="OIDC Provider's Token Endpoint"
- />
+ <Input id="oidcTokenEndpoint" bind:value={oidcConfigForm.tokenEndpoint} class="col-span-3" placeholder="OIDC Provider's Token Endpoint" />
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcUserinfoEndpoint" class="col-span-1 text-right">User Info URL</Label>
- <Input
- id="oidcUserinfoEndpoint"
- bind:value={oidcConfigForm.userinfoEndpoint}
- class="col-span-3"
- placeholder="OIDC Provider's UserInfo Endpoint"
- />
+ <Input id="oidcUserinfoEndpoint" bind:value={oidcConfigForm.userinfoEndpoint} class="col-span-3" placeholder="OIDC Provider's UserInfo Endpoint" />
</div>
<div class="grid grid-cols-4 items-center gap-4">
<Label for="oidcScopes" class="col-span-1 text-right">Scopes</Label>
- <Input
- id="oidcScopes"
- bind:value={oidcConfigForm.scopes}
- placeholder="e.g., openid email profile"
- class="col-span-3"
- />
+ <Input id="oidcScopes" bind:value={oidcConfigForm.scopes} placeholder="e.g., openid email profile" class="col-span-3" />
</div>
</div>
{/if}
@@ -429,28 +336,16 @@
</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>
+ <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>
+ <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>
<div class="space-y-2">
@@ -458,27 +353,21 @@
<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'}
+ 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'}
+ 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'}
+ class={passwordPolicy === 'strong' ? 'arcane-button-create w-full' : 'arcane-button-restart w-full'}
onclick={() => {
passwordPolicy = 'strong';
}}>Strong</Button
diff --git a/frontend/src/routes/settings/users/+page.svelte b/frontend/src/routes/settings/users/+page.svelte
index 400a8fa19..f0c7889cc 100644
--- a/frontend/src/routes/settings/users/+page.svelte
+++ b/frontend/src/routes/settings/users/+page.svelte
@@ -6,20 +6,18 @@
import type { PageData } from './$types';
import UniversalTable from '$lib/components/universal-table.svelte';
import type { User } from '$lib/types/user.type';
- import UserFormDialog from '$lib/components/dialogs/user-form-dialog.svelte';
+ import UserFormSheet from '$lib/components/sheets/user-form-sheet.svelte';
import * as Table from '$lib/components/ui/table';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
- import UserAPIService from '$lib/services/api/user-api-service';
+ import { userAPI } from '$lib/services/api';
import { invalidateAll } from '$app/navigation';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
let { data }: { data: PageData } = $props();
- const userApi = new UserAPIService();
-
let userPageStates = $state({
users: <User[]>data.users,
isUserDialogOpen: false,
@@ -30,7 +28,7 @@
saving: false
});
- let userDialogRef: UserFormDialog | null = $state(null);
+ let userDialogRef: UserFormSheet | null = $state(null);
$effect(() => {
userPageStates.users = data.users;
@@ -52,23 +50,11 @@
userPageStates.isUserDialogOpen = true;
}
- async function handleDialogSubmit({
- user: userData,
- isEditMode,
- userId
- }: {
- user: Partial<User> & { password?: string };
- isEditMode: boolean;
- userId?: string;
- }) {
+ async function handleDialogSubmit({ user: userData, isEditMode, userId }: { user: Partial<User> & { password?: string }; isEditMode: boolean; userId?: string }) {
isLoading.saving = true;
handleApiResultWithCallbacks({
- result: await tryCatch(
- isEditMode
- ? userApi.update(userId || '', userData as User)
- : userApi.create(userData as User)
- ),
+ result: await tryCatch(isEditMode ? userAPI.update(userId || '', userData as User) : userAPI.create(userData as User)),
message: isEditMode ? 'Error Updating User' : 'Error Creating User',
setLoadingState: (value) => (isLoading.saving = value),
onSuccess: async () => {
@@ -89,7 +75,7 @@
destructive: true,
action: async () => {
handleApiResultWithCallbacks({
- result: await tryCatch(userApi.delete(userId)),
+ result: await tryCatch(userAPI.delete(userId)),
message: 'Failed to Delete User',
setLoadingState: (value) => (isLoading.saving = value),
onSuccess: async () => {
@@ -107,15 +93,7 @@
<title>User Management - Arcane</title>
</svelte:head>
-<UserFormDialog
- bind:open={userPageStates.isUserDialogOpen}
- bind:userToEdit={userPageStates.userToEdit}
- {roles}
- onSubmit={handleDialogSubmit}
- bind:this={userDialogRef}
- isLoading={isLoading.saving}
- allowUsernameEdit={true}
-/>
+<UserFormSheet bind:open={userPageStates.isUserDialogOpen} bind:userToEdit={userPageStates.userToEdit} {roles} onSubmit={handleDialogSubmit} bind:this={userDialogRef} isLoading={isLoading.saving} allowUsernameEdit={true} />
<div class="space-y-6">
<div>
@@ -187,18 +165,12 @@
<div class="flex flex-wrap">
{#each item.roles as role (role)}
{@const isAdmin = role === 'admin'}
- <StatusBadge
- text={isAdmin ? 'Admin' : 'User'}
- variant={isAdmin ? 'amber' : 'blue'}
- />
+ <StatusBadge text={isAdmin ? 'Admin' : 'User'} variant={isAdmin ? 'amber' : 'blue'} />
{/each}
</div>
</Table.Cell>
<Table.Cell>
- <StatusBadge
- text={item.oidcSubjectId ? 'OIDC' : 'Local'}
- variant={item.oidcSubjectId ? 'blue' : 'purple'}
- />
+ <StatusBadge text={item.oidcSubjectId ? 'OIDC' : 'Local'} variant={item.oidcSubjectId ? 'blue' : 'purple'} />
</Table.Cell>
<Table.Cell>
<DropdownMenu.Root>
@@ -216,10 +188,7 @@
Edit
</DropdownMenu.Item>
{/if}
- <DropdownMenu.Item
- class="text-red-500 focus:text-red-700!"
- onclick={() => handleRemoveUser(item.id)}
- >
+ <DropdownMenu.Item class="text-red-500 focus:text-red-700!" onclick={() => handleRemoveUser(item.id)}>
<UserX class="size-4" />
Remove User
</DropdownMenu.Item>
diff --git a/frontend/src/routes/volumes/+page.svelte b/frontend/src/routes/volumes/+page.svelte
index fdf63f61b..1c3d647bb 100644
--- a/frontend/src/routes/volumes/+page.svelte
+++ b/frontend/src/routes/volumes/+page.svelte
@@ -3,21 +3,11 @@
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
import { toast } from 'svelte-sonner';
- import {
- AlertCircle,
- HardDrive,
- Database,
- Trash2,
- Loader2,
- ChevronDown,
- Ellipsis,
- ScanSearch,
- Funnel
- } from '@lucide/svelte';
+ import { AlertCircle, HardDrive, Database, Trash2, Loader2, ChevronDown, Ellipsis, ScanSearch, Funnel } from '@lucide/svelte';
import UniversalTable from '$lib/components/universal-table.svelte';
import * as Alert from '$lib/components/ui/alert/index.js';
import { goto, invalidateAll } from '$app/navigation';
- import CreateVolumeDialog from './create-volume-dialog.svelte';
+ import CreateVolumeSheet from '$lib/components/sheets/create-volume-sheet.svelte';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import * as Table from '$lib/components/ui/table';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -39,12 +29,7 @@
showUnused: true
});
- const filteredVolumes = $derived(
- volumePageStates.volumes.filter(
- (vol) =>
- (volumePageStates.showUsed && vol.inUse) || (volumePageStates.showUnused && !vol.inUse)
- )
- );
+ const filteredVolumes = $derived(volumePageStates.volumes.filter((vol) => (volumePageStates.showUsed && vol.inUse) || (volumePageStates.showUnused && !vol.inUse)));
let isDialogOpen = $state({
create: false,
@@ -156,9 +141,7 @@
<div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
<div>
<h1 class="text-3xl font-bold tracking-tight">Volumes</h1>
- <p class="text-muted-foreground mt-1 text-sm">
- Manage persistent data storage for containers
- </p>
+ <p class="text-muted-foreground mt-1 text-sm">Manage persistent data storage for containers</p>
</div>
<div class="flex gap-2"></div>
</div>
@@ -235,20 +218,9 @@
</DropdownMenu.Content>
</DropdownMenu.Root>
{#if volumePageStates.selectedIds.length > 0}
- <ArcaneButton
- action="remove"
- customLabel="Delete Selected ({volumePageStates.selectedIds.length})"
- onClick={handleDeleteSelected}
- loading={isLoading.remove}
- loadingLabel="Processing..."
- disabled={isLoading.remove}
- />
+ <ArcaneButton action="remove" customLabel="Delete Selected ({volumePageStates.selectedIds.length})" onClick={handleDeleteSelected} loading={isLoading.remove} loadingLabel="Processing..." disabled={isLoading.remove} />
{/if}
- <ArcaneButton
- action="create"
- customLabel="Create Volume"
- onClick={() => (isDialogOpen.create = true)}
- />
+ <ArcaneButton action="create" customLabel="Create Volume" onClick={() => (isDialogOpen.create = true)} />
</div>
</div>
</Card.Header>
@@ -283,18 +255,12 @@
<Table.Cell>
<div class="flex items-center gap-2">
<span class="truncate">
- <a
- class="font-medium hover:underline"
- href="/volumes/{encodeURIComponent(item.Name)}/">{item.Name}</a
- >
+ <a class="font-medium hover:underline" href="/volumes/{encodeURIComponent(item.Name)}/">{item.Name}</a>
</span>
</div>
</Table.Cell>
<Table.Cell>
- <StatusBadge
- text={item.inUse ? 'In Use' : 'Unused'}
- variant={item.inUse ? 'green' : 'amber'}
- />
+ <StatusBadge text={item.inUse ? 'In Use' : 'Unused'} variant={item.inUse ? 'green' : 'amber'} />
</Table.Cell>
<Table.Cell>{item.Mountpoint}</Table.Cell>
<Table.Cell>{item.Driver}</Table.Cell>
@@ -310,21 +276,14 @@
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end">
<DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={() => goto(`/volumes/${encodeURIComponent(item.Name)}`)}
- disabled={isLoading.remove}
- >
+ <DropdownMenu.Item onclick={() => goto(`/volumes/${encodeURIComponent(item.Name)}`)} disabled={isLoading.remove}>
<ScanSearch class="size-4" />
Inspect
</DropdownMenu.Item>
<DropdownMenu.Separator />
- <DropdownMenu.Item
- class="text-red-500 focus:text-red-700!"
- onclick={() => handleRemoveVolumeConfirm(item.Name)}
- disabled={isLoading.remove || item.inUse}
- >
+ <DropdownMenu.Item class="text-red-500 focus:text-red-700!" onclick={() => handleRemoveVolumeConfirm(item.Name)} disabled={isLoading.remove || item.inUse}>
{#if isLoading.remove && volumePageStates.selectedIds.includes(item.Name)}
<Loader2 class="size-4 animate-spin" />
{:else}
@@ -342,25 +301,14 @@
<div class="flex flex-col items-center justify-center px-6 py-12 text-center">
<Database class="text-muted-foreground mb-4 size-12 opacity-40" />
<p class="text-lg font-medium">No volumes found</p>
- <p class="text-muted-foreground mt-1 max-w-md text-sm">
- Create a new volume using the "Create Volume" button above or use the Docker CLI
- </p>
+ <p class="text-muted-foreground mt-1 max-w-md text-sm">Create a new volume using the "Create Volume" button above or use the Docker CLI</p>
<div class="mt-4 flex gap-3">
- <ArcaneButton
- action="create"
- customLabel="Create Volume"
- onClick={() => (isDialogOpen.create = true)}
- size="sm"
- />
+ <ArcaneButton action="create" customLabel="Create Volume" onClick={() => (isDialogOpen.create = true)} size="sm" />
</div>
</div>
{/if}
</Card.Content>
</Card.Root>
- <CreateVolumeDialog
- bind:open={isDialogOpen.create}
- isCreating={isLoading.creating}
- onSubmit={(volumeCreateData) => handleCreateVolume(volumeCreateData)}
- />
+ <CreateVolumeSheet bind:open={isDialogOpen.create} isLoading={isLoading.creating} onSubmit={(volumeCreateData) => handleCreateVolume(volumeCreateData)} />
</div>
diff --git a/frontend/src/routes/volumes/+page.ts b/frontend/src/routes/volumes/+page.ts
index 35d81c10d..2ae01883c 100644
--- a/frontend/src/routes/volumes/+page.ts
+++ b/frontend/src/routes/volumes/+page.ts
@@ -34,8 +34,7 @@ export const load: PageLoad = async (): Promise<VolumePageData> => {
};
} catch (err: unknown) {
console.error('Failed to load volumes:', err);
- const message =
- err instanceof Error ? err.message : 'Failed to connect to Docker or list volumes.';
+ const message = err instanceof Error ? err.message : 'Failed to connect to Docker or list volumes.';
return {
volumes: [],
error: message
diff --git a/frontend/src/routes/volumes/[volumeName]/+page.svelte b/frontend/src/routes/volumes/[volumeName]/+page.svelte
index 51e2dd09c..4d8205fdc 100644
--- a/frontend/src/routes/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/volumes/[volumeName]/+page.svelte
@@ -1,16 +1,7 @@
<script lang="ts">
import type { PageData, ActionData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
- import {
- AlertCircle,
- HardDrive,
- Clock,
- Tag,
- Layers,
- Database,
- Globe,
- Info
- } from '@lucide/svelte';
+ import { AlertCircle, HardDrive, Clock, Tag, Layers, Database, Globe, Info } from '@lucide/svelte';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
import { goto } from '$app/navigation';
import * as Alert from '$lib/components/ui/alert/index.js';
@@ -35,8 +26,7 @@
let message = 'Are you sure you want to delete this volume? This action cannot be undone.';
if (inUse) {
- message +=
- '\n\n⚠️ Warning: This volume is currently in use by containers. Forcing removal may cause data loss or container issues.';
+ message += '\n\n⚠️ Warning: This volume is currently in use by containers. Forcing removal may cause data loss or container issues.';
}
openConfirmDialog({
@@ -104,13 +94,7 @@
<!-- Action Buttons - Replace with ArcaneButton -->
<div class="flex gap-2 self-start">
- <ArcaneButton
- action="remove"
- customLabel="Remove Volume"
- onClick={() => handleRemoveVolumeConfirm(volume?.Name)}
- loading={isLoading.remove}
- disabled={isLoading.remove}
- />
+ <ArcaneButton action="remove" customLabel="Remove Volume" onClick={() => handleRemoveVolumeConfirm(volume?.Name)} loading={isLoading.remove} disabled={isLoading.remove} />
</div>
</div>
</div>
@@ -139,9 +123,7 @@
<div class="grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-2 lg:grid-cols-3">
<!-- Name -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
<Database class="size-5 text-gray-500" />
</div>
<div class="min-w-0 flex-1">
@@ -152,9 +134,7 @@
<!-- Driver -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
<HardDrive class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
@@ -165,9 +145,7 @@
<!-- Created -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
<Clock class="size-5 text-green-500" />
</div>
<div class="min-w-0 flex-1">
@@ -178,9 +156,7 @@
<!-- Scope -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
<Globe class="size-5 text-purple-500" />
</div>
<div class="min-w-0 flex-1">
@@ -191,9 +167,7 @@
<!-- In Use -->
<div class="flex items-start gap-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-amber-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-amber-500/10 p-2">
<Info class="size-5 text-amber-500" />
</div>
<div class="min-w-0 flex-1">
@@ -210,9 +184,7 @@
<!-- Mountpoint - Full width -->
<div class="col-span-1 flex items-start gap-3 sm:col-span-2 lg:col-span-3">
- <div
- class="flex size-10 shrink-0 items-center justify-center rounded-full bg-teal-500/10 p-2"
- >
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-teal-500/10 p-2">
<Layers class="size-5 text-teal-500" />
</div>
<div class="min-w-0 flex-1">
@@ -240,14 +212,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(volume.Labels) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -271,14 +239,10 @@
<div class="bg-card divide-y rounded-lg border">
{#each Object.entries(volume.Options) as [key, value] (key)}
<div class="flex flex-col p-3 sm:flex-row">
- <div
- class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3"
- >
+ <div class="text-muted-foreground mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
{key}
</div>
- <div
- class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm"
- >
+ <div class="bg-muted/50 w-full rounded p-2 font-mono text-xs break-all sm:w-2/3 sm:text-sm">
{value}
</div>
</div>
@@ -296,9 +260,7 @@
<div class="bg-muted/30 mb-4 rounded-full p-3">
<Tag class="text-muted-foreground size-5 opacity-50" />
</div>
- <p class="text-muted-foreground">
- This volume has no additional labels or driver options.
- </p>
+ <p class="text-muted-foreground">This volume has no additional labels or driver options.</p>
</div>
</Card.Content>
</Card.Root>
@@ -311,16 +273,9 @@
<Database class="text-muted-foreground size-10 opacity-70" />
</div>
<h2 class="mb-2 text-xl font-medium">Volume Not Found</h2>
- <p class="text-muted-foreground mb-6">
- The requested volume could not be found or is no longer available.
- </p>
+ <p class="text-muted-foreground mb-6">The requested volume could not be found or is no longer available.</p>
- <ArcaneButton
- action="cancel"
- customLabel="Back to Volumes"
- onClick={() => goto('/volumes')}
- size="sm"
- />
+ <ArcaneButton action="cancel" customLabel="Back to Volumes" onClick={() => goto('/volumes')} size="sm" />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/volumes/create-volume-dialog.svelte b/frontend/src/routes/volumes/create-volume-dialog.svelte
deleted file mode 100644
index fd65dd75a..000000000
--- a/frontend/src/routes/volumes/create-volume-dialog.svelte
+++ /dev/null
@@ -1,167 +0,0 @@
-<script lang="ts">
- import { preventDefault } from '$lib/utils/form.utils';
- import * as Dialog from '$lib/components/ui/dialog/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import { Label } from '$lib/components/ui/label/index.js';
- import { Textarea } from '$lib/components/ui/textarea/index.js';
- import * as Accordion from '$lib/components/ui/accordion/index.js';
- import * as Select from '$lib/components/ui/select/index.js';
- import type { VolumeCreateOptions } from 'dockerode';
- import ArcaneButton from '$lib/components/arcane-button.svelte';
-
- interface Props {
- open?: boolean;
- isCreating?: boolean;
- onSubmit?: (data: VolumeCreateOptions) => void;
- }
-
- let { open = $bindable(false), isCreating = false, onSubmit = () => {} }: Props = $props();
-
- let volumeCreateStates = $state({
- volumeName: '',
- volumeDriver: 'local',
- volumeOptText: '',
- volumeLabels: ''
- });
-
- const drivers = [
- { label: 'Local', value: 'local' },
- { label: 'NFS', value: 'nfs' },
- { label: 'AWS EBS', value: 'awsElasticBlockStore' },
- { label: 'Azure Disk', value: 'azure_disk' },
- { label: 'GCE Persistent Disk', value: 'gcePersistentDisk' }
- ];
-
- function parseKeyValuePairs(text: string): Record<string, string> {
- if (!text.trim()) return {};
-
- const result: Record<string, string> = {};
- const lines = text.split('\n');
-
- for (const line of lines) {
- const trimmed = line.trim();
- if (!trimmed || !trimmed.includes('=')) continue;
-
- const [key, ...valueParts] = trimmed.split('=');
- const value = valueParts.join('=');
-
- if (key.trim()) {
- result[key.trim()] = value.trim();
- }
- }
-
- return result;
- }
-
- function handleSubmit() {
- if (!volumeCreateStates.volumeName.trim()) return;
-
- const driverOpts = parseKeyValuePairs(volumeCreateStates.volumeOptText);
- const labels = parseKeyValuePairs(volumeCreateStates.volumeLabels);
-
- const volumeOptions: VolumeCreateOptions = {
- Name: volumeCreateStates.volumeName.trim(),
- Driver: volumeCreateStates.volumeDriver,
- DriverOpts: Object.keys(driverOpts).length ? driverOpts : undefined,
- Labels: Object.keys(labels).length ? labels : undefined
- };
-
- onSubmit(volumeOptions);
- open = false;
- }
-</script>
-
-<Dialog.Root bind:open>
- <Dialog.Content class="sm:max-w-[500px]">
- <Dialog.Header>
- <Dialog.Title>Create New Volume</Dialog.Title>
- <Dialog.Description>Enter the details for the new Docker volume.</Dialog.Description>
- </Dialog.Header>
-
- <form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="volume-name" class="text-right">Name</Label>
- <Input
- id="volume-name"
- bind:value={volumeCreateStates.volumeName}
- class="col-span-3"
- placeholder="e.g., my-app-data"
- required
- disabled={isCreating}
- />
- </div>
-
- <div class="grid grid-cols-4 items-center gap-4">
- <Label for="volume-driver" class="text-right">Driver</Label>
- <div class="col-span-3">
- <Select.Root
- type="single"
- bind:value={volumeCreateStates.volumeDriver}
- disabled={isCreating}
- >
- <Select.Trigger class="w-full">
- <span
- >{drivers.find((d) => d.value === volumeCreateStates.volumeDriver)?.label ||
- 'Select a driver'}</span
- >
- </Select.Trigger>
- <Select.Content>
- {#each drivers as driverOption (driverOption.value)}
- <Select.Item value={driverOption.value}>
- {driverOption.label}
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
- </div>
-
- <Accordion.Root type="single">
- <Accordion.Item value="advanced">
- <Accordion.Trigger>Advanced Settings</Accordion.Trigger>
- <Accordion.Content>
- <div class="grid gap-4 pt-2">
- <div>
- <Label for="driver-opts">Driver Options</Label>
- <Textarea
- id="driver-opts"
- bind:value={volumeCreateStates.volumeOptText}
- placeholder="key=value&#10;key2=value2"
- disabled={isCreating}
- />
- <p class="text-muted-foreground mt-1 text-xs">
- Enter driver-specific options as key=value pairs, one per line
- </p>
- </div>
- <div>
- <Label for="labels">Labels</Label>
- <Textarea
- id="labels"
- bind:value={volumeCreateStates.volumeLabels}
- placeholder="com.example.description=Production data&#10;com.example.department=Finance"
- disabled={isCreating}
- />
- <p class="text-muted-foreground mt-1 text-xs">
- Enter metadata labels as key=value pairs, one per line
- </p>
- </div>
- </div>
- </Accordion.Content>
- </Accordion.Item>
- </Accordion.Root>
- </form>
-
- <Dialog.Footer>
- <ArcaneButton action="cancel" onClick={() => (open = false)} disabled={isCreating} />
-
- <ArcaneButton
- action="create"
- customLabel="Create Volume"
- onClick={handleSubmit}
- loading={isCreating}
- loadingLabel="Creating..."
- disabled={isCreating || !volumeCreateStates.volumeName.trim()}
- />
- </Dialog.Footer>
- </Dialog.Content>
-</Dialog.Root>