Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
refactor: extended dashboard tables (#871)
Kyle Mendell6f8b15507bea
diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex 4ea58af61..cb7b49581 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -510,7 +510,7 @@"images_subtitle": "View and Manage your Container Images","images_total": "Total Images","images_total_size": "Total Size",- "images_top_largest": "Top 5 Largest Images",+ "images_top_largest": "Largest Images","images_showing_of_total": "Showing {shown} of {total} images","images_pull": "Pull","images_pull_image": "Pull Image",diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelteindex 3384abd00..714531530 100644--- a/frontend/src/routes/dashboard/+page.svelte+++ b/frontend/src/routes/dashboard/+page.svelte@@ -261,7 +261,7 @@}</script>-<div class="space-y-8">+<div class="flex min-h-[calc(100vh-5rem-2.5rem)] flex-col space-y-8"><div class="flex flex-col gap-4"><div class="flex items-start justify-between gap-3"><div class="flex-1 space-y-1">@@ -348,9 +348,9 @@</div></section>- <section>+ <section class="flex min-h-0 flex-1 flex-col"><h2 class="mb-4 text-lg font-semibold tracking-tight">Resources</h2>- <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">+ <div class="grid min-h-0 flex-1 grid-cols-1 gap-6 lg:grid-cols-2"><DashboardContainerTable bind:containers isLoading={isLoading.loadingContainers} /><DashboardImageTable bind:images isLoading={isLoading.loadingImages} /></div>diff --git a/frontend/src/routes/dashboard/dash-container-table.svelte b/frontend/src/routes/dashboard/dash-container-table.svelteindex fdf5b9a4c..a3c39dc33 100644--- a/frontend/src/routes/dashboard/dash-container-table.svelte+++ b/frontend/src/routes/dashboard/dash-container-table.svelte@@ -24,12 +24,36 @@} = $props();let selectedIds = $state<string[]>([]);+ let contentHeight = $state(0);++ // Estimate row height: ~57px per row (including borders/padding), plus ~145px for header+ const ROW_HEIGHT = 57;+ const HEADER_HEIGHT = 145;+ const MIN_ROWS = 3;+ const MAX_ROWS = 50;++ const calculatedLimit = $derived.by(() => {+ if (contentHeight <= 0) return 5;+ const availableHeight = contentHeight - HEADER_HEIGHT;+ const rows = Math.floor(availableHeight / ROW_HEIGHT);+ return Math.max(MIN_ROWS, Math.min(MAX_ROWS, rows));+ });++ let lastFetchedLimit = $state(5);let requestOptions = $state<SearchPaginationSortRequest>({pagination: { page: 1, limit: 5 },sort: { column: 'created', direction: 'desc' }});+ $effect(() => {+ if (calculatedLimit !== lastFetchedLimit && requestOptions.pagination) {+ lastFetchedLimit = calculatedLimit;+ requestOptions.pagination.limit = calculatedLimit;+ containerService.getContainers(requestOptions).then((result) => (containers = result));+ }+ });+const columns = [{ accessorKey: 'names', title: m.common_name(), cell: NameCell },{ accessorKey: 'image', title: m.common_image() },@@ -86,40 +110,42 @@/>{/snippet}-<Card.Root class="flex h-full min-h-0 flex-col">- <Card.Header icon={BoxIcon} class="shrink-0">- <div class="flex flex-1 items-center justify-between">- <div class="flex flex-col space-y-1.5">- <Card.Title>- <h2>{m.containers_title()}</h2>- </Card.Title>- <Card.Description>{m.containers_recent()}</Card.Description>+<div class="flex h-full min-h-0 flex-col" bind:clientHeight={contentHeight}>+ <Card.Root class="flex h-full min-h-0 flex-col">+ <Card.Header icon={BoxIcon} class="shrink-0">+ <div class="flex flex-1 items-center justify-between">+ <div class="flex flex-col space-y-1.5">+ <Card.Title>+ <h2>{m.containers_title()}</h2>+ </Card.Title>+ <Card.Description>{m.containers_recent()}</Card.Description>+ </div>+ <Button variant="ghost" size="sm" href="/containers" disabled={isLoading}>+ {m.common_view_all()}+ <ArrowRightIcon class="ml-2 size-4" />+ </Button></div>- <Button variant="ghost" size="sm" href="/containers" disabled={isLoading}>- {m.common_view_all()}- <ArrowRightIcon class="ml-2 size-4" />- </Button>- </div>- </Card.Header>- <Card.Content class="relative flex min-h-0 flex-1 flex-col px-0">- <ArcaneTable- items={containers}- bind:requestOptions- bind:selectedIds- onRefresh={async (options) => (containers = await containerService.getContainers(options))}- withoutSearch={true}- withoutPagination={true}- selectionDisabled={true}- unstyled={true}- {columns}- mobileCard={DashContainerMobileCard}- />- {#if containers.data.length > 5}- <div- class="bg-muted/40 text-muted-foreground absolute right-0 bottom-0 left-0 rounded-b-xl px-6 py-3 text-xs backdrop-blur-sm"- >- {m.containers_showing_of_total({ shown: 5, total: containers.pagination.totalItems })}- </div>- {/if}- </Card.Content>-</Card.Root>+ </Card.Header>+ <Card.Content class="relative flex min-h-0 flex-1 flex-col px-0">+ <ArcaneTable+ items={containers}+ bind:requestOptions+ bind:selectedIds+ onRefresh={async (options) => (containers = await containerService.getContainers(options))}+ withoutSearch={true}+ withoutPagination={true}+ selectionDisabled={true}+ unstyled={true}+ {columns}+ mobileCard={DashContainerMobileCard}+ />+ {#if containers.data.length >= calculatedLimit && containers.pagination.totalItems > calculatedLimit}+ <div+ class="bg-muted/40 text-muted-foreground absolute right-0 bottom-0 left-0 rounded-b-xl px-6 py-3 text-xs backdrop-blur-sm"+ >+ {m.containers_showing_of_total({ shown: calculatedLimit, total: containers.pagination.totalItems })}+ </div>+ {/if}+ </Card.Content>+ </Card.Root>+</div>diff --git a/frontend/src/routes/dashboard/dash-image-table.svelte b/frontend/src/routes/dashboard/dash-image-table.svelteindex 7b0f52929..0a77bde0c 100644--- a/frontend/src/routes/dashboard/dash-image-table.svelte+++ b/frontend/src/routes/dashboard/dash-image-table.svelte@@ -22,12 +22,36 @@isLoading: boolean;} = $props();+ let contentHeight = $state(0);++ // Estimate row height: ~57px per row (including borders/padding), plus ~145px for header+ const ROW_HEIGHT = 57;+ const HEADER_HEIGHT = 145;+ const MIN_ROWS = 3;+ const MAX_ROWS = 50;++ const calculatedLimit = $derived.by(() => {+ if (contentHeight <= 0) return 5;+ const availableHeight = contentHeight - HEADER_HEIGHT;+ const rows = Math.floor(availableHeight / ROW_HEIGHT);+ return Math.max(MIN_ROWS, Math.min(MAX_ROWS, rows));+ });++ let selectedIds = $state<string[]>([]);+ let lastFetchedLimit = $state(5);+let requestOptions = $state<SearchPaginationSortRequest>({pagination: { page: 1, limit: 5 },sort: { column: 'size', direction: 'desc' }});- let selectedIds = $state<string[]>([]);+ $effect(() => {+ if (calculatedLimit !== lastFetchedLimit && requestOptions.pagination) {+ lastFetchedLimit = calculatedLimit;+ requestOptions.pagination.limit = calculatedLimit;+ imageService.getImages(requestOptions).then((result) => (images = result));+ }+ });const columns = [{ accessorKey: 'repoTags', title: m.images_repository(), cell: NameCell },@@ -99,40 +123,42 @@/>{/snippet}-<Card.Root class="flex h-full min-h-0 flex-col">- <Card.Header icon={HardDriveIcon} class="shrink-0">- <div class="flex flex-1 items-center justify-between">- <div class="flex flex-col space-y-1.5">- <Card.Title>- <h2><a class="hover:underline" href="/images">{m.images_title()}</a></h2>- </Card.Title>- <Card.Description>{m.images_top_largest()}</Card.Description>- </div>- <Button variant="ghost" size="sm" href="/images" disabled={isLoading}>- {m.common_view_all()}- <ArrowRightIcon class="ml-2 size-4" />- </Button>- </div>- </Card.Header>- <Card.Content class="relative flex min-h-0 flex-1 flex-col px-0">- <ArcaneTable- items={images}- bind:requestOptions- bind:selectedIds- onRefresh={async (options) => (images = await imageService.getImages(options))}- withoutSearch={true}- selectionDisabled={true}- withoutPagination={true}- unstyled={true}- {columns}- mobileCard={DashImageMobileCard}- />- {#if images.data.length > 5}- <div- class="bg-muted/40 text-muted-foreground absolute right-0 bottom-0 left-0 rounded-b-xl px-6 py-3 text-xs backdrop-blur-sm"- >- {m.images_showing_of_total({ shown: 5, total: images.pagination.totalItems })}+<div class="flex h-full min-h-0 flex-col" bind:clientHeight={contentHeight}>+ <Card.Root class="flex h-full min-h-0 flex-col">+ <Card.Header icon={HardDriveIcon} class="shrink-0">+ <div class="flex flex-1 items-center justify-between">+ <div class="flex flex-col space-y-1.5">+ <Card.Title>+ <h2><a class="hover:underline" href="/images">{m.images_title()}</a></h2>+ </Card.Title>+ <Card.Description>{m.images_top_largest()}</Card.Description>+ </div>+ <Button variant="ghost" size="sm" href="/images" disabled={isLoading}>+ {m.common_view_all()}+ <ArrowRightIcon class="ml-2 size-4" />+ </Button></div>- {/if}- </Card.Content>-</Card.Root>+ </Card.Header>+ <Card.Content class="relative flex min-h-0 flex-1 flex-col px-0">+ <ArcaneTable+ items={images}+ bind:requestOptions+ bind:selectedIds+ onRefresh={async (options) => (images = await imageService.getImages(options))}+ withoutSearch={true}+ selectionDisabled={true}+ withoutPagination={true}+ unstyled={true}+ {columns}+ mobileCard={DashImageMobileCard}+ />+ {#if images.data.length >= calculatedLimit && images.pagination.totalItems > calculatedLimit}+ <div+ class="bg-muted/40 text-muted-foreground absolute right-0 bottom-0 left-0 rounded-b-xl px-6 py-3 text-xs backdrop-blur-sm"+ >+ {m.images_showing_of_total({ shown: calculatedLimit, total: images.pagination.totalItems })}+ </div>+ {/if}+ </Card.Content>+ </Card.Root>+</div>