fix: add confirmation dialog for Docker image prune button
This commit is contained in:
@@ -260,6 +260,7 @@
|
||||
"pruneImages": "Prune Unused Images",
|
||||
"pruning": "Pruning...",
|
||||
"pruneResult": "Removed {count} images, reclaimed {mb} MB",
|
||||
"pruneConfirmMessage": "This will remove unused Docker images belonging to your projects. Images used by active instances will not be affected.",
|
||||
"pruneFailed": "Failed to prune images",
|
||||
"proxyProvider": "Proxy Provider",
|
||||
"proxyProviderHelp": "Select how reverse proxy routes are managed for deployed containers.",
|
||||
|
||||
@@ -260,6 +260,7 @@
|
||||
"pruneImages": "Очистить неиспользуемые образы",
|
||||
"pruning": "Очистка...",
|
||||
"pruneResult": "Удалено {count} образов, освобождено {mb} МБ",
|
||||
"pruneConfirmMessage": "Будут удалены неиспользуемые Docker-образы ваших проектов. Образы активных экземпляров не затрагиваются.",
|
||||
"pruneFailed": "Не удалось очистить образы",
|
||||
"proxyProvider": "Провайдер прокси",
|
||||
"proxyProviderHelp": "Выберите способ управления обратным прокси для развёрнутых контейнеров.",
|
||||
|
||||
@@ -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; }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user