From cda2963e1c64518487f0a1ccd6824ca04c697af2 Mon Sep 17 00:00:00 2001 From: "meilin.huang" <954537473@qq.com> Date: Sat, 23 Nov 2024 17:23:18 +0800 Subject: [PATCH] fix: i18n & other optimizations --- frontend/src/hooks/useI18n.ts | 2 +- frontend/src/i18n/en/common.ts | 3 +- frontend/src/i18n/en/db.ts | 15 ++ frontend/src/i18n/zh-cn/common.ts | 3 +- frontend/src/i18n/zh-cn/db.ts | 15 ++ frontend/src/views/ops/db/InstanceList.vue | 2 +- .../ops/db/component/table/DbTableData.vue | 94 +++++----- .../ops/db/component/table/DbTableOp.vue | 78 +++++---- .../src/views/ops/machine/MachineEdit.vue | 2 +- .../views/ops/machine/file/MachineFile.vue | 40 ++--- frontend/src/views/ops/mongo/MongoDbs.vue | 4 +- server/internal/common/consts/consts.go | 8 +- server/internal/db/api/dashbord.go | 2 +- server/internal/db/api/db.go | 9 +- server/internal/db/api/db_instance.go | 14 +- server/internal/db/application/db.go | 10 +- server/internal/db/application/db_instance.go | 12 +- server/internal/machine/api/dashbord.go | 4 +- server/internal/machine/api/machine.go | 12 +- .../machine/application/machine_cronjob.go | 2 +- server/internal/machine/imsg/en.go | 4 +- server/internal/machine/imsg/imsg.go | 4 + server/internal/machine/imsg/zh_cn.go | 4 +- .../machine/router/machine_cmd_conf.go | 5 +- server/internal/mongo/api/dashbord.go | 6 +- server/internal/mongo/api/mongo.go | 9 +- server/internal/redis/api/dashbord.go | 6 +- server/internal/redis/api/redis.go | 9 +- server/internal/tag/api/tag_tree.go | 30 +++- server/internal/tag/api/vo/tag_tree.go | 2 +- .../internal/tag/application/dto/tag_tree.go | 31 +++- .../tag/application/resouce_auth_cert.go | 2 +- server/internal/tag/application/tag_tree.go | 56 ++---- .../tag/application/tag_tree_relate.go | 2 +- server/internal/tag/domain/entity/query.go | 2 - server/internal/tag/domain/entity/tag_tree.go | 165 +++++++++--------- .../tag/domain/entity/tag_tree_test.go | 45 +++-- .../infrastructure/persistence/tag_tree.go | 2 - server/pkg/utils/collx/array.go | 5 + server/pkg/ws/client_manager.go | 4 +- 40 files changed, 400 insertions(+), 324 deletions(-) diff --git a/frontend/src/hooks/useI18n.ts b/frontend/src/hooks/useI18n.ts index d95c2790..0ea2c95f 100644 --- a/frontend/src/hooks/useI18n.ts +++ b/frontend/src/hooks/useI18n.ts @@ -27,7 +27,7 @@ export function useI18nPleaseSelect(labelI18nKey: string) { * @returns */ export async function useI18nDeleteConfirm(name: string = '') { - return useI18nConfirm('common.deleteConfirm', { name }); + return useI18nConfirm('common.deleteConfirm2', { name }); } /** diff --git a/frontend/src/i18n/en/common.ts b/frontend/src/i18n/en/common.ts index 8ce26ab2..551e91fc 100644 --- a/frontend/src/i18n/en/common.ts +++ b/frontend/src/i18n/en/common.ts @@ -51,7 +51,8 @@ export default { createTitle: 'Create {name}', editTitle: 'Edit {name}', detailTitle: '{name} Details', - deleteConfirm: 'This operation will delete [{name}]. Do you want to continue?', + deleteConfirm: 'Sure to delete?', + deleteConfirm2: 'This operation will delete [{name}]. Do you want to continue?', saveSuccess: 'save successfully', deleteSuccess: 'delete successfully', operateSuccess: 'operate successfully', diff --git a/frontend/src/i18n/en/db.ts b/frontend/src/i18n/en/db.ts index 4e374fd0..4cc80780 100644 --- a/frontend/src/i18n/en/db.ts +++ b/frontend/src/i18n/en/db.ts @@ -73,6 +73,21 @@ export default { newTabRunSql: 'NewTab Run SQL', formatSql: 'Format SQL', + alias: 'Alias', + tableName: 'Name', + addColumn: 'Add Column', + addDefaultColumn: 'Add Default Column', + addIndex: 'Add Index', + length: 'Length', + numScale: 'Scale', + defaultValue: 'Default Value', + notNull: 'Not Null', + primaryKey: 'Pri', + autoIncrement: 'Auto Incr', + unique: 'Unique', + uniqueIndex: 'Unique Index', + normalIndex: 'Normal Index', + execTime: 'execution time', oneClickCopy: 'One click copy', asc: 'Asc', diff --git a/frontend/src/i18n/zh-cn/common.ts b/frontend/src/i18n/zh-cn/common.ts index 5ed88fc3..008c9398 100644 --- a/frontend/src/i18n/zh-cn/common.ts +++ b/frontend/src/i18n/zh-cn/common.ts @@ -51,7 +51,8 @@ export default { createTitle: '创建{name}', editTitle: '编辑{name}', detailTitle: '{name}详情', - deleteConfirm: '此操作将删除【{name}】, 是否继续?', + deleteConfirm: '确定删除?', + deleteConfirm2: '此操作将删除【{name}】, 是否继续?', saveSuccess: '保存成功', deleteSuccess: '删除成功', operateSuccess: '操作成功', diff --git a/frontend/src/i18n/zh-cn/db.ts b/frontend/src/i18n/zh-cn/db.ts index 0b8831ea..13ae769d 100644 --- a/frontend/src/i18n/zh-cn/db.ts +++ b/frontend/src/i18n/zh-cn/db.ts @@ -72,6 +72,21 @@ export default { newTabRunSql: '新标签执行SQL', formatSql: '格式化SQL', + alias: '别名', + tableName: '表名', + addColumn: '添加列', + addDefaultColumn: '添加默认列', + addIndex: '添加索引', + length: '长度', + numScale: '精度', + defaultValue: '默认值', + notNull: '非空', + primaryKey: '主键', + autoIncrement: '自增', + unique: '唯一', + uniqueIndex: '唯一索引', + normalIndex: '普通索引', + execTime: '执行时间', oneClickCopy: '一键复制', asc: '升序', diff --git a/frontend/src/views/ops/db/InstanceList.vue b/frontend/src/views/ops/db/InstanceList.vue index 553bf669..be64348e 100644 --- a/frontend/src/views/ops/db/InstanceList.vue +++ b/frontend/src/views/ops/db/InstanceList.vue @@ -112,7 +112,7 @@ const perms = { const searchItems = [ SearchItem.input('keyword', 'common.keyword').withPlaceholder('db.keywordPlaceholder'), - getTagPathSearchItem(TagResourceTypeEnum.Db.value), + getTagPathSearchItem(TagResourceTypeEnum.DbAuthCert.value), ]; const columns = ref([ diff --git a/frontend/src/views/ops/db/component/table/DbTableData.vue b/frontend/src/views/ops/db/component/table/DbTableData.vue index f71ce316..8cfa8ebf 100644 --- a/frontend/src/views/ops/db/component/table/DbTableData.vue +++ b/frontend/src/views/ops/db/component/table/DbTableData.vue @@ -155,7 +155,7 @@