From 3e23aaa894fc8d8a0870c870f45c5f0aaaa35a68 Mon Sep 17 00:00:00 2001 From: sealday Date: Fri, 15 Mar 2024 18:47:48 +0800 Subject: [PATCH 1/4] chore: clean auditlogs codes --- .../plugin-audit-logs/src/client/AuditLogsBlockProvider.tsx | 1 - .../plugin-audit-logs/src/client/deplicated/AuditLogs.tsx | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/plugins/@hera/plugin-audit-logs/src/client/AuditLogsBlockProvider.tsx b/packages/plugins/@hera/plugin-audit-logs/src/client/AuditLogsBlockProvider.tsx index 0beebedb4..360e2a1bb 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/client/AuditLogsBlockProvider.tsx +++ b/packages/plugins/@hera/plugin-audit-logs/src/client/AuditLogsBlockProvider.tsx @@ -6,7 +6,6 @@ export const AuditLogsBlockProvider: React.FC = ({ children, ...restProps }) => const auditChangesCollection = useAuditChangesCollection(); const auditLogsCollection = useAuditLogsCollection(); const collectionsCollection = useCollectionsCollection(); - console.log('audit logs blocks'); return ( diff --git a/packages/plugins/@hera/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx b/packages/plugins/@hera/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx index c0156381d..8840e885d 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx +++ b/packages/plugins/@hera/plugin-audit-logs/src/client/deplicated/AuditLogs.tsx @@ -144,7 +144,6 @@ export const AuditLogs: any = () => { type: 'void', title: tval('Filter'), 'x-action': 'filter', - // 'x-designer': 'Filter.Action.Designer', 'x-component': 'Filter.Action', 'x-component-props': { icon: 'FilterOutlined', @@ -184,8 +183,7 @@ export const AuditLogs: any = () => { properties: { o80rypwmeeg: { type: 'void', - title: '{{ t("View") }}', - // 'x-designer': 'Action.Designer', + title: tval('View'), 'x-toolbar': 'ActionSchemaToolbar', 'x-settings': 'actionSettings:view', 'x-component': 'Action.Link', @@ -195,7 +193,7 @@ export const AuditLogs: any = () => { properties: { drawer: { type: 'void', - title: '{{ t("View record") }}', + title: tval('View record'), 'x-component': 'Action.Container', 'x-component-props': { className: 'nb-action-popup', From ece1e59c9ae0d9d6e0e787e14f7ce6ca72b5a1f3 Mon Sep 17 00:00:00 2001 From: sealday Date: Fri, 15 Mar 2024 18:58:29 +0800 Subject: [PATCH 2/4] chore: clean codes --- .../AuditLogsTableColumnInitializers.tsx | 3 ++- .../@hera/plugin-audit-logs/src/client/utils.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/plugins/@hera/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx b/packages/plugins/@hera/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx index 79894126b..1837c67be 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx +++ b/packages/plugins/@hera/plugin-audit-logs/src/client/initializers/AuditLogsTableColumnInitializers.tsx @@ -55,8 +55,9 @@ export const auditLogsTableColumnInitializers = new SchemaInitializer({ } return { type: 'void', + 'x-toolbar': 'TableColumnSchemaToolbar', + 'x-settings': 'fieldSettings:TableColumn', 'x-decorator': 'TableV2.Column.Decorator', - 'x-designer': 'TableV2.Column.Designer', 'x-component': 'TableV2.Column', properties: { [s.name]: { diff --git a/packages/plugins/@hera/plugin-audit-logs/src/client/utils.ts b/packages/plugins/@hera/plugin-audit-logs/src/client/utils.ts index 5bca8b711..6b72b1c9b 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/client/utils.ts +++ b/packages/plugins/@hera/plugin-audit-logs/src/client/utils.ts @@ -158,9 +158,9 @@ export const createSchema = () => { 'x-component': 'Select', 'x-read-pretty': true, enum: [ - { label: "{{ t('Add new') }}", value: 'create', color: 'green' }, - { label: "{{ t('Update') }}", value: 'update', color: 'blue' }, - { label: "{{ t('Delete') }}", value: 'destroy', color: 'red' }, + { label: tval('Add new'), value: 'create', color: 'green' }, + { label: tval('Update'), value: 'update', color: 'blue' }, + { label: tval('Delete'), value: 'destroy', color: 'red' }, ], }, }, @@ -175,7 +175,7 @@ export const createSchema = () => { }, properties: { [uid()]: { - title: '{{ t("View") }}', + title: tval('View'), type: 'void', 'x-action': 'view', 'x-component': 'Action.Link', @@ -189,7 +189,7 @@ export const createSchema = () => { 'x-component-props': { className: 'nb-action-popup', }, - title: '{{ t("View record") }}', + title: tval('View record'), properties: { created_at: { type: 'string', @@ -266,7 +266,7 @@ export const createSchema = () => { column2: { type: 'void', 'x-component': 'Table.Column', - 'x-component-props': { title: "{{ t('Before change') }}" }, + 'x-component-props': { title: tval('Before change') }, properties: { before: { type: 'string', @@ -278,7 +278,7 @@ export const createSchema = () => { column3: { type: 'void', 'x-component': 'Table.Column', - 'x-component-props': { title: "{{ t('After change') }}" }, + 'x-component-props': { title: tval('After change') }, properties: { after: { type: 'string', From ebd35abeb088a9bf13792ae5cb26b8569e9b6a03 Mon Sep 17 00:00:00 2001 From: sealday Date: Fri, 15 Mar 2024 19:15:05 +0800 Subject: [PATCH 3/4] chore: update i18n --- .../plugin-audit-logs/src/locale/en-US.json | 41 +++++++++++++++++- .../plugin-audit-logs/src/locale/zh-CN.json | 43 ++++++++++++++++++- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json b/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json index 3dc09f65a..0163236a7 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json +++ b/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json @@ -1,4 +1,43 @@ { + "Action column": "Action column", + "Action type": "Action type", + "Actions": "Actions", + "Add new": "Add new", + "After change": "After change", + "Audit Changes": "Audit Changes", + "Audit Logs": "Audit Logs", + "Audit logs": "Audit logs", + "Before change": "Before change", + "Cancel": "Cancel", + "Collection display name": "Collection display name", + "Collection name": "Collection name", + "Collection": "Collection", + "Collections": "Collections", + "Column width": "Column width", + "Configure actions": "Configure actions", + "Configure columns": "Configure columns", + "Create record": "Create record", + "Created at": "Created at", + "Created by": "Created by", + "Data changes": "Data changes", + "Delete record": "Delete record", + "Delete": "Delete", "Details of changes": "Details of changes", - "Create record": "Create record" + "Details": "Details", + "Display fields": "Display fields", + "Enable actions": "Enable actions", + "Field display name": "Field display name", + "Field value changes": "Field value changes", + "Field": "Field", + "Filter": "Filter", + "Insert": "Insert", + "Record ID": "Record ID", + "Records per page": "Records per page", + "Refresh": "Refresh", + "Submit": "Submit", + "Update record": "Update record", + "Update": "Update", + "User": "User", + "View record": "View record", + "View": "View" } diff --git a/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json b/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json index 783f355b5..006b91b19 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json +++ b/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json @@ -1,4 +1,43 @@ { - "Details of changes": "变更详情", - "Create record": "创建数据" + "Action column": "操作列", + "Action type": "操作类型", + "Actions": "操作", + "Add new": "添加", + "After change": "变化后", + "Audit Changes": "审计变化", + "Audit Logs": "审计日志", + "Audit logs": "审计日志", + "Before change": "变化前", + "Cancel": "取消", + "Collection display name": "数据集显示名称", + "Collection name": "数据集名称", + "Collection": "数据集", + "Collections": "数据集", + "Column width": "列宽", + "Configure actions": "操作配置", + "Configure columns": "列配置", + "Create record": "新增数据", + "Created at": "创建于", + "Created by": "由创建", + "Data changes": "数据变化", + "Delete record": "删除数据", + "Delete": "删除", + "Details of changes": "变化详情", + "Details": "详情", + "Display fields": "显示字段", + "Enable actions": "启用的操作", + "Field display name": "字段显示名称", + "Field value changes": "字段值变化", + "Field": "字段", + "Filter": "过滤", + "Insert": "插入", + "Record ID": "数据 ID", + "Records per page": "每页数据", + "Refresh": "刷新", + "Submit": "提交", + "Update record": "编辑数据", + "Update": "编辑", + "User": "用户", + "View record": "查看数据", + "View": "查看" } From e5038e2e9617c1dea978a287b677437e602e8895 Mon Sep 17 00:00:00 2001 From: sealday Date: Fri, 15 Mar 2024 19:19:32 +0800 Subject: [PATCH 4/4] fix: i18n --- .../plugins/@hera/plugin-audit-logs/src/client/locale/index.ts | 2 +- packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json | 1 + packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/plugins/@hera/plugin-audit-logs/src/client/locale/index.ts b/packages/plugins/@hera/plugin-audit-logs/src/client/locale/index.ts index 799a97370..03f966a1a 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/client/locale/index.ts +++ b/packages/plugins/@hera/plugin-audit-logs/src/client/locale/index.ts @@ -1,7 +1,7 @@ import { i18n, tval as nTval } from '@nocobase/client'; import { useTranslation } from 'react-i18next'; -export const NAMESPACE = 'audit-logs'; +export const NAMESPACE = '@hera/plugin-audit-logs'; export function lang(key: string) { return i18n.t(key, { ns: NAMESPACE }); diff --git a/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json b/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json index 0163236a7..52ab661de 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json +++ b/packages/plugins/@hera/plugin-audit-logs/src/locale/en-US.json @@ -25,6 +25,7 @@ "Details of changes": "Details of changes", "Details": "Details", "Display fields": "Display fields", + "Display association fields": "Display association fields", "Enable actions": "Enable actions", "Field display name": "Field display name", "Field value changes": "Field value changes", diff --git a/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json b/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json index 006b91b19..73aa73b72 100644 --- a/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json +++ b/packages/plugins/@hera/plugin-audit-logs/src/locale/zh-CN.json @@ -24,6 +24,7 @@ "Delete": "删除", "Details of changes": "变化详情", "Details": "详情", + "Display association fields": "显示关联字段", "Display fields": "显示字段", "Enable actions": "启用的操作", "Field display name": "字段显示名称",