From 1962365d8db00dfcf4785a54ca9fe91ce60da820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=99=BB=E5=B1=B1?= Date: Fri, 5 Sep 2025 09:38:09 +0800 Subject: [PATCH] feat : version delete --- components/object/versions.vue | 29 +++++++++++++++++++++++++---- composables/useObject.ts | 24 ++++++++++++------------ i18n/locales/en-US.json | 1 + i18n/locales/tr-TR.json | 1 + i18n/locales/zh-CN.json | 1 + 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/components/object/versions.vue b/components/object/versions.vue index aebfa83..ba38724 100644 --- a/components/object/versions.vue +++ b/components/object/versions.vue @@ -13,7 +13,6 @@ diff --git a/composables/useObject.ts b/composables/useObject.ts index 507ce43..c65adc5 100644 --- a/composables/useObject.ts +++ b/composables/useObject.ts @@ -46,20 +46,24 @@ export function useObject({ bucket, region }: { bucket: string; region?: string return await $client.send(new PutObjectCommand(params)); }; - const deleteObject = async (key: string) => { - const params = { + const deleteObject = async (key: string, versionId?: string) => { + const params: { + Bucket: string; + Key: string; + VersionId?: string; + } = { Bucket: bucket, Key: key, }; + if (versionId) { + params.VersionId = versionId; + } + return await $client.send(new DeleteObjectCommand(params)); }; - const listObject = async ( - bucket: string, - prefix: string | undefined = undefined, - pageSize: number = 25 - ) => { + const listObject = async (bucket: string, prefix: string | undefined = undefined, pageSize: number = 25) => { const params = { Bucket: bucket, Prefix: prefix, @@ -70,11 +74,7 @@ export function useObject({ bucket, region }: { bucket: string; region?: string return await $client.send(new ListObjectsV2Command(params)); }; - async function mapAllFiles( - bucketName: string, - prefix: string, - callback: (fileKey: string) => void - ) { + async function mapAllFiles(bucketName: string, prefix: string, callback: (fileKey: string) => void) { let isTruncated = true; let continuationToken: string | undefined = undefined; diff --git a/i18n/locales/en-US.json b/i18n/locales/en-US.json index f839652..10d3e91 100644 --- a/i18n/locales/en-US.json +++ b/i18n/locales/en-US.json @@ -566,6 +566,7 @@ "Collecting files": "Collecting files...", "Downloading files": "Downloading files...", "Download ready": "Download ready", + "Download Failed": "Download Failed", "Please enter Access Key": "Please enter Access Key", "Access Key length must be between 3 and 20 characters": "Access Key length must be between 3 and 20 characters", "Please enter Secret Key": "Please enter Secret Key", diff --git a/i18n/locales/tr-TR.json b/i18n/locales/tr-TR.json index 88634c8..4e11490 100644 --- a/i18n/locales/tr-TR.json +++ b/i18n/locales/tr-TR.json @@ -570,6 +570,7 @@ "Collecting files": "Dosyalar toplanıyor...", "Downloading files": "Dosyalar indiriliyor...", "Download ready": "İndirme hazır", + "Download failed": "İndirme başarısız", "Please enter Access Key": "Lütfen Erişim Anahtarını girin", "Access Key length must be between 3 and 20 characters": "Erişim Anahtarı uzunluğu 3 ile 20 karakter arasında olmalıdır", "Please enter Secret Key": "Lütfen Gizli Anahtarı girin", diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index 6c73396..444432d 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -653,6 +653,7 @@ "Collecting files": "正在收集文件...", "Downloading files": "正在下载文件...", "Download ready": "下载准备就绪", + "Download Failed": "下载失败", "Access Key length must be between 3 and 20 characters": "访问密钥长度必须为3到20个字符", "Secret Key length must be between 8 and 40 characters": "密钥长度必须为8到40个字符", "Please select encryption type": "请选择加密类型",