Skip to content

Modern Docker Management, Designed for Everyone

fix: correct counts of containers and images on dashboard

Kyle Mendell520a18a52a8e
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte
index e3d671eaa..3ed13e816 100644
--- a/frontend/src/routes/dashboard/+page.svelte
+++ b/frontend/src/routes/dashboard/+page.svelte
@@ -70,18 +70,26 @@
containers: [] as Array<{ date: Date; value: number }>
});
+ const dockerInfoRef = $derived(dashboardStates.dockerInfo);
+ const totalContainers = $derived(
+ dockerInfoRef?.containers ?? dashboardStates.containers?.length ?? 0
+ );
const runningContainers = $derived(
- dashboardStates.containers?.filter((c: ContainerInfo) => c.State === 'running').length ?? 0
+ dockerInfoRef?.containersRunning ??
+ (dashboardStates.containers
+ ? dashboardStates.containers.filter((c: ContainerInfo) => c.State === 'running').length
+ : 0)
);
-
const stoppedContainers = $derived(
- dashboardStates.containers?.filter((c: ContainerInfo) => c.State === 'exited').length ?? 0
+ dockerInfoRef?.containersStopped ??
+ (dashboardStates.containers
+ ? dashboardStates.containers.filter((c: ContainerInfo) => c.State !== 'running').length
+ : 0)
);
-
const totalImageSize = $derived(
dashboardStates.images?.reduce((sum, image) => sum + (image.Size || 0), 0) ?? 0
);
-
+ const totalImages = $derived(dockerInfoRef?.images ?? dashboardStates.images?.length ?? 0);
const currentStats = $derived(dashboardStates.systemStats || liveSystemStats);
function addToHistoricalData(stats: SystemStats) {
@@ -604,8 +612,7 @@
{:else}
<p class="text-sm font-medium">Total Containers</p>
<p class="text-xs text-muted-foreground">
- {dashboardStates.containers?.length || 0} total •
- {stoppedContainers} stopped
+ {totalContainers} total • {stoppedContainers} stopped
</p>
{/if}
</div>
@@ -653,12 +660,14 @@
isLoading={isLoading.loadingContainers}
onRefresh={onContainerRefresh}
{getContainerDisplayName}
+ total={totalContainers}
/>
<DashboardImageTable
images={dashboardStates.images}
isLoading={isLoading.loadingImages}
onRefresh={onImageRefresh}
+ total={totalImages}
/>
</div>
</section>
diff --git a/frontend/src/routes/dashboard/dash-container-table.svelte b/frontend/src/routes/dashboard/dash-container-table.svelte
index 444cb58c1..51ee2eabe 100644
--- a/frontend/src/routes/dashboard/dash-container-table.svelte
+++ b/frontend/src/routes/dashboard/dash-container-table.svelte
@@ -18,12 +18,14 @@
containers,
isLoading,
onRefresh,
- getContainerDisplayName
+ getContainerDisplayName,
+ total = containers.length
}: {
containers: ContainerInfo[];
isLoading: boolean;
onRefresh: (options: SearchPaginationSortRequest) => Promise<Paginated<ContainerWithId>>;
getContainerDisplayName: (container: ContainerInfo) => string;
+ total?: number;
} = $props();
let requestOptions = $state<SearchPaginationSortRequest>({
@@ -103,7 +105,7 @@
</ArcaneTable>
{#if containers.length > 5}
<div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
- Showing 5 of {containers.length} containers
+ Showing 5 of {total} containers
</div>
{/if}
</div>
diff --git a/frontend/src/routes/dashboard/dash-image-table.svelte b/frontend/src/routes/dashboard/dash-image-table.svelte
index 2af137df3..9dc1b5c45 100644
--- a/frontend/src/routes/dashboard/dash-image-table.svelte
+++ b/frontend/src/routes/dashboard/dash-image-table.svelte
@@ -16,11 +16,13 @@
let {
images,
isLoading,
- onRefresh
+ onRefresh,
+ total = images.length
}: {
images: EnhancedImageInfo[];
isLoading: boolean;
onRefresh: (options: SearchPaginationSortRequest) => Promise<Paginated<ImageWithId>>;
+ total?: number;
} = $props();
let requestOptions = $state<SearchPaginationSortRequest>({
@@ -122,7 +124,7 @@
</ArcaneTable>
{#if images.length > 5}
<div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
- Showing 5 of {images.length} images
+ Showing 5 of {total} images
</div>
{/if}
</div>