Skip to content

Modern Docker Management, Designed for Everyone

fix: loading states on action buttons not reflecting status

Kyle Mendell8305078dcd1f
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index c19c64ee8..4806d5c73 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -70,6 +70,7 @@
async function handleStartAll() {
if (isLoading.starting || !dashboardStates.dockerInfo || stoppedContainers === 0) return;
+ isLoading.starting = true;
handleApiReponse(
await tryCatch(containerApi.startAll()),
`Failed to Start All Containers`,
@@ -77,12 +78,14 @@
async () => {
toast.success(`All Containers Started Successfully.`);
await invalidateAll();
+ isLoading.starting = false;
}
);
}
async function handleStopAll() {
if (isLoading.stopping || !dashboardStates.dockerInfo || runningContainers === 0) return;
+ isLoading.stopping = true;
openConfirmDialog({
title: 'Stop All Containers',
message: 'Are you sure you want to stop all running containers?',
@@ -97,6 +100,7 @@
async () => {
toast.success(`All Containers Stopped Successfully.`);
await invalidateAll();
+ isLoading.stopping = false;
}
);
}
@@ -106,6 +110,7 @@
async function confirmPrune(selectedTypes: string[]) {
if (isLoading.pruning || selectedTypes.length === 0) return;
+ isLoading.pruning = true;
handleApiReponse(
await tryCatch(systemApi.prune(['containers', 'images'])),
`Failed to Prune ${selectedTypes}`,
@@ -115,6 +120,7 @@
const formattedTypes = selectedTypes.map((type) => capitalizeFirstLetter(type)).join(', ');
toast.success(`${formattedTypes} ${selectedTypes.length > 1 ? 'were' : 'was'} pruned successfully.`);
await invalidateAll();
+ isLoading.pruning = false;
}
);
}