Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
feat: redesign ui to be more modern
Kyle Mendell942d674792f9
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelteindex c5afd3809..3eb7a2e23 100644--- a/src/routes/+page.svelte+++ b/src/routes/+page.svelte@@ -392,7 +392,7 @@<a href="/settings" class="hover:underline">Settings</a><span class="mx-2">•</span><a- href="https://github.com/user/arcane"+ href="https://github.com/ofkm/arcane"target="_blank"rel="noopener noreferrer"class="hover:underline">GitHub</adiff --git a/src/routes/containers/+page.svelte b/src/routes/containers/+page.svelteindex b0ffcf8ae..a39fb413c 100644--- a/src/routes/containers/+page.svelte+++ b/src/routes/containers/+page.svelte@@ -1,28 +1,151 @@<script lang="ts">import DataTable from "$lib/components/data-table.svelte";- import Button from "$lib/components/ui/button/button.svelte";+ import { Button } from "$lib/components/ui/button/index.js";import * as Card from "$lib/components/ui/card/index.js";import { columns } from "./columns.js";- import { Plus } from "@lucide/svelte";+ import { Plus, Box, RefreshCw, Filter, ArrowUpDown } from "@lucide/svelte";+ import { Badge } from "$lib/components/ui/badge/index.js";+ import { invalidateAll } from "$app/navigation";let { data } = $props();const { containers } = data;++ let isRefreshing = $state(false);++ // Calculate running containers+ const runningContainers = $derived(+ containers?.filter((c) => c.state === "running").length || 0+ );++ // Calculate stopped containers+ const stoppedContainers = $derived(+ containers?.filter((c) => c.state === "exited").length || 0+ );++ // Calculate total containers+ const totalContainers = $derived(containers?.length || 0);++ async function refreshData() {+ isRefreshing = true;+ await invalidateAll();+ setTimeout(() => {+ isRefreshing = false;+ }, 500);+ }</script>-<div class="flex justify-between items-center mb-6">- <h1 class="text-2xl font-bold">Containers</h1>- <Button variant="default">- <Plus class="w-4 h-4" />- Create Container- </Button>-</div>+<div class="space-y-6">+ <!-- Header with refresh button -->+ <div class="flex flex-col sm:flex-row justify-between sm:items-center gap-4">+ <div>+ <h1 class="text-3xl font-bold tracking-tight">Containers</h1>+ <p class="text-sm text-muted-foreground mt-1">+ Manage your Docker containers+ </p>+ </div>+ <div class="flex gap-2">+ <Button+ variant="outline"+ size="sm"+ class="h-9"+ onclick={refreshData}+ disabled={isRefreshing}+ >+ <RefreshCw+ class={`h-4 w-4 mr-2 ${isRefreshing ? "animate-spin" : ""}`}+ />+ Refresh+ </Button>+ <Button variant="default">+ <Plus class="w-4 h-4 mr-2" />+ Create Container+ </Button>+ </div>+ </div>-<Card.Root>- <Card.Header>- <Card.Title>Container List</Card.Title>- <Card.Description>Manage your Docker containers</Card.Description>- </Card.Header>- <Card.Content>- <DataTable data={containers} {columns} />- </Card.Content>-</Card.Root>+ <!-- Container stats summary -->+ <div class="grid grid-cols-1 sm:grid-cols-3 gap-4">+ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Total</p>+ <p class="text-2xl font-bold">{totalContainers}</p>+ </div>+ <div class="bg-primary/10 p-2 rounded-full">+ <Box class="h-5 w-5 text-primary" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Running</p>+ <p class="text-2xl font-bold">{runningContainers}</p>+ </div>+ <div class="bg-green-500/10 p-2 rounded-full">+ <Box class="h-5 w-5 text-green-500" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Stopped</p>+ <p class="text-2xl font-bold">{stoppedContainers}</p>+ </div>+ <div class="bg-amber-500/10 p-2 rounded-full">+ <Box class="h-5 w-5 text-amber-500" />+ </div>+ </Card.Content>+ </Card.Root>+ </div>++ <!-- Main container table -->+ <Card.Root class="border shadow-sm">+ <Card.Header class="px-6">+ <div class="flex items-center justify-between">+ <div>+ <Card.Title>+ Container List+ <Badge variant="secondary" class="ml-2">{totalContainers}</Badge>+ </Card.Title>+ <Card.Description+ >View and manage your Docker containers</Card.Description+ >+ </div>+ <div class="flex items-center gap-2">+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <Filter class="h-4 w-4 mr-2" />+ Filter+ </Button>+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <ArrowUpDown class="h-4 w-4 mr-2" />+ Sort+ </Button>+ </div>+ </div>+ </Card.Header>+ <Card.Content>+ <DataTable data={containers} {columns} />+ </Card.Content>+ </Card.Root>++ {#if containers?.length === 0}+ <div+ class="flex flex-col items-center justify-center py-12 px-6 text-center border rounded-lg bg-card"+ >+ <Box class="h-12 w-12 text-muted-foreground mb-4 opacity-40" />+ <p class="text-lg font-medium">No containers found</p>+ <p class="text-sm text-muted-foreground mt-1 max-w-md">+ Create a new container using the "Create Container" button above or use+ the Docker CLI+ </p>+ <Button variant="outline" class="mt-4" onclick={refreshData}>+ <RefreshCw class="h-4 w-4 mr-2" />+ Refresh+ </Button>+ </div>+ {/if}+</div>diff --git a/src/routes/images/+page.svelte b/src/routes/images/+page.svelteindex 83296eb82..c8e84be62 100644--- a/src/routes/images/+page.svelte+++ b/src/routes/images/+page.svelte@@ -1,41 +1,172 @@<script lang="ts">import type { PageData } from "./$types";import DataTable from "$lib/components/data-table.svelte";- import { columns } from "./columns"; // Import the column definitions+ import { columns } from "./columns";import { Button } from "$lib/components/ui/button/index.js";- import { Download, AlertCircle } from "@lucide/svelte";+ import {+ Download,+ AlertCircle,+ RefreshCw,+ Filter,+ ArrowUpDown,+ HardDrive,+ } from "@lucide/svelte";import * as Alert from "$lib/components/ui/alert/index.js";+ import * as Card from "$lib/components/ui/card/index.js";+ import { Badge } from "$lib/components/ui/badge/index.js";+ import { invalidateAll } from "$app/navigation";let { data }: { data: PageData } = $props();const { images, error } = data;+ let isRefreshing = $state(false);++ // Calculate total images+ const totalImages = $derived(images?.length || 0);++ // Calculate total size of all images+ const totalSize = $derived(+ images?.reduce((acc, img) => acc + (img.size || 0), 0) || 0+ );+function pullImage() {// TODO: Implement pull image modal/logicalert("Implement pull image functionality");}++ async function refreshData() {+ isRefreshing = true;+ await invalidateAll();+ setTimeout(() => {+ isRefreshing = false;+ }, 500);+ }++ // Helper to format bytes+ function formatBytes(bytes: number | undefined | null, decimals = 1): string {+ if (!bytes || !+bytes) return "0 Bytes";+ const k = 1024;+ const dm = decimals < 0 ? 0 : decimals;+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];+ const i = Math.floor(Math.log(bytes) / Math.log(k));+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;+ }</script>-<div class="flex justify-between items-center mb-6">- <h1 class="text-2xl font-bold">Docker Images</h1>- <Button variant="default" onclick={pullImage}>- <Download class="w-4 h-4 mr-2" />- Pull Image- </Button>-</div>+<div class="space-y-6">+ <!-- Header with refresh and pull buttons -->+ <div class="flex flex-col sm:flex-row justify-between sm:items-center gap-4">+ <div>+ <h1 class="text-3xl font-bold tracking-tight">Docker Images</h1>+ <p class="text-sm text-muted-foreground mt-1">+ Manage your Docker images+ </p>+ </div>+ <div class="flex gap-2">+ <Button+ variant="outline"+ size="sm"+ class="h-9"+ onclick={refreshData}+ disabled={isRefreshing}+ >+ <RefreshCw+ class={`h-4 w-4 mr-2 ${isRefreshing ? "animate-spin" : ""}`}+ />+ Refresh+ </Button>+ <Button variant="default" onclick={pullImage}>+ <Download class="w-4 h-4 mr-2" />+ Pull Image+ </Button>+ </div>+ </div>++ {#if error}+ <Alert.Root variant="destructive">+ <AlertCircle class="h-4 w-4 mr-2" />+ <Alert.Title>Error Loading Images</Alert.Title>+ <Alert.Description>{error}</Alert.Description>+ </Alert.Root>+ {/if}-{#if error}- <Alert.Root variant="destructive" class="mb-6">- <AlertCircle class="h-4 w-4" />- <Alert.Title>Error Loading Images</Alert.Title>- <Alert.Description>{error}</Alert.Description>- </Alert.Root>-{/if}--{#if images}- <DataTable data={images} {columns} />-{:else if !error}- <!-- Show loading or no data state if needed, DataTable might handle empty state -->- <p class="text-center text-muted-foreground">- Loading images or no images found.- </p>-{/if}+ <!-- Image stats summary -->+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">+ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Total Images</p>+ <p class="text-2xl font-bold">{totalImages}</p>+ </div>+ <div class="bg-blue-500/10 p-2 rounded-full">+ <HardDrive class="h-5 w-5 text-blue-500" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Total Size</p>+ <p class="text-2xl font-bold">{formatBytes(totalSize)}</p>+ </div>+ <div class="bg-purple-500/10 p-2 rounded-full">+ <HardDrive class="h-5 w-5 text-purple-500" />+ </div>+ </Card.Content>+ </Card.Root>+ </div>++ <!-- Main images table -->+ {#if images && images.length > 0}+ <Card.Root class="border shadow-sm">+ <Card.Header class="px-6">+ <div class="flex items-center justify-between">+ <div>+ <Card.Title>+ Image List+ <Badge variant="secondary" class="ml-2">{totalImages}</Badge>+ </Card.Title>+ <Card.Description+ >View and manage your Docker images</Card.Description+ >+ </div>+ <div class="flex items-center gap-2">+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <Filter class="h-4 w-4 mr-2" />+ Filter+ </Button>+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <ArrowUpDown class="h-4 w-4 mr-2" />+ Sort+ </Button>+ </div>+ </div>+ </Card.Header>+ <Card.Content>+ <DataTable data={images} {columns} />+ </Card.Content>+ </Card.Root>+ {:else if !error}+ <div+ class="flex flex-col items-center justify-center py-12 px-6 text-center border rounded-lg bg-card"+ >+ <HardDrive class="h-12 w-12 text-muted-foreground mb-4 opacity-40" />+ <p class="text-lg font-medium">No images found</p>+ <p class="text-sm text-muted-foreground mt-1 max-w-md">+ Pull a new image using the "Pull Image" button above or use the Docker+ CLI+ </p>+ <div class="flex gap-3 mt-4">+ <Button variant="outline" onclick={refreshData}>+ <RefreshCw class="h-4 w-4 mr-2" />+ Refresh+ </Button>+ <Button variant="default" onclick={pullImage}>+ <Download class="h-4 w-4 mr-2" />+ Pull Image+ </Button>+ </div>+ </div>+ {/if}+</div>diff --git a/src/routes/networks/+page.svelte b/src/routes/networks/+page.svelteindex 627f999d4..57f99d893 100644--- a/src/routes/networks/+page.svelte+++ b/src/routes/networks/+page.svelte@@ -1,46 +1,179 @@<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 } from "@lucide/svelte";+ import {+ Plus,+ AlertCircle,+ Network,+ RefreshCw,+ Filter,+ ArrowUpDown,+ } from "@lucide/svelte";import DataTable from "$lib/components/data-table.svelte";import { columns } from "./columns";import type { PageData } from "./$types";import * as Alert from "$lib/components/ui/alert/index.js";+ import { Badge } from "$lib/components/ui/badge/index.js";+ import { invalidateAll } from "$app/navigation";let { data }: { data: PageData } = $props();const { networks, error } = data;+ let isRefreshing = $state(false);++ // Calculate network stats+ const totalNetworks = $derived(networks?.length || 0);+ const bridgeNetworks = $derived(+ networks?.filter((n) => n.driver === "bridge").length || 0+ );+ const overlayNetworks = $derived(+ networks?.filter((n) => n.driver === "overlay").length || 0+ );+function createNetwork() {alert("Implement create network functionality");}++ async function refreshData() {+ isRefreshing = true;+ await invalidateAll();+ setTimeout(() => {+ isRefreshing = false;+ }, 500);+ }</script>-<div class="flex justify-between items-center mb-6">- <h1 class="text-2xl font-bold">Networks</h1>- <Button variant="default" onclick={createNetwork}>- <Plus class="w-4 h-4 mr-2" />- Create Network- </Button>-</div>+<div class="space-y-6">+ <!-- Header with refresh and create buttons -->+ <div class="flex flex-col sm:flex-row justify-between sm:items-center gap-4">+ <div>+ <h1 class="text-3xl font-bold tracking-tight">Networks</h1>+ <p class="text-sm text-muted-foreground mt-1">+ Manage Docker container networking+ </p>+ </div>+ <div class="flex gap-2">+ <Button+ variant="outline"+ size="sm"+ class="h-9"+ onclick={refreshData}+ disabled={isRefreshing}+ >+ <RefreshCw+ class={`h-4 w-4 mr-2 ${isRefreshing ? "animate-spin" : ""}`}+ />+ Refresh+ </Button>+ <Button variant="default" onclick={createNetwork}>+ <Plus class="w-4 h-4 mr-2" />+ Create Network+ </Button>+ </div>+ </div>-{#if error}- <Alert.Root variant="destructive" class="mb-6">- <AlertCircle class="h-4 w-4" />- <Alert.Title>Error Loading Networks</Alert.Title>- <Alert.Description>{error}</Alert.Description>- </Alert.Root>-{/if}--<Card.Root>- <Card.Header>- <Card.Title>Docker Networks</Card.Title>- <Card.Description>Manage container communication</Card.Description>- </Card.Header>- <Card.Content>- {#if networks && networks.length > 0}- <DataTable data={networks} {columns} />- {:else if !error}- <p class="text-center text-muted-foreground py-4">No networks found.</p>- {/if}- </Card.Content>-</Card.Root>+ {#if error}+ <Alert.Root variant="destructive">+ <AlertCircle class="h-4 w-4 mr-2" />+ <Alert.Title>Error Loading Networks</Alert.Title>+ <Alert.Description>{error}</Alert.Description>+ </Alert.Root>+ {/if}++ <!-- Network stats summary -->+ <div class="grid grid-cols-1 sm:grid-cols-3 gap-4">+ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">+ Total Networks+ </p>+ <p class="text-2xl font-bold">{totalNetworks}</p>+ </div>+ <div class="bg-primary/10 p-2 rounded-full">+ <Network class="h-5 w-5 text-primary" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">+ Bridge Networks+ </p>+ <p class="text-2xl font-bold">{bridgeNetworks}</p>+ </div>+ <div class="bg-blue-500/10 p-2 rounded-full">+ <Network class="h-5 w-5 text-blue-500" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">+ Overlay Networks+ </p>+ <p class="text-2xl font-bold">{overlayNetworks}</p>+ </div>+ <div class="bg-purple-500/10 p-2 rounded-full">+ <Network class="h-5 w-5 text-purple-500" />+ </div>+ </Card.Content>+ </Card.Root>+ </div>++ <!-- Main networks table -->+ <Card.Root class="border shadow-sm">+ <Card.Header class="px-6">+ <div class="flex items-center justify-between">+ <div>+ <Card.Title>+ Network List+ <Badge variant="secondary" class="ml-2">{totalNetworks}</Badge>+ </Card.Title>+ <Card.Description>Manage container communication</Card.Description>+ </div>+ <div class="flex items-center gap-2">+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <Filter class="h-4 w-4 mr-2" />+ Filter+ </Button>+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <ArrowUpDown class="h-4 w-4 mr-2" />+ Sort+ </Button>+ </div>+ </div>+ </Card.Header>+ <!-- Fixed padding for the table container -->+ <Card.Content>+ {#if networks && networks.length > 0}+ <DataTable data={networks} {columns} />+ {:else if !error}+ <div+ class="flex flex-col items-center justify-center py-12 px-6 text-center"+ >+ <Network class="h-12 w-12 text-muted-foreground mb-4 opacity-40" />+ <p class="text-lg font-medium">No networks found</p>+ <p class="text-sm text-muted-foreground mt-1 max-w-md">+ Create a new network using the "Create Network" button above or use+ the Docker CLI+ </p>+ <div class="flex gap-3 mt-4">+ <Button variant="outline" onclick={refreshData}>+ <RefreshCw class="h-4 w-4 mr-2" />+ Refresh+ </Button>+ <Button variant="default" onclick={createNetwork}>+ <Plus class="h-4 w-4 mr-2" />+ Create Network+ </Button>+ </div>+ </div>+ {/if}+ </Card.Content>+ </Card.Root>+</div>diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelteindex aadfbbc36..af61f546a 100644--- a/src/routes/settings/+page.svelte+++ b/src/routes/settings/+page.svelte@@ -10,9 +10,13 @@RefreshCw,CheckCircle,XCircle,+ ServerCog,+ Sliders,+ Palette,} from "@lucide/svelte";import * as Switch from "$lib/components/ui/switch/index.js";import { enhance } from "$app/forms";+ import * as Alert from "$lib/components/ui/alert/index.js";let { data, form }: { data: PageData; form: ActionData } = $props();@@ -63,170 +67,240 @@}</script>-<div class="flex justify-between items-center mb-6">- <h1 class="text-2xl font-bold">Settings</h1>-</div>--{#if form?.error}- <div- class="mb-4 p-4 bg-destructive/10 text-destructive border border-destructive rounded-md"- >- <p><strong>Error saving settings:</strong> {form.error}</p>- </div>-{/if}-{#if form?.success}- <div- class="mb-4 p-4 bg-primary/10 text-primary border border-primary rounded-md"- >- <p>Settings saved successfully!</p>+<div class="space-y-6">+ <!-- Header -->+ <div class="flex flex-col sm:flex-row justify-between sm:items-center gap-4">+ <div>+ <h1 class="text-3xl font-bold tracking-tight">Settings</h1>+ <p class="text-sm text-muted-foreground mt-1">+ Configure Arcane's connection and behavior+ </p>+ </div>+ <Button+ type="submit"+ form="settings-form"+ disabled={isSubmitting || testStatus === "testing"}+ class="h-10"+ >+ <Save class="w-4 h-4 mr-2" />+ {isSubmitting ? "Saving..." : "Save Settings"}+ </Button></div>-{/if}-<form- method="POST"- use:enhance={() => {- isSubmitting = true;- testStatus = "idle";- testMessage = null;- return async ({ result, update }) => {- isSubmitting = false;-- // IMPORTANT: Update local state *before* calling update()- // This makes the UI reflect the change instantly- if (result.type === "success" && result.data?.settings) {- // Define the type for settings explicitly if needed, or infer- const newSettings = result.data.settings as typeof data.settings;- dockerHost = newSettings.dockerHost;- autoRefresh = newSettings.autoRefresh;- refreshInterval = newSettings.refreshInterval;- darkMode = newSettings.darkMode;- }+ <!-- Alerts -->+ {#if form?.error}+ <Alert.Root variant="destructive">+ <XCircle class="h-4 w-4 mr-2" />+ <Alert.Title>Error Saving Settings</Alert.Title>+ <Alert.Description>{form.error}</Alert.Description>+ </Alert.Root>+ {/if}- // Now call update to refresh the 'form' prop (for success/error messages)- // and potentially other page data if the load function depends on settings- await update({ reset: false });-- // No need to update state again here, it was done before update()- };- }}->- <div class="grid grid-cols-1 md:grid-cols-2 gap-6">- <Card.Root>- <Card.Header>- <Card.Title>Docker Connection</Card.Title>- <Card.Description>Configure Docker host connection</Card.Description>- </Card.Header>- <Card.Content class="space-y-4">- <div>- <Label for="dockerHost">Docker Host</Label>- <Input- id="dockerHost"- name="dockerHost"- bind:value={dockerHost}- placeholder="unix:///var/run/docker.sock"- class="mt-1"- disabled={testStatus === "testing"}- />- <p class="text-sm text-muted-foreground mt-1">- Enter Docker host URL (e.g., unix:///var/run/docker.sock or- tcp://localhost:2375)- </p>- </div>-- <Button- variant="secondary"- class="mt-2"- onclick={testConnection}- type="button"- disabled={testStatus === "testing"}- >- {#if testStatus === "testing"}- <RefreshCw class="w-4 h-4 mr-2 animate-spin" />- Testing...- {:else}- <RefreshCw class="w-4 h-4 mr-2" />- Test Connection- {/if}- </Button>-- {#if testStatus === "success"}- <div class="flex items-center gap-2 text-sm text-green-600 mt-2">- <CheckCircle class="w-4 h-4" />- <span>{testMessage || "Connection successful!"}</span>- </div>- {:else if testStatus === "error"}- <div class="flex items-center gap-2 text-sm text-destructive mt-2">- <XCircle class="w-4 h-4" />- <span>{testMessage || "Connection failed."}</span>- </div>- {/if}- </Card.Content>- </Card.Root>-- <Card.Root>- <Card.Header>- <Card.Title>Application Settings</Card.Title>- <Card.Description>Configure Arcane behavior</Card.Description>- </Card.Header>- <Card.Content>- <div class="space-y-6">- <div class="flex items-center justify-between rounded-lg border p-4">- <div class="space-y-0.5">- <Label for="autoRefreshSwitch" class="text-base"- >Auto Refresh</Label+ {#if form?.success}+ <Alert.Root+ variant="default"+ class="bg-primary/10 text-primary border border-primary"+ >+ <CheckCircle class="h-4 w-4 mr-2" />+ <Alert.Title>Settings Saved</Alert.Title>+ <Alert.Description+ >Your settings have been updated successfully.</Alert.Description+ >+ </Alert.Root>+ {/if}++ <!-- Settings Form -->+ <form+ id="settings-form"+ method="POST"+ use:enhance={() => {+ isSubmitting = true;+ testStatus = "idle";+ testMessage = null;+ return async ({ result, update }) => {+ isSubmitting = false;++ // IMPORTANT: Update local state *before* calling update()+ if (result.type === "success" && result.data?.settings) {+ const newSettings = result.data.settings as typeof data.settings;+ dockerHost = newSettings.dockerHost;+ autoRefresh = newSettings.autoRefresh;+ refreshInterval = newSettings.refreshInterval;+ darkMode = newSettings.darkMode;+ }++ await update({ reset: false });+ };+ }}+ >+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">+ <!-- Docker Connection Card -->+ <Card.Root class="border shadow-sm">+ <Card.Header class="pb-3">+ <div class="flex items-center gap-2">+ <div class="bg-blue-500/10 p-2 rounded-full">+ <ServerCog class="h-5 w-5 text-blue-500" />+ </div>+ <div>+ <Card.Title>Docker Connection</Card.Title>+ <Card.Description+ >Configure Docker host connection</Card.Description>- <p class="text-sm text-muted-foreground">- Automatically refresh data periodically.- </p></div>- <Switch.Root- id="autoRefreshSwitch"- name="autoRefresh"- bind:checked={autoRefresh}+ </div>+ </Card.Header>+ <Card.Content class="space-y-6">+ <div class="space-y-2">+ <Label for="dockerHost" class="text-sm font-medium"+ >Docker Host</Label+ >+ <Input+ id="dockerHost"+ name="dockerHost"+ bind:value={dockerHost}+ placeholder="unix:///var/run/docker.sock"+ class="mt-1"+ disabled={testStatus === "testing"}/>+ <p class="text-xs text-muted-foreground">+ Enter Docker host URL (e.g., unix:///var/run/docker.sock or+ tcp://localhost:2375)+ </p></div>- {#if autoRefresh}- <div class="space-y-1">- <Label for="refreshInterval">Refresh Interval (seconds)</Label>- <Input- id="refreshInterval"- name="refreshInterval"- type="number"- bind:value={refreshInterval}- min="5"- max="60"- />- {#if form?.error && form.values?.refreshInterval && (parseInt(String(form.values.refreshInterval), 10) < 5 || parseInt(String(form.values.refreshInterval), 10) > 60)}- <p class="text-sm text-destructive">- Must be between 5 and 60.- </p>+ <div>+ <Button+ variant="secondary"+ class="w-full sm:w-auto"+ onclick={testConnection}+ type="button"+ disabled={testStatus === "testing" || !dockerHost}+ >+ {#if testStatus === "testing"}+ <RefreshCw class="w-4 h-4 mr-2 animate-spin" />+ Testing...+ {:else}+ <RefreshCw class="w-4 h-4 mr-2" />+ Test Connection{/if}+ </Button>++ {#if testStatus === "success"}+ <div+ class="flex items-center gap-2 text-sm text-green-600 mt-3 bg-green-50 p-3 rounded-md border border-green-200"+ >+ <CheckCircle class="w-4 h-4 flex-shrink-0" />+ <span>{testMessage || "Connection successful!"}</span>+ </div>+ {:else if testStatus === "error"}+ <div+ class="flex items-center gap-2 text-sm text-destructive mt-3 bg-destructive/10 p-3 rounded-md border border-destructive/20"+ >+ <XCircle class="w-4 h-4 flex-shrink-0" />+ <span>{testMessage || "Connection failed."}</span>+ </div>+ {/if}+ </div>+ </Card.Content>+ </Card.Root>++ <!-- Application Settings Card -->+ <div class="space-y-6">+ <!-- Auto Refresh Settings Card -->+ <Card.Root class="border shadow-sm">+ <Card.Header class="pb-3">+ <div class="flex items-center gap-2">+ <div class="bg-amber-500/10 p-2 rounded-full">+ <Sliders class="h-5 w-5 text-amber-500" />+ </div>+ <div>+ <Card.Title>Auto Refresh</Card.Title>+ <Card.Description+ >Control data refresh behavior</Card.Description+ >+ </div></div>- {/if}-- <div class="flex items-center justify-between rounded-lg border p-4">- <div class="space-y-0.5">- <Label for="darkModeSwitch" class="text-base">Dark Mode</Label>- <p class="text-sm text-muted-foreground">- Enable the dark color theme.- </p>+ </Card.Header>+ <Card.Content class="space-y-6">+ <div+ class="flex items-center justify-between rounded-lg border p-4 bg-muted/30"+ >+ <div class="space-y-0.5">+ <Label for="autoRefreshSwitch" class="text-base font-medium"+ >Auto Refresh</Label+ >+ <p class="text-sm text-muted-foreground">+ Automatically refresh data periodically+ </p>+ </div>+ <Switch.Root+ id="autoRefreshSwitch"+ name="autoRefresh"+ bind:checked={autoRefresh}+ /></div>- <Switch.Root- id="darkModeSwitch"- name="darkMode"- bind:checked={darkMode}- />- </div>- </div>- </Card.Content>- </Card.Root>- </div>- <div class="mt-6 flex justify-end">- <Button type="submit" disabled={isSubmitting || testStatus === "testing"}>- <Save class="w-4 h-4 mr-2" />- {isSubmitting ? "Saving..." : "Save Settings"}- </Button>- </div>-</form>+ {#if autoRefresh}+ <div class="space-y-2 px-1">+ <Label for="refreshInterval" class="text-sm font-medium"+ >Refresh Interval (seconds)</Label+ >+ <Input+ id="refreshInterval"+ name="refreshInterval"+ type="number"+ bind:value={refreshInterval}+ min="5"+ max="60"+ />+ {#if form?.error && form.values?.refreshInterval && (parseInt(String(form.values.refreshInterval), 10) < 5 || parseInt(String(form.values.refreshInterval), 10) > 60)}+ <p class="text-sm text-destructive">+ Must be between 5 and 60.+ </p>+ {:else}+ <p class="text-xs text-muted-foreground">+ Set between 5-60 seconds. Lower values increase server load.+ </p>+ {/if}+ </div>+ {/if}+ </Card.Content>+ </Card.Root>++ <!-- UI Settings Card -->+ <Card.Root class="border shadow-sm">+ <Card.Header class="pb-3">+ <div class="flex items-center gap-2">+ <div class="bg-purple-500/10 p-2 rounded-full">+ <Palette class="h-5 w-5 text-purple-500" />+ </div>+ <div>+ <Card.Title>UI Settings</Card.Title>+ <Card.Description>Customize the appearance</Card.Description>+ </div>+ </div>+ </Card.Header>+ <Card.Content>+ <div+ class="flex items-center justify-between rounded-lg border p-4 bg-muted/30"+ >+ <div class="space-y-0.5">+ <Label for="darkModeSwitch" class="text-base font-medium"+ >Dark Mode</Label+ >+ <p class="text-sm text-muted-foreground">+ Enable the dark color theme+ </p>+ </div>+ <Switch.Root+ id="darkModeSwitch"+ name="darkMode"+ bind:checked={darkMode}+ />+ </div>+ </Card.Content>+ </Card.Root>+ </div>+ </div>+ </form>+</div>diff --git a/src/routes/volumes/+page.svelte b/src/routes/volumes/+page.svelteindex 0e7d8ad4b..d28cb2598 100644--- a/src/routes/volumes/+page.svelte+++ b/src/routes/volumes/+page.svelte@@ -1,47 +1,156 @@<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 } from "@lucide/svelte";+ import {+ Plus,+ AlertCircle,+ HardDrive,+ RefreshCw,+ Filter,+ ArrowUpDown,+ Database,+ } from "@lucide/svelte";import DataTable from "$lib/components/data-table.svelte";import { columns } from "./columns";import type { PageData } from "./$types";import * as Alert from "$lib/components/ui/alert/index.js";+ import { Badge } from "$lib/components/ui/badge/index.js";+ import { invalidateAll } from "$app/navigation";let { data }: { data: PageData } = $props();const { volumes, error } = data;+ let isRefreshing = $state(false);++ // Calculate total volumes+ const totalVolumes = $derived(volumes?.length || 0);+function createVolume() {// TODO: Implement create volume functionalityalert("Implement create volume functionality");}++ async function refreshData() {+ isRefreshing = true;+ await invalidateAll();+ setTimeout(() => {+ isRefreshing = false;+ }, 500);+ }</script>-<div class="flex justify-between items-center mb-6">- <h1 class="text-2xl font-bold">Volumes</h1>- <Button variant="default" onclick={createVolume}>- <Plus class="w-4 h-4 mr-2" />- Create Volume- </Button>-</div>+<div class="space-y-6">+ <!-- Header with refresh and create buttons -->+ <div class="flex flex-col sm:flex-row justify-between sm:items-center gap-4">+ <div>+ <h1 class="text-3xl font-bold tracking-tight">Volumes</h1>+ <p class="text-sm text-muted-foreground mt-1">+ Manage persistent data storage for containers+ </p>+ </div>+ <div class="flex gap-2">+ <Button+ variant="outline"+ size="sm"+ class="h-9"+ onclick={refreshData}+ disabled={isRefreshing}+ >+ <RefreshCw+ class={`h-4 w-4 mr-2 ${isRefreshing ? "animate-spin" : ""}`}+ />+ Refresh+ </Button>+ <Button variant="default" onclick={createVolume}>+ <Plus class="w-4 h-4 mr-2" />+ Create Volume+ </Button>+ </div>+ </div>-{#if error}- <Alert.Root variant="destructive" class="mb-6">- <AlertCircle class="h-4 w-4" />- <Alert.Title>Error Loading Volumes</Alert.Title>- <Alert.Description>{error}</Alert.Description>- </Alert.Root>-{/if}--<Card.Root>- <Card.Header>- <Card.Title>Docker Volumes</Card.Title>- <Card.Description>Manage persistent data storage</Card.Description>- </Card.Header>- <Card.Content>- {#if volumes && volumes.length > 0}- <DataTable data={volumes} {columns} />- {:else if !error}- <p class="text-center text-muted-foreground py-4">No volumes found.</p>- {/if}- </Card.Content>-</Card.Root>+ {#if error}+ <Alert.Root variant="destructive">+ <AlertCircle class="h-4 w-4 mr-2" />+ <Alert.Title>Error Loading Volumes</Alert.Title>+ <Alert.Description>{error}</Alert.Description>+ </Alert.Root>+ {/if}++ <!-- Volume stats summary -->+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">+ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Total Volumes</p>+ <p class="text-2xl font-bold">{totalVolumes}</p>+ </div>+ <div class="bg-amber-500/10 p-2 rounded-full">+ <Database class="h-5 w-5 text-amber-500" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Content class="p-4 flex items-center justify-between">+ <div>+ <p class="text-sm font-medium text-muted-foreground">Driver</p>+ <p class="text-2xl font-bold">local</p>+ </div>+ <div class="bg-blue-500/10 p-2 rounded-full">+ <HardDrive class="h-5 w-5 text-blue-500" />+ </div>+ </Card.Content>+ </Card.Root>+ </div>++ <!-- Main volumes table -->+ <Card.Root class="border shadow-sm">+ <Card.Header class="px-6">+ <div class="flex items-center justify-between">+ <div>+ <Card.Title>+ Volume List+ <Badge variant="secondary" class="ml-2">{totalVolumes}</Badge>+ </Card.Title>+ <Card.Description>Manage persistent data storage</Card.Description>+ </div>+ <div class="flex items-center gap-2">+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <Filter class="h-4 w-4 mr-2" />+ Filter+ </Button>+ <Button variant="outline" size="sm" class="hidden sm:flex">+ <ArrowUpDown class="h-4 w-4 mr-2" />+ Sort+ </Button>+ </div>+ </div>+ </Card.Header>+ <Card.Content>+ {#if volumes && volumes.length > 0}+ <DataTable data={volumes} {columns} />+ {:else if !error}+ <div+ class="flex flex-col items-center justify-center py-12 px-6 text-center"+ >+ <Database class="h-12 w-12 text-muted-foreground mb-4 opacity-40" />+ <p class="text-lg font-medium">No volumes found</p>+ <p class="text-sm text-muted-foreground mt-1 max-w-md">+ Create a new volume using the "Create Volume" button above or use+ the Docker CLI+ </p>+ <div class="flex gap-3 mt-4">+ <Button variant="outline" onclick={refreshData}>+ <RefreshCw class="h-4 w-4 mr-2" />+ Refresh+ </Button>+ <Button variant="default" onclick={createVolume}>+ <Plus class="h-4 w-4 mr-2" />+ Create Volume+ </Button>+ </div>+ </div>+ {/if}+ </Card.Content>+ </Card.Root>+</div>