Skip to content

Modern Docker Management, Designed for Everyone

fix: use correct running container count on dashboard

Kyle Mendell3dad32721a0e
diff --git a/frontend/src/lib/components/quick-actions.svelte b/frontend/src/lib/components/quick-actions.svelte
index 0e117b34a..072446f23 100644
--- a/frontend/src/lib/components/quick-actions.svelte
+++ b/frontend/src/lib/components/quick-actions.svelte
@@ -17,6 +17,7 @@
dockerInfo,
stoppedContainers,
totalContainers,
+ runningContainers,
loadingDockerInfo = false,
isLoading,
onStartAll,
@@ -27,6 +28,7 @@
dockerInfo: DockerInfo;
stoppedContainers: number;
totalContainers: number;
+ runningContainers: number;
loadingDockerInfo?: boolean;
isLoading: IsLoadingFlags;
onStartAll: () => void;
@@ -107,7 +109,7 @@
<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: totalContainers })}</span>
+ <span class="rounded-full border px-1.5 py-0.5">{m.quick_actions_containers({ count: runningContainers })}</span>
</div>
</div>
</button>
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte
index 89a0ad732..5c527c340 100644
--- a/frontend/src/routes/dashboard/+page.svelte
+++ b/frontend/src/routes/dashboard/+page.svelte
@@ -26,6 +26,7 @@
let containers = $state(data.containers);
let images = $state(data.images);
let dockerInfo = $state(data.dockerInfo);
+ let containerStatusCounts = $state(data.containerStatusCounts);
let dashboardStates = $state({
dockerInfo: data.dockerInfo,
@@ -57,8 +58,9 @@
containers: [] as Array<{ date: Date; value: number }>
});
- const stoppedContainers = $derived(containers.data.filter((s) => s.state != 'running').length);
- const totalContainers = $derived(containers.pagination.totalItems);
+ const stoppedContainers = $derived(containerStatusCounts.stoppedContainers);
+ const runningContainers = $derived(containerStatusCounts.runningContainers);
+ const totalContainers = $derived(containerStatusCounts.totalContainers);
const currentStats = $derived(dashboardStates.systemStats || liveSystemStats);
function addToHistoricalData(stats: SystemStats) {
@@ -268,7 +270,8 @@
class="block"
dockerInfo={dashboardStates.dockerInfo}
{stoppedContainers}
- totalContainers={containers.pagination.totalItems}
+ {runningContainers}
+ {totalContainers}
loadingDockerInfo={isLoading.loadingDockerInfo}
isLoading={{ starting: isLoading.starting, stopping: isLoading.stopping, pruning: isLoading.pruning }}
onStartAll={handleStartAll}
diff --git a/frontend/src/routes/dashboard/+page.ts b/frontend/src/routes/dashboard/+page.ts
index b3323a138..d8a1fd1bd 100644
--- a/frontend/src/routes/dashboard/+page.ts
+++ b/frontend/src/routes/dashboard/+page.ts
@@ -26,6 +26,7 @@ export const load: PageLoad = async () => {
const containers = await environmentAPI.getContainers(containerRequestOptions);
const images = await environmentAPI.getImages(imageRequestOptions);
+ const containerStatusCounts = await environmentAPI.getContainerStatusCounts();
const [dockerInfoResult, settingsResult] = await Promise.allSettled([systemAPI.getDockerInfo(), settingsAPI.getSettings()]);
@@ -38,6 +39,7 @@ export const load: PageLoad = async () => {
images,
settings,
containerRequestOptions,
- imageRequestOptions
+ imageRequestOptions,
+ containerStatusCounts
};
};