fix: add confirmation dialog for Docker image prune button

This commit is contained in:
2026-04-05 14:20:49 +03:00
parent 21ffef2ee2
commit 0ddad87a9a
3 changed files with 15 additions and 1 deletions
+13 -1
View File
@@ -2,6 +2,7 @@
import { getSettings, updateSettings, getWebhookUrl, regenerateWebhookUrl, testDnsConnection, listDnsZones, pruneImages } from '$lib/api';
import type { EntityPickerItem } from '$lib/types';
import FormField from '$lib/components/FormField.svelte';
import ConfirmDialog from '$lib/components/ConfirmDialog.svelte';
import EntityPicker from '$lib/components/EntityPicker.svelte';
import { toasts } from '$lib/stores/toast';
import { t } from '$lib/i18n';
@@ -40,6 +41,7 @@
let testingDns = $state(false);
let pruning = $state(false);
let showPruneConfirm = $state(false);
let errors = $state<Record<string, string>>({});
async function handlePruneImages() {
@@ -363,7 +365,7 @@
<p class="mb-3 text-xs text-[var(--text-tertiary)]">{$t('settings.dockerCleanupHelp')}</p>
<button
type="button"
onclick={handlePruneImages}
onclick={() => { showPruneConfirm = true; }}
disabled={pruning}
class="inline-flex items-center gap-2 rounded-lg border border-[var(--color-danger)] px-4 py-2 text-sm font-medium text-[var(--color-danger)] hover:bg-[var(--color-danger)] hover:text-white disabled:opacity-50 transition-colors"
>
@@ -517,3 +519,13 @@
onselect={handleZoneSelect}
onclose={() => { zonePickerOpen = false; }}
/>
<ConfirmDialog
open={showPruneConfirm}
title={$t('settings.pruneImages')}
message={$t('settings.pruneConfirmMessage')}
confirmLabel={$t('settings.pruneImages')}
confirmVariant="danger"
onconfirm={() => { showPruneConfirm = false; handlePruneImages(); }}
oncancel={() => { showPruneConfirm = false; }}
/>