From c4c30c8fca2ca1561a1859d29a4a2f968b244650 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Thu, 3 Sep 2026 13:25:58 +0200 Subject: [PATCH] ui : confirm before cancelling model downloads Cancelling stops the download and discards the partial files, so the selector item and the download chip both ask for confirmation first. Assisted-by: pi:zai-org/GLM-5.3 --- .../models/ModelsSelectorDownloadItem.svelte | 21 +++++- ...sDownloadOptionsQuantDownloadButton.svelte | 68 ++++++++++++------- 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/tools/ui/src/lib/components/app/models/ModelsSelectorDownloadItem.svelte b/tools/ui/src/lib/components/app/models/ModelsSelectorDownloadItem.svelte index bdb010d644..6a31787829 100644 --- a/tools/ui/src/lib/components/app/models/ModelsSelectorDownloadItem.svelte +++ b/tools/ui/src/lib/components/app/models/ModelsSelectorDownloadItem.svelte @@ -3,6 +3,7 @@ import ModelsDiscoverAvatar from './discover/ModelsDiscoverAvatar.svelte'; import { Loader2, Pause, Play, X } from '@lucide/svelte'; import { ModelId } from '$lib/components/app'; + import DialogConfirmation from '$lib/components/app/dialogs/DialogConfirmation.svelte'; import { HuggingFaceService, ModelsService } from '$lib/services'; import { modelsStore } from '$lib/stores'; import type { ModelDownloadProgress } from '$lib/types'; @@ -14,6 +15,9 @@ let { entry }: Props = $props(); + // cancel confirmation state + let confirmCancelOpen = $state(false); + let percent = $derived( entry.progress && entry.progress.totalBytes > 0 ? Math.round((entry.progress.downloadedBytes / entry.progress.totalBytes) * 100) @@ -101,7 +105,7 @@ @@ -187,14 +182,18 @@ - + + @@ -202,7 +201,15 @@

Cancel downloading

- + + {#if percent !== null} + + {/if} + {:else} @@ -254,3 +261,18 @@ {/if} + + (confirmCancelOpen = false)} + onConfirm={() => { + confirmCancelOpen = false; + + void modelsStore.status.cancelDownload(entry.repoWithTag); + }} + open={confirmCancelOpen} + title="Cancel download" + variant="destructive" +/>