Skip to content

Modern Docker Management, Designed for Everyone

feat: redesigned dashboard stats and docker info cards (#607)

Kyle Mendell07d7febaf18f
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index a45c3b894..91944b923 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1109,5 +1109,37 @@
"off": "Off",
"tap_to_edit": "Tap to edit",
"cannot_edit": "Cannot edit",
- "network_interface": "Network interface"
+ "network_interface": "Network interface",
+ "docker_info_dialog_title": "Docker Engine",
+ "docker_info_dialog_description": "Detailed information about your Docker installation",
+ "docker_info_version_section": "Version Information",
+ "docker_info_system_section": "System Information",
+ "docker_info_drivers_section": "Drivers & Storage",
+ "docker_info_stats_section": "Container Statistics",
+ "docker_info_version_label": "Version",
+ "docker_info_api_version_label": "API Version",
+ "docker_info_server_version_label": "Server Version",
+ "docker_info_git_commit_label": "Git Commit",
+ "docker_info_go_version_label": "Go Version",
+ "docker_info_build_time_label": "Build Time",
+ "docker_info_os_label": "Operating System",
+ "docker_info_os_type_label": "OS Type",
+ "docker_info_os_version_label": "OS Version",
+ "docker_info_architecture_label": "Architecture",
+ "docker_info_kernel_version_label": "Kernel Version",
+ "docker_info_cpus_label": "CPUs",
+ "docker_info_memory_label": "Total Memory",
+ "docker_info_storage_driver_label": "Storage Driver",
+ "docker_info_logging_driver_label": "Logging Driver",
+ "docker_info_cgroup_driver_label": "Cgroup Driver",
+ "docker_info_cgroup_version_label": "Cgroup Version",
+ "docker_info_total_containers_label": "Total Containers",
+ "docker_info_running_label": "Running",
+ "docker_info_paused_label": "Paused",
+ "docker_info_stopped_label": "Stopped",
+ "docker_info_images_label": "Images",
+ "dashboard_meter_disk_used": "Used",
+ "dashboard_meter_disk_free": "Free",
+ "dashboard_meter_disk_total": "Total",
+ "dashboard_docker_overview": "Docker Overview"
}
diff --git a/frontend/src/lib/components/dialogs/docker-info-dialog.svelte b/frontend/src/lib/components/dialogs/docker-info-dialog.svelte
new file mode 100644
index 000000000..9e24ec401
--- /dev/null
+++ b/frontend/src/lib/components/dialogs/docker-info-dialog.svelte
@@ -0,0 +1,186 @@
+<script lang="ts">
+ import * as Dialog from '$lib/components/ui/dialog/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import { Badge } from '$lib/components/ui/badge';
+ import InfoIcon from '@lucide/svelte/icons/info';
+ import CopyIcon from '@lucide/svelte/icons/copy';
+ import ServerIcon from '@lucide/svelte/icons/server';
+ import CpuIcon from '@lucide/svelte/icons/cpu';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import type { DockerInfo } from '$lib/types/docker-info.type';
+ import { toast } from 'svelte-sonner';
+ import { m } from '$lib/paraglide/messages';
+ import bytes from 'bytes';
+
+ let {
+ open = $bindable(),
+ dockerInfo
+ }: {
+ open: boolean;
+ dockerInfo: DockerInfo | null;
+ } = $props();
+
+ async function copy(text?: string) {
+ if (!text) return;
+ try {
+ await navigator.clipboard.writeText(text);
+ toast.success(m.common_copied());
+ } catch {
+ toast.error(m.common_copy_failed());
+ }
+ }
+
+ function formatMemory(bytes_val: number): string {
+ return bytes.format(bytes_val) ?? '-';
+ }
+</script>
+
+<Dialog.Root bind:open>
+ <Dialog.Content class="sm:max-w-[720px]">
+ <Dialog.Header class="border-b pb-3">
+ <Dialog.Title class="flex items-center gap-2">
+ <InfoIcon class="size-5 text-blue-500" />
+ {m.docker_info_dialog_title()}
+ </Dialog.Title>
+ <Dialog.Description>{m.docker_info_dialog_description()}</Dialog.Description>
+ </Dialog.Header>
+
+ <div class="space-y-4 py-4">
+ <div>
+ <h3 class="mb-2 flex items-center gap-2 text-sm font-semibold">
+ <ServerIcon class="size-4" />
+ {m.docker_info_version_section()}
+ </h3>
+ <div class="bg-muted/50 space-y-1.5 rounded-lg p-3">
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_version_label()}</span>
+ <Badge variant="outline">{dockerInfo?.version ?? '-'}</Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_api_version_label()}</span>
+ <span class="font-mono text-sm">{dockerInfo?.apiVersion ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_server_version_label()}</span>
+ <span class="font-mono text-sm">{dockerInfo?.serverVersion ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_git_commit_label()}</span>
+ <div class="flex items-center gap-2">
+ <span class="font-mono text-sm">{dockerInfo?.gitCommit?.slice(0, 8) ?? '-'}</span>
+ {#if dockerInfo?.gitCommit}
+ <Button variant="ghost" size="icon" class="size-6" onclick={() => copy(dockerInfo?.gitCommit)}>
+ <CopyIcon class="size-3" />
+ </Button>
+ {/if}
+ </div>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_go_version_label()}</span>
+ <span class="font-mono text-sm">{dockerInfo?.goVersion ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_build_time_label()}</span>
+ <span class="text-sm">{dockerInfo?.buildTime ?? '-'}</span>
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <h3 class="mb-2 flex items-center gap-2 text-sm font-semibold">
+ <CpuIcon class="size-4" />
+ {m.docker_info_system_section()}
+ </h3>
+ <div class="bg-muted/50 space-y-1.5 rounded-lg p-3">
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_os_label()}</span>
+ <span class="font-mono text-sm">{dockerInfo?.operatingSystem ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_os_type_label()}</span>
+ <span class="text-sm">{dockerInfo?.os ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_os_version_label()}</span>
+ <span class="font-mono text-sm">{dockerInfo?.osVersion ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_architecture_label()}</span>
+ <Badge>{dockerInfo?.architecture ?? '-'}</Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_kernel_version_label()}</span>
+ <span class="font-mono text-sm">{dockerInfo?.kernelVersion ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_cpus_label()}</span>
+ <Badge variant="secondary">{dockerInfo?.cpus ?? 0}</Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_memory_label()}</span>
+ <Badge variant="secondary">{formatMemory(dockerInfo?.memTotal ?? 0)}</Badge>
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <h3 class="mb-2 flex items-center gap-2 text-sm font-semibold">
+ <HardDriveIcon class="size-4" />
+ {m.docker_info_drivers_section()}
+ </h3>
+ <div class="bg-muted/50 space-y-1.5 rounded-lg p-3">
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_storage_driver_label()}</span>
+ <Badge variant="outline">{dockerInfo?.storageDriver ?? '-'}</Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_logging_driver_label()}</span>
+ <span class="text-sm">{dockerInfo?.loggingDriver ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_cgroup_driver_label()}</span>
+ <span class="text-sm">{dockerInfo?.cgroupDriver ?? '-'}</span>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_cgroup_version_label()}</span>
+ <span class="text-sm">{dockerInfo?.cgroupVersion ?? '-'}</span>
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <h3 class="mb-2 text-sm font-semibold">{m.docker_info_stats_section()}</h3>
+ <div class="bg-muted/50 space-y-1.5 rounded-lg p-3">
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_total_containers_label()}</span>
+ <Badge variant="secondary">{dockerInfo?.containers ?? 0}</Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_running_label()}</span>
+ <Badge class="border-emerald-500/30 bg-emerald-500/15 text-emerald-600">
+ {dockerInfo?.containersRunning ?? 0}
+ </Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_paused_label()}</span>
+ <Badge class="border-amber-500/30 bg-amber-500/15 text-amber-600">
+ {dockerInfo?.containersPaused ?? 0}
+ </Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_stopped_label()}</span>
+ <Badge variant="outline">{dockerInfo?.containersStopped ?? 0}</Badge>
+ </div>
+ <div class="flex items-center justify-between">
+ <span class="text-muted-foreground text-sm">{m.docker_info_images_label()}</span>
+ <Badge variant="outline">{dockerInfo?.images ?? 0}</Badge>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <Dialog.Footer class="border-t pt-3">
+ <Button variant="outline" onclick={() => (open = false)}>{m.common_close()}</Button>
+ </Dialog.Footer>
+ </Dialog.Content>
+</Dialog.Root>
diff --git a/frontend/src/lib/components/disk-meter.svelte b/frontend/src/lib/components/disk-meter.svelte
new file mode 100644
index 000000000..9c3195624
--- /dev/null
+++ b/frontend/src/lib/components/disk-meter.svelte
@@ -0,0 +1,111 @@
+<script lang="ts">
+ import { Progress } from '$lib/components/ui/progress/index.js';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import { m } from '$lib/paraglide/messages';
+ import bytes from 'bytes';
+
+ let {
+ diskUsage,
+ diskTotal,
+ loading = false,
+ class: className
+ }: {
+ diskUsage?: number;
+ diskTotal?: number;
+ loading?: boolean;
+ class?: string;
+ } = $props();
+
+ const percentage = $derived(
+ !loading && diskUsage !== undefined && diskTotal !== undefined && diskTotal > 0 ? (diskUsage / diskTotal) * 100 : 0
+ );
+
+ const diskFree = $derived(diskUsage !== undefined && diskTotal !== undefined ? diskTotal - diskUsage : 0);
+
+ function formatBytes(value: number): string {
+ return bytes.format(value, { unitSeparator: ' ' }) ?? '-';
+ }
+</script>
+
+<div
+ class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 group relative
+ isolate flex flex-col
+ overflow-hidden rounded-xl border
+ shadow-sm ring-1 ring-inset backdrop-blur-sm transition-all
+ duration-300 hover:shadow-md dark:shadow-none {className}"
+>
+ <div
+ class="flex items-center gap-3 bg-gradient-to-br from-gray-50 to-slate-50/30 p-3 sm:p-4 dark:from-gray-900/20 dark:to-slate-900/10"
+ >
+ <div
+ class="from-primary to-primary/80 shadow-primary/25 flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg sm:size-10"
+ >
+ {#if loading}
+ <LoaderCircleIcon class="size-4 animate-spin text-white sm:size-5" />
+ {:else}
+ <HardDriveIcon class="size-4 text-white sm:size-5" />
+ {/if}
+ </div>
+ <div class="min-w-0 flex-1">
+ <div class="text-foreground text-sm font-semibold">{m.dashboard_meter_disk()}</div>
+ <div class="text-muted-foreground text-xs">{m.dashboard_meter_disk_desc()}</div>
+ </div>
+ </div>
+
+ <div class="bg-card/90 flex flex-1 items-center p-3 sm:p-4">
+ <div class="flex w-full items-center gap-4">
+ <div class="flex-1 space-y-2">
+ {#if loading}
+ <div class="bg-muted h-2 w-full animate-pulse rounded"></div>
+ {:else}
+ <Progress value={percentage} max={100} class="h-2" />
+ {/if}
+
+ <div class="flex items-center justify-between text-xs">
+ {#if loading}
+ <div class="bg-muted h-3 w-16 animate-pulse rounded"></div>
+ <div class="bg-muted h-3 w-24 animate-pulse rounded"></div>
+ {:else}
+ <span class="text-muted-foreground font-medium">
+ {percentage.toFixed(1)}%
+ </span>
+ <span class="text-muted-foreground/70 font-mono">
+ {formatBytes(diskUsage ?? 0)} / {formatBytes(diskTotal ?? 0)}
+ </span>
+ {/if}
+ </div>
+ </div>
+
+ <div class="bg-muted/50 hidden shrink-0 gap-4 rounded-lg p-3 sm:flex">
+ <div class="space-y-0.5">
+ {#if loading}
+ <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-16 animate-pulse rounded"></div>
+ {:else}
+ <div class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
+ {m.dashboard_meter_disk_used()}
+ </div>
+ <div class="text-foreground text-sm font-semibold">
+ {formatBytes(diskUsage ?? 0)}
+ </div>
+ {/if}
+ </div>
+
+ <div class="space-y-0.5">
+ {#if loading}
+ <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-16 animate-pulse rounded"></div>
+ {:else}
+ <div class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
+ {m.dashboard_meter_disk_free()}
+ </div>
+ <div class="text-foreground text-sm font-semibold">
+ {formatBytes(diskFree)}
+ </div>
+ {/if}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/docker-details-cards.svelte b/frontend/src/lib/components/docker-details-cards.svelte
deleted file mode 100644
index 1773bc1b6..000000000
--- a/frontend/src/lib/components/docker-details-cards.svelte
+++ /dev/null
@@ -1,91 +0,0 @@
-<script lang="ts">
- import GradientFrameCard from '$lib/components/gradient-frame-card.svelte';
- import BoxIcon from '@lucide/svelte/icons/box';
- import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
- import DockerIcon from '$lib/icons/docker-icon.svelte';
- import type { Component } from 'svelte';
- import type { IconProps } from '@lucide/svelte';
- import { m } from '$lib/paraglide/messages';
-
- const DockerIconTyped = DockerIcon as unknown as Component<IconProps, {}, ''>;
-
- type DockerInfo =
- | {
- version?: string;
- os?: string;
- architecture?: string;
- }
- | null
- | undefined;
-
- let {
- title = m.dashboard_docker_details_title(),
- isLoadingDockerInfo = false,
- isLoadingStats = false,
- isLoadingImages = false,
- dockerInfo,
- totalContainers,
- stoppedContainers,
- containersRunning,
- imagesTotal = $bindable(),
- class: className
- }: {
- title?: string;
- isLoadingDockerInfo?: boolean;
- isLoadingStats?: boolean;
- isLoadingImages?: boolean;
- dockerInfo: DockerInfo;
- totalContainers: number;
- stoppedContainers: number;
- containersRunning: number;
- imagesTotal: number;
- class?: string;
- } = $props();
-</script>
-
-<section class={className}>
- <h2 class="mb-4 text-lg font-semibold tracking-tight">{title}</h2>
-
- <div class="grid grid-cols-1 gap-4 md:grid-cols-3">
- <GradientFrameCard
- class="w-full"
- title={m.docker_engine_title()}
- icon={DockerIconTyped}
- color="blue"
- loading={isLoadingDockerInfo}
- rightBadge={dockerInfo?.version ?? null}
- subtitle={!isLoadingDockerInfo
- ? m.docker_engine_subtitle({
- os: dockerInfo?.os ?? m.common_unknown(),
- arch: dockerInfo?.architecture ?? m.common_unknown()
- })
- : null}
- />
-
- <GradientFrameCard
- class="w-full"
- title={m.containers_title()}
- icon={BoxIcon}
- color="emerald"
- loading={isLoadingStats}
- rightBadge={!isLoadingStats ? m.docker_containers_running_badge({ count: containersRunning }) : null}
- >
- {#if !isLoadingStats}
- <div class="text-muted-foreground mt-1 flex flex-wrap items-center gap-2 text-xs">
- <span class="bg-muted rounded-md px-1.5 py-0.5">{m.docker_containers_total_badge({ count: totalContainers })}</span>
- <span class="bg-muted rounded-md px-1.5 py-0.5">{m.docker_containers_stopped_badge({ count: stoppedContainers })}</span>
- </div>
- {/if}
- </GradientFrameCard>
-
- <GradientFrameCard
- class="w-full"
- title={m.images_title()}
- icon={HardDriveIcon}
- color="purple"
- loading={isLoadingImages}
- rightBadge={!isLoadingImages ? imagesTotal : null}
- subtitle={!isLoadingImages ? m.docker_images_subtitle() : null}
- />
- </div>
-</section>
diff --git a/frontend/src/lib/components/docker-overview.svelte b/frontend/src/lib/components/docker-overview.svelte
new file mode 100644
index 000000000..d97f9a636
--- /dev/null
+++ b/frontend/src/lib/components/docker-overview.svelte
@@ -0,0 +1,96 @@
+<script lang="ts">
+ import { Badge } from '$lib/components/ui/badge';
+ import { Button } from '$lib/components/ui/button';
+ import { Skeleton } from '$lib/components/ui/skeleton';
+ import InfoIcon from '@lucide/svelte/icons/info';
+ import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
+ import DockerIcon from '$lib/icons/docker-icon.svelte';
+ import BoxIcon from '@lucide/svelte/icons/box';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import DockerInfoDialog from '$lib/components/dialogs/docker-info-dialog.svelte';
+ import type { DockerInfo } from '$lib/types/docker-info.type';
+ import { m } from '$lib/paraglide/messages';
+
+ let {
+ dockerInfo,
+ containersRunning,
+ containersStopped,
+ totalContainers,
+ totalImages,
+ loading = false,
+ class: className
+ }: {
+ dockerInfo: DockerInfo | null;
+ containersRunning: number;
+ containersStopped: number;
+ totalContainers: number;
+ totalImages: number;
+ loading?: boolean;
+ class?: string;
+ } = $props();
+
+ let dockerInfoDialogOpen = $state(false);
+</script>
+
+<div
+ class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 group relative isolate flex overflow-hidden rounded-xl border shadow-sm ring-1 ring-inset backdrop-blur-sm transition-all duration-300 hover:shadow-md dark:shadow-none {className}"
+>
+ <div
+ class="flex flex-1 items-center gap-4 bg-gradient-to-br from-gray-50 to-slate-50/30 p-4 dark:from-gray-900/20 dark:to-slate-900/10"
+ >
+ <div
+ class="from-primary to-primary/80 shadow-primary/25 flex size-10 shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg"
+ >
+ {#if loading}
+ <LoaderCircleIcon class="size-5 animate-spin text-white" />
+ {:else}
+ <DockerIcon class="size-5 text-white" />
+ {/if}
+ </div>
+
+ {#if loading}
+ <div class="flex flex-1 flex-col gap-2">
+ <Skeleton class="h-4 w-32" />
+ <Skeleton class="h-3 w-48" />
+ </div>
+ {:else}
+ <div class="flex flex-1 flex-col gap-1.5">
+ <div class="flex items-center gap-2">
+ <span class="text-foreground text-sm font-semibold">{m.docker_engine_title()}</span>
+ <Badge variant="outline" class="text-xs">{dockerInfo?.version ?? '-'}</Badge>
+ </div>
+ <div class="text-muted-foreground flex flex-wrap items-center gap-3 text-xs">
+ <span class="flex items-center gap-1.5">
+ <BoxIcon class="size-3" />
+ <span class="font-medium text-emerald-600">{containersRunning}</span>
+ <span class="text-muted-foreground/70">/</span>
+ <span>{totalContainers}</span>
+ </span>
+ <span class="text-muted-foreground/50">•</span>
+ <span class="flex items-center gap-1.5">
+ <HardDriveIcon class="size-3" />
+ <span>{totalImages}</span>
+ <span class="text-muted-foreground/70">{m.images_title().toLowerCase()}</span>
+ </span>
+ <span class="text-muted-foreground/50">•</span>
+ <span class="font-mono">
+ {dockerInfo?.os ?? '-'} / {dockerInfo?.architecture ?? '-'}
+ </span>
+ </div>
+ </div>
+ {/if}
+
+ {#if !loading && dockerInfo}
+ <Button
+ variant="ghost"
+ size="icon"
+ class="text-muted-foreground hover:text-foreground size-8 shrink-0"
+ onclick={() => (dockerInfoDialogOpen = true)}
+ >
+ <InfoIcon class="size-4" />
+ </Button>
+ {/if}
+ </div>
+</div>
+
+<DockerInfoDialog bind:open={dockerInfoDialogOpen} {dockerInfo} />
diff --git a/frontend/src/lib/components/meter-metric.svelte b/frontend/src/lib/components/meter-metric.svelte
index 647b974e0..5af577f60 100644
--- a/frontend/src/lib/components/meter-metric.svelte
+++ b/frontend/src/lib/components/meter-metric.svelte
@@ -13,7 +13,8 @@
maxValue?: number;
icon: typeof IconType;
loading?: boolean;
- footerText?: string;
+ showAbsoluteValues?: boolean;
+ formatAbsoluteValue?: (value: number) => string;
}
let {
@@ -25,7 +26,8 @@
maxValue = 100,
icon,
loading = false,
- footerText
+ showAbsoluteValues = false,
+ formatAbsoluteValue = (v) => v.toString()
}: Props = $props();
const percentage = $derived(currentValue !== undefined && !loading && maxValue > 0 ? (currentValue / maxValue) * 100 : 0);
@@ -34,20 +36,20 @@
<div
class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 group relative
- isolate flex aspect-square flex-col
+ isolate flex flex-col
overflow-hidden rounded-xl border
shadow-sm ring-1 ring-inset backdrop-blur-sm transition-all
- duration-300 hover:shadow-md sm:aspect-auto dark:shadow-none"
+ duration-300 hover:shadow-md dark:shadow-none"
>
- <div class="flex-none bg-gradient-to-br from-gray-50 to-slate-50/30 p-3 sm:p-4 dark:from-gray-900/20 dark:to-slate-900/10">
- <div class="flex items-center gap-3">
+ <div class="flex-none bg-gradient-to-br from-gray-50 to-slate-50/30 p-3 dark:from-gray-900/20 dark:to-slate-900/10">
+ <div class="flex items-center gap-2.5">
<div
- class="from-primary to-primary/80 shadow-primary/25 flex h-8 w-8 items-center justify-center rounded-full bg-gradient-to-br shadow-lg sm:h-10 sm:w-10"
+ class="from-primary to-primary/80 shadow-primary/25 flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg"
>
{#if loading}
- <LoaderCircleIcon class="size-4 animate-spin text-white sm:size-5" />
+ <LoaderCircleIcon class="size-4 animate-spin text-white" />
{:else}
- <Icon class="size-4 text-white sm:size-5" />
+ <Icon class="size-4 text-white" />
{/if}
</div>
<div class="min-w-0 flex-1">
@@ -59,37 +61,43 @@
</div>
</div>
- <div class="bg-card/90 flex flex-1 flex-col justify-center p-3 sm:p-4">
- <div class="w-full space-y-2 sm:space-y-3">
+ <div class="bg-card/90 flex flex-col justify-center p-3">
+ <div class="w-full space-y-2">
<div class="text-center">
{#if loading}
- <div class="bg-muted mx-auto h-8 w-16 animate-pulse rounded"></div>
+ <div class="bg-muted mx-auto h-7 w-14 animate-pulse rounded"></div>
{:else}
- <div class="text-foreground text-xl font-bold sm:text-2xl">
+ <div class="text-foreground text-lg font-bold">
{currentValue !== undefined ? formatValue(currentValue) : m.common_na()}
</div>
{/if}
</div>
- <div class="flex justify-center">
- <div class="w-full max-w-full sm:max-w-[120px]">
+ <div class="space-y-1.5">
+ {#if loading}
+ <div class="bg-muted h-1.5 w-full animate-pulse rounded"></div>
+ {:else}
+ <Progress value={percentage} max={100} class="h-1.5" />
+ {/if}
+
+ <div class="flex items-center justify-between text-xs">
{#if loading}
- <div class="bg-muted h-2 w-full animate-pulse rounded"></div>
+ <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
+ {#if showAbsoluteValues}
+ <div class="bg-muted h-3 w-20 animate-pulse rounded"></div>
+ {/if}
{:else}
- <Progress value={percentage} max={100} class="h-2" />
+ <span class="text-muted-foreground font-medium">
+ {percentage.toFixed(1)}%
+ </span>
+ {#if showAbsoluteValues && currentValue !== undefined && maxValue !== undefined}
+ <span class="text-muted-foreground/70 font-mono text-[10px]">
+ {formatAbsoluteValue(currentValue)} / {formatAbsoluteValue(maxValue)}
+ </span>
+ {/if}
{/if}
</div>
</div>
-
- <div class="bg-primary/10 dark:bg-primary/20 mt-auto flex min-h-[44px] items-center justify-center rounded-lg p-3 sm:p-4">
- {#if loading}
- <div class="bg-muted mx-auto h-3 w-20 animate-pulse rounded"></div>
- {:else}
- <div class="text-primary dark:text-primary text-center text-xs font-medium leading-tight sm:text-sm">
- {footerText ?? m.meter_footer_usage({ percent: Number(percentage).toFixed(1) })}
- </div>
- {/if}
- </div>
</div>
</div>
</div>
diff --git a/frontend/src/lib/components/quick-actions.svelte b/frontend/src/lib/components/quick-actions.svelte
index cb4d0b2ac..d13cd7a94 100644
--- a/frontend/src/lib/components/quick-actions.svelte
+++ b/frontend/src/lib/components/quick-actions.svelte
@@ -48,11 +48,12 @@
<section class={className}>
{#if compact}
{#if loadingDockerInfo}
- <div class="flex flex-wrap items-center gap-2">
+ <div class="hidden flex-wrap items-center gap-2 sm:flex">
{#each Array(4) as _}
<div class="bg-muted/40 h-9 w-28 animate-pulse rounded-lg border"></div>
{/each}
</div>
+ <div class="bg-muted/40 size-9 animate-pulse rounded-lg border sm:hidden"></div>
{:else}
<div class="hidden flex-wrap items-center gap-2 sm:flex">
<button
@@ -123,16 +124,14 @@
</div>
<DropdownMenu.Root>
- <DropdownMenu.Trigger
- class="bg-background/70 inline-flex size-9 items-center justify-center rounded-lg border sm:hidden"
- >
+ <DropdownMenu.Trigger class="bg-background/70 inline-flex size-9 items-center justify-center rounded-lg border sm:hidden">
<span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
+ <EllipsisIcon class="size-4" />
</DropdownMenu.Trigger>
<DropdownMenu.Content
align="end"
- class="bg-card/80 supports-[backdrop-filter]:bg-card/60 z-50 min-w-[160px] rounded-md p-1 shadow-lg backdrop-blur-sm supports-[backdrop-filter]:backdrop-blur-sm"
+ class="bg-card/80 supports-[backdrop-filter]:bg-card/60 z-50 min-w-[160px] rounded-md p-1 shadow-lg backdrop-blur-sm"
>
<DropdownMenu.Group>
<DropdownMenu.Item
@@ -234,6 +233,34 @@
<CircleStopIcon class="size-5 text-sky-400" />
{/if}
</div>
+ <div
+ class="pointer-events-none absolute -inset-1 rounded-lg bg-sky-500/20 opacity-0 blur-lg transition-opacity group-hover:opacity-40"
+ ></div>
+ </div>
+ <div class="flex-1 text-left">
+ <div class="text-sm font-medium">{m.quick_actions_stop_all()}</div>
+ <div class="text-muted-foreground text-xs">
+ <span class="rounded-full border px-1.5 py-0.5">{m.quick_actions_containers({ count: runningContainers })}</span>
+ </div>
+ </div>
+ </button>
+ </div>
+
+ <div class="group rounded-xl bg-gradient-to-br from-red-500/20 to-red-500/0 p-[1px]">
+ <button
+ class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-offset-background focus-visible:ring-ring flex min-h-14 w-full items-center gap-3 rounded-xl border p-3 shadow-sm backdrop-blur transition-all hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
+ disabled={!dockerInfo || isLoading.starting || isLoading.stopping || isLoading.pruning}
+ onclick={onOpenPruneDialog}
+ aria-busy={isLoading.pruning}
+ >
+ <div class="relative">
+ <div class="flex size-10 items-center justify-center rounded-lg bg-red-500/10 ring-1 ring-red-500/30">
+ {#if isLoading.pruning}
+ <LoaderCircleIcon class="size-4 text-red-400 motion-safe:animate-spin" />
+ {:else}
+ <Trash2Icon class="size-5 text-red-400" />
+ {/if}
+ </div>
<div
class="pointer-events-none absolute -inset-1 rounded-lg bg-red-500/20 opacity-0 blur-lg transition-opacity group-hover:opacity-40"
></div>
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte
index cc4ad8ecc..2bf071868 100644
--- a/frontend/src/routes/dashboard/+page.svelte
+++ b/frontend/src/routes/dashboard/+page.svelte
@@ -1,8 +1,6 @@
<script lang="ts">
- import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
import MemoryStickIcon from '@lucide/svelte/icons/memory-stick';
import CpuIcon from '@lucide/svelte/icons/cpu';
- import ContainerIcon from '@lucide/svelte/icons/container';
import { toast } from 'svelte-sonner';
import PruneConfirmationDialog from '$lib/components/dialogs/prune-confirmation-dialog.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
@@ -14,14 +12,16 @@
import { createStatsWebSocket } from '$lib/utils/ws';
import type { ReconnectingWebSocket } from '$lib/utils/ws';
import MeterMetric from '$lib/components/meter-metric.svelte';
+ import DiskMeter from '$lib/components/disk-meter.svelte';
import QuickActions from '$lib/components/quick-actions.svelte';
- import DockerDetailsCards from '$lib/components/docker-details-cards.svelte';
+ import DockerOverview from '$lib/components/docker-overview.svelte';
import type { SystemStats } from '$lib/types/system-stats.type';
import DashboardContainerTable from './dash-container-table.svelte';
import DashboardImageTable from './dash-image-table.svelte';
import { m } from '$lib/paraglide/messages';
import { invalidateAll } from '$app/navigation';
import { systemService } from '$lib/services/system-service';
+ import bytes from 'bytes';
let { data } = $props();
let containers = $state(data.containers);
@@ -108,7 +108,6 @@
async function refreshData() {
isLoading.refreshing = true;
-
await invalidateAll();
isLoading.refreshing = false;
}
@@ -169,17 +168,14 @@
statsWSClient.connect();
}
- // Reconnect stats WS and refresh data when environment changes
$effect(() => {
const unsubscribe = environmentStore.selected.subscribe(async (env) => {
if (!env) return;
- // If already mounted and client exists, reconnect and refresh
if (statsWSClient) {
statsWSClient.close();
statsWSClient = null;
resetStats();
setupStatsWS();
- // Also refresh non-WS data for this page
await refreshData();
}
});
@@ -263,15 +259,15 @@
</script>
<div class="space-y-8">
- <div class="relative flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
- <div class="space-y-1">
- <h1 class="text-3xl font-bold tracking-tight">{m.dashboard_title()}</h1>
- <p class="text-muted-foreground max-w-2xl text-sm">{m.dashboard_subtitle()}</p>
- </div>
+ <div class="flex flex-col gap-4">
+ <div class="flex items-start justify-between gap-3">
+ <div class="flex-1 space-y-1">
+ <h1 class="text-3xl font-bold tracking-tight">{m.dashboard_title()}</h1>
+ <p class="text-muted-foreground max-w-2xl text-sm">{m.dashboard_subtitle()}</p>
+ </div>
- <div class="flex flex-wrap items-center justify-end gap-2">
<QuickActions
- class="absolute right-4 top-4 flex-wrap items-center gap-2 sm:static sm:flex"
+ class="shrink-0"
compact
dockerInfo={dashboardStates.dockerInfo}
{stoppedContainers}
@@ -289,73 +285,56 @@
<section>
<h2 class="mb-4 text-lg font-semibold tracking-tight">{m.dashboard_system_overview()}</h2>
- <div class="grid grid-cols-2 gap-3 sm:grid-cols-2 lg:grid-cols-4">
- <MeterMetric
- title={m.dashboard_meter_running()}
- icon={ContainerIcon}
- currentValue={isLoading.loadingStats ? undefined : runningContainers}
- formatValue={(v) => v.toString()}
- maxValue={Math.max(totalContainers, 1)}
- footerText={`${runningContainers} of ${totalContainers} running`}
- unit="containers"
- loading={isLoading.loadingStats}
- />
-
- <MeterMetric
- title={m.dashboard_meter_cpu()}
- icon={CpuIcon}
- description={m.dashboard_meter_cpu_desc()}
- currentValue={isLoading.loadingStats || !hasInitialStatsLoaded ? undefined : currentStats?.cpuUsage}
- unit="%"
- maxValue={100}
- formatValue={(v) => `${v.toFixed(1)}`}
- loading={isLoading.loadingStats || !hasInitialStatsLoaded}
- />
-
- <MeterMetric
- title={m.dashboard_meter_memory()}
- icon={MemoryStickIcon}
- description={m.dashboard_meter_memory_desc()}
- currentValue={isLoading.loadingStats || !hasInitialStatsLoaded
- ? undefined
- : currentStats?.memoryUsage !== undefined && currentStats?.memoryTotal !== undefined
- ? (currentStats.memoryUsage / currentStats.memoryTotal) * 100
- : undefined}
- unit="%"
- formatValue={(v) => `${v.toFixed(1)}`}
- maxValue={100}
- loading={isLoading.loadingStats || !hasInitialStatsLoaded}
- />
-
- <MeterMetric
- icon={HardDriveIcon}
- title={m.dashboard_meter_disk()}
- description={m.dashboard_meter_disk_desc()}
- currentValue={isLoading.loadingStats || !hasInitialStatsLoaded
- ? undefined
- : currentStats?.diskUsage !== undefined && currentStats?.diskTotal !== undefined
- ? (currentStats.diskUsage / currentStats.diskTotal) * 100
- : undefined}
- unit="%"
- formatValue={(v) => `${v.toFixed(1)}`}
- maxValue={100}
- loading={isLoading.loadingStats || !hasInitialStatsLoaded}
+ <div class="space-y-3">
+ <div class="grid grid-cols-2 gap-3 sm:grid-cols-2 lg:grid-cols-3">
+ <MeterMetric
+ title={m.dashboard_meter_cpu()}
+ icon={CpuIcon}
+ description={m.dashboard_meter_cpu_desc()}
+ currentValue={isLoading.loadingStats || !hasInitialStatsLoaded ? undefined : currentStats?.cpuUsage}
+ unit="%"
+ maxValue={100}
+ formatValue={(v) => `${v.toFixed(1)}`}
+ loading={isLoading.loadingStats || !hasInitialStatsLoaded}
+ />
+
+ <MeterMetric
+ title={m.dashboard_meter_memory()}
+ icon={MemoryStickIcon}
+ description={m.dashboard_meter_memory_desc()}
+ currentValue={isLoading.loadingStats || !hasInitialStatsLoaded ? undefined : currentStats?.memoryUsage}
+ unit="%"
+ formatValue={(v) => {
+ if (currentStats?.memoryTotal) {
+ return ((v / currentStats.memoryTotal) * 100).toFixed(1);
+ }
+ return '0';
+ }}
+ maxValue={currentStats?.memoryTotal}
+ showAbsoluteValues={true}
+ formatAbsoluteValue={(v) => bytes.format(v, { unitSeparator: ' ' }) ?? '-'}
+ loading={isLoading.loadingStats || !hasInitialStatsLoaded}
+ />
+
+ <DiskMeter
+ diskUsage={currentStats?.diskUsage}
+ diskTotal={currentStats?.diskTotal}
+ loading={isLoading.loadingStats || !hasInitialStatsLoaded}
+ class="col-span-2 sm:col-span-1"
+ />
+ </div>
+
+ <DockerOverview
+ dockerInfo={dashboardStates.dockerInfo}
+ containersRunning={runningContainers}
+ containersStopped={stoppedContainers}
+ {totalContainers}
+ totalImages={images.pagination.totalItems}
+ loading={isLoading.loadingDockerInfo}
/>
</div>
</section>
- <DockerDetailsCards
- title={m.dashboard_docker_details_title()}
- isLoadingDockerInfo={isLoading.loadingDockerInfo}
- isLoadingStats={isLoading.loadingStats}
- isLoadingImages={isLoading.loadingImages}
- dockerInfo={dashboardStates.dockerInfo}
- totalContainers={containers.pagination.totalItems}
- {stoppedContainers}
- containersRunning={dockerInfo?.containersRunning ?? 0}
- bind:imagesTotal={images.pagination.totalItems}
- />
-
<section>
<h2 class="mb-4 text-lg font-semibold tracking-tight">Resources</h2>
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">