Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat(storage): implement confirmation modal for storage deletion

Ahmet Ömerf0b9ed04f709
diff --git a/app/pages/dashboard/settings/storage.vue b/app/pages/dashboard/settings/storage.vue
index e5772a5c..1d307bd0 100644
--- a/app/pages/dashboard/settings/storage.vue
+++ b/app/pages/dashboard/settings/storage.vue
@@ -80,7 +80,7 @@ const availableStorageColumns = computed<TableColumn<SettingStorageProvider>[]>(
icon: 'tabler:trash',
disabled:
currentStorageProvider.value?.value === cell.row.original.id,
- onClick: () => onStorageDelete(cell.row.original.id),
+ onClick: () => openStorageDeleteConfirm(cell.row.original),
},
{ default: () => $t('common.actions.delete') },
),
@@ -336,12 +336,27 @@ const onStorageConfigSubmit = async (
}
}
-const onStorageDelete = async (storageId: number) => {
+const isDeleteConfirmOpen = ref(false)
+const isDeletingStorage = ref(false)
+const storagePendingDelete = ref<SettingStorageProvider | null>(null)
+
+const openStorageDeleteConfirm = (storage: SettingStorageProvider) => {
+ storagePendingDelete.value = storage
+ isDeleteConfirmOpen.value = true
+}
+
+const confirmStorageDelete = async () => {
+ const storageId = storagePendingDelete.value?.id
+ if (storageId == null || isDeletingStorage.value) return
+
+ isDeletingStorage.value = true
try {
await $fetch(`/api/system/settings/storage-config/${storageId}`, {
method: 'DELETE',
})
- refreshAvailableStorage()
+ await refreshAvailableStorage()
+ isDeleteConfirmOpen.value = false
+ storagePendingDelete.value = null
toast.add({
title: $t('settings.storage.messages.deleted'),
color: 'success',
@@ -352,6 +367,8 @@ const onStorageDelete = async (storageId: number) => {
description: (error as Error).message,
color: 'error',
})
+ } finally {
+ isDeletingStorage.value = false
}
}
</script>
@@ -594,6 +611,52 @@ const onStorageDelete = async (storageId: number) => {
</div>
</section>
</div>
+
+ <UModal
+ v-model:open="isDeleteConfirmOpen"
+ :title="$t('settings.storage.deleteModal.title')"
+ :ui="{
+ title: 'flex items-center gap-2',
+ footer: 'justify-end',
+ }"
+ >
+ <template #title>
+ <Icon
+ name="tabler:trash"
+ class="size-5 shrink-0 text-error"
+ />
+ <span>{{ $t('settings.storage.deleteModal.title') }}</span>
+ </template>
+ <template #body>
+ <p class="text-sm leading-relaxed text-neutral-500 dark:text-neutral-400">
+ {{
+ $t('settings.storage.deleteModal.message', {
+ name: storagePendingDelete?.name,
+ })
+ }}
+ </p>
+ </template>
+ <template #footer>
+ <div class="flex w-full justify-end gap-3">
+ <UButton
+ variant="ghost"
+ color="neutral"
+ :disabled="isDeletingStorage"
+ @click="isDeleteConfirmOpen = false"
+ >
+ {{ $t('common.actions.cancel') }}
+ </UButton>
+ <UButton
+ color="error"
+ icon="tabler:trash"
+ :loading="isDeletingStorage"
+ @click="confirmStorageDelete"
+ >
+ {{ $t('common.actions.delete') }}
+ </UButton>
+ </div>
+ </template>
+ </UModal>
</template>
</UDashboardPanel>
</template>
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index 27e5be84..d9a6be10 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -1388,6 +1388,10 @@
"alertTitle": "Note",
"alertDescription": "Files uploaded after changing the storage scheme will be stored in the new scheme. Files already in the original scheme will not be migrated."
},
+ "deleteModal": {
+ "title": "Delete Storage Scheme",
+ "message": "Are you sure you want to delete \"{name}\"? This removes the scheme from ChronoFrame. Files already stored with it are not deleted."
+ },
"slideover": {
"title": "Create Storage Scheme"
},
diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json
index 441e1b7c..974d0652 100644
--- a/i18n/locales/ja.json
+++ b/i18n/locales/ja.json
@@ -1314,6 +1314,10 @@
"alertTitle": "注意",
"alertDescription": "ストレージ構成を変更した後にアップロードされたファイルは新しいストレージ構成に保存されます。元の構成にある既存のファイルは移行されません。"
},
+ "deleteModal": {
+ "title": "ストレージ構成を削除",
+ "message": "「{name}」を削除してもよろしいですか?この構成は ChronoFrame から削除されます。この構成で保存済みのファイルは削除されません。"
+ },
"slideover": {
"title": "ストレージ構成を作成"
},
diff --git a/i18n/locales/ru.json b/i18n/locales/ru.json
index fe0ad581..96a0993d 100644
--- a/i18n/locales/ru.json
+++ b/i18n/locales/ru.json
@@ -1387,6 +1387,10 @@
"alertTitle": "Обратите внимание",
"alertDescription": "Файлы, загруженные после смены схемы, будут сохраняться в новом хранилище. Уже загруженные файлы не будут перенесены из прежнего хранилища."
},
+ "deleteModal": {
+ "title": "Удалить схему хранилища",
+ "message": "Удалить схему «{name}»? Она будет удалена из ChronoFrame. Файлы, уже сохранённые в этой схеме, не будут удалены."
+ },
"slideover": {
"title": "Создание схемы хранилища"
},
diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.json
index 7c9e28dc..1a82e932 100644
--- a/i18n/locales/zh-Hans.json
+++ b/i18n/locales/zh-Hans.json
@@ -1388,6 +1388,10 @@
"alertTitle": "注意",
"alertDescription": "变更存储方案之后上传的文件将会存储到新的存储方案中,原方案中已有文件不会被迁移。"
},
+ "deleteModal": {
+ "title": "删除存储方案",
+ "message": "确定要删除“{name}”吗?这将从 ChronoFrame 中移除该方案。已使用该方案存储的文件不会被删除。"
+ },
"slideover": {
"title": "创建存储方案"
},
diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.json
index 3444f32d..8cdd4f45 100644
--- a/i18n/locales/zh-Hant-HK.json
+++ b/i18n/locales/zh-Hant-HK.json
@@ -1314,6 +1314,10 @@
"alertTitle": "注意",
"alertDescription": "變更儲存方案之後上傳的檔案將會儲存到新的儲存方案中,原方案中已有檔案不會被遷移。"
},
+ "deleteModal": {
+ "title": "刪除儲存方案",
+ "message": "確定要刪除「{name}」嗎?這會從 ChronoFrame 中移除該方案。已使用該方案儲存的檔案不會被刪除。"
+ },
"slideover": {
"title": "建立儲存方案"
},
diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.json
index 9b2d86bd..3c0b57d1 100644
--- a/i18n/locales/zh-Hant-TW.json
+++ b/i18n/locales/zh-Hant-TW.json
@@ -1314,6 +1314,10 @@
"alertTitle": "注意",
"alertDescription": "變更儲存方案之後上傳的檔案將會儲存到新的儲存方案中,原方案中已有檔案不會被遷移。"
},
+ "deleteModal": {
+ "title": "刪除儲存方案",
+ "message": "確定要刪除「{name}」嗎?這會從 ChronoFrame 中移除該方案。已使用該方案儲存的檔案不會被刪除。"
+ },
"slideover": {
"title": "建立儲存方案"
},