From 3d63a192bf6844edaa69cff9b89841348b6166ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=99=BB=E5=B1=B1?= Date: Mon, 14 Jul 2025 16:35:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat=EF=BC=9A=20=20pause=20and=20=20resume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/object/list.vue | 140 +++++++++++++---------- components/object/task-stats.vue | 88 +++++++++------ components/object/upload/picker.vue | 147 +++++++++++++++---------- components/object/upload/task/item.vue | 39 +++++-- components/object/upload/task/list.vue | 10 +- dist 2 | 0 i18n/locales/en-US.json | 15 ++- i18n/locales/zh-CN.json | 7 +- lib/upload-task-manager.ts | 125 +++++++++++++++------ store/upload-tasks.ts | 40 ++++--- 10 files changed, 397 insertions(+), 214 deletions(-) create mode 100644 dist 2 diff --git a/components/object/list.vue b/components/object/list.vue index 85c9047..66ccacb 100644 --- a/components/object/list.vue +++ b/components/object/list.vue @@ -15,25 +15,25 @@ - {{ t("New Folder") }} + {{ t('New Folder') }} - {{ t("New File") }} + {{ t('New File') }} - {{ t("Upload File") + "/" + t("Folder") }} + {{ t('Upload File') + '/' + t('Folder') }} - {{ t("Delete Selected") }} + {{ t('Delete Selected') }} - {{ t("Refresh") }} + {{ t('Refresh') }} @@ -45,35 +45,38 @@ :row-key="rowKey" @update:checked-row-keys="handleCheck" :pagination="false" - :bordered="false" /> + :bordered="false" + /> + :prefix="prefix" + /> + :prefix="prefix" + /> - {{ t("Previous Page") }} + {{ t('Previous Page') }} - {{ t("Next Page") }} + {{ t('Next Page') }} @@ -83,16 +86,16 @@ diff --git a/components/object/upload/picker.vue b/components/object/upload/picker.vue index c3962e6..4c20466 100644 --- a/components/object/upload/picker.vue +++ b/components/object/upload/picker.vue @@ -2,7 +2,7 @@ diff --git a/components/users/user/policies.vue b/components/users/user/policies.vue index 1eb48de..cb6c75c 100644 --- a/components/users/user/policies.vue +++ b/components/users/user/policies.vue @@ -119,11 +119,11 @@ const changeMebers = async () => { userOrGroup: encodeURIComponent(props.user.accessKey), isGroup: false, }); - messge.success('修改成功'); + messge.success(t('Edit Success')); editStatus.value = false; emit('search'); } catch { - messge.error('修改失败'); + messge.error(t('Edit Failed')); } }; diff --git a/i18n/locales/en-US.json b/i18n/locales/en-US.json index b132de7..d696c8f 100644 --- a/i18n/locales/en-US.json +++ b/i18n/locales/en-US.json @@ -548,5 +548,7 @@ "Description": "Description", "Are you sure you want to delete all selected keys?": "Are you sure you want to delete all selected keys?", "Please select at least one item": "Please select at least one item", - "Get Data Failed": "Get Data Failed" + "Get Data Failed": "Get Data Failed", + "New user has been created": "New user has been created", + "Export": "Export" } diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index 84e1be7..50afb42 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -410,6 +410,8 @@ "Storage Class": "存储类型", "Version ID": "版本ID", "Submit Data": "提交数据", + "New user has been created": "新用户已创建", + "Export": "导出", "Get Version Control Status Failed": "获取版本控制状态失败", "The XML format you provided is incorrect, or has not been validated against our published schema. (MasterKeyID not found aws:kms).": "您提供的XML格式不正确,或者未根据我们发布的架构进行验证。(未找到MasterKeyID aws:kms)。", "Server-side encryption is specified, but S3 is not configured.": "指定了服务器端加密,但S3未配置。", From 1e482bd883b2edb80ce11c4d326c6d154755b5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=99=BB=E5=B1=B1?= Date: Mon, 14 Jul 2025 18:16:48 +0800 Subject: [PATCH 3/3] fix: i18n --- components/buckets/info.vue | 297 +++++++++++------- components/lifecycle/new-form.vue | 172 +++++----- components/object/list.vue | 4 +- components/users/group/members.vue | 90 +++--- components/users/group/new.vue | 81 ++--- components/users/group/policies.vue | 115 ++++--- .../users/group/set-policies-mutiple.vue | 121 +++---- components/users/user/policies.vue | 2 +- i18n/locales/en-US.json | 4 +- i18n/locales/zh-CN.json | 10 +- lib/api-client.ts | 45 +-- 11 files changed, 520 insertions(+), 421 deletions(-) diff --git a/components/buckets/info.vue b/components/buckets/info.vue index d1b952c..f105792 100644 --- a/components/buckets/info.vue +++ b/components/buckets/info.vue @@ -1,25 +1,25 @@ diff --git a/components/users/user/policies.vue b/components/users/user/policies.vue index cb6c75c..9cec36f 100644 --- a/components/users/user/policies.vue +++ b/components/users/user/policies.vue @@ -24,7 +24,7 @@ - 提交 + {{ t('Submit') }} diff --git a/i18n/locales/en-US.json b/i18n/locales/en-US.json index d696c8f..965918e 100644 --- a/i18n/locales/en-US.json +++ b/i18n/locales/en-US.json @@ -550,5 +550,7 @@ "Please select at least one item": "Please select at least one item", "Get Data Failed": "Get Data Failed", "New user has been created": "New user has been created", - "Export": "Export" + "Export": "Export", + "Login expired, please login again": "Login expired, please login again", + "Batch allocation policies": "Batch allocation policies" } diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index 50afb42..022b9bd 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -27,8 +27,8 @@ "Name": "名称", "Search": "搜索", "Edit": "编辑", - "Edit Success": "编辑成功", - "Edit Failed": "编辑失败", + "Edit Success": "修改成功", + "Edit Failed": "修改失败", "Add Success": "添加成功", "Add Failed": "添加失败", "Delete Failed": "删除失败", @@ -638,5 +638,9 @@ "Search Policy": "搜索策略", "Bucket Configuration": "桶配置", "Adding to Upload Queue": "添加到上传队列", - "Adding to Delete Queue": "添加到删除队列" + "Adding to Delete Queue": "添加到删除队列", + "Login expired, please login again": "登录信息已过期,请重新登录", + "Batch allocation policies": "批量分配策略", + "Add group members": "添加组成员", + "Search User Group": "搜索用户组" } diff --git a/lib/api-client.ts b/lib/api-client.ts index 46fe493..2f65769 100644 --- a/lib/api-client.ts +++ b/lib/api-client.ts @@ -1,7 +1,7 @@ -import { joinURL } from "ufo"; -import { parseApiError } from "~/utils/error-handler"; -import { logger } from "~/utils/logger"; -import type { AwsClient } from "./aws4fetch"; +import { joinURL } from 'ufo'; +import { parseApiError } from '~/utils/error-handler'; +import { logger } from '~/utils/logger'; +import type { AwsClient } from './aws4fetch'; interface ApiClientOptions { baseUrl?: string; @@ -36,12 +36,12 @@ class ApiClient { delete options.params; // 删除params,以免影响fetch的options } - logger.log("[request] url:", url); - logger.log("[request] options:", options); + logger.log('[request] url:', url); + logger.log('[request] options:', options); const response = await this.$api.fetch(url, options); - logger.log("[request] response:", response); + logger.log('[request] response:', response); if (!response.ok) { const errorMsg = await parseApiError(response); @@ -51,15 +51,18 @@ class ApiClient { // 处理401 if (response.status === 401) { const message = useMessage(); - message.error("登录信息已过期,请重新登录"); // 清除登录信息 await useAuth().logout(); - window.location.href = "/auth/login"; + window.location.href = '/auth/login'; return; } // 204 or body length is 0 - if (response.status === 204 || response.headers.get("content-length") === "0" || !response.body) { + if ( + response.status === 204 || + response.headers.get('content-length') === '0' || + !response.body + ) { return null; } @@ -74,11 +77,11 @@ class ApiClient { const response = await this.request(url, options, false); if (!response.body) { - throw new Error("No response body"); + throw new Error('No response body'); } const reader = response.body.getReader(); - const decoder = new TextDecoder("utf-8"); + const decoder = new TextDecoder('utf-8'); while (true) { const { done, value } = await reader.read(); @@ -88,40 +91,40 @@ class ApiClient { const data = JSON.parse(chunk); yield data; // 使用 yield 返回数据 } catch (error) { - logger.error("Failed to parse chunk:", error); + logger.error('Failed to parse chunk:', error); } } } async get(url: string, options?: RequestOptions) { - return this.request(url, { method: "GET", ...options }); + return this.request(url, { method: 'GET', ...options }); } async post(url: string, body: any, options?: RequestOptions) { - return this.request(url, { method: "POST", body, ...options }); + return this.request(url, { method: 'POST', body, ...options }); } async delete(url: string, options?: RequestOptions) { - return this.request(url, { method: "DELETE", ...options }); + return this.request(url, { method: 'DELETE', ...options }); } async put(url: string, body: any, options?: RequestOptions) { - return this.request(url, { method: "PUT", body, ...options }); + return this.request(url, { method: 'PUT', body, ...options }); } async patch(url: string, body: any, options?: RequestOptions) { - return this.request(url, { method: "PATCH", body, ...options }); + return this.request(url, { method: 'PATCH', body, ...options }); } async head(url: string, options?: RequestOptions) { - return this.request(url, { method: "HEAD", ...options }); + return this.request(url, { method: 'HEAD', ...options }); } async options(url: string, options?: RequestOptions) { - return this.request(url, { method: "OPTIONS", ...options }); + return this.request(url, { method: 'OPTIONS', ...options }); } async trace(url: string, options?: RequestOptions) { - return this.request(url, { method: "TRACE", ...options }); + return this.request(url, { method: 'TRACE', ...options }); } }