From 9d0602ea2340665e3fb23a03ac837d7227f99dd3 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 5 Sep 2024 20:46:26 +0800 Subject: [PATCH] refactor: batch updated and batch edit, change 'All' to 'Entire collection" (#5200) * refactor: batch updated and batch edit, change 'All' to 'Entire collection' * fix: test --- .../src/client/BulkEditAction.Settings.tsx | 2 +- .../src/client/__e2e__/schemaSettings.test.ts | 2 +- .../@nocobase/plugin-action-bulk-edit/src/locale/zh-CN.json | 3 ++- .../src/client/BulkUpdateAction.Settings.tsx | 2 +- .../src/client/__e2e__/schemaSettings.test.ts | 2 +- .../@nocobase/plugin-action-bulk-update/src/locale/zh-CN.ts | 1 + 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditAction.Settings.tsx b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditAction.Settings.tsx index bdc89e6785..7b2ae0069e 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditAction.Settings.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/BulkEditAction.Settings.tsx @@ -33,7 +33,7 @@ function UpdateMode() { title={t('Data will be updated')} options={[ { label: t('Selected'), value: 'selected' }, - { label: t('All'), value: 'all' }, + { label: t('Entire collection', { ns: 'action-bulk-edit' }), value: 'all' }, ]} value={fieldSchema?.['x-action-settings']?.['updateMode']} onChange={(value) => { diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts index 2b39281840..7b1816f287 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/client/__e2e__/schemaSettings.test.ts @@ -21,7 +21,7 @@ test.describe('bulk edit action setting', () => { await expect(page.getByTitle('Data will be updated').getByText('Selected')).toBeVisible(); await page.getByRole('menuitem', { name: 'Data will be updated' }).click(); //切换为全部数据 - await page.getByRole('option', { name: 'All' }).click(); + await page.getByRole('option', { name: 'Entire collection' }).click(); //配置更新规则 await page.getByLabel('Bulk edit').click(); await page.getByLabel('schema-initializer-Grid-popup:bulkEdit:addBlock-general').hover(); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/locale/zh-CN.json index f9e8775f39..05ba2d2124 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/src/locale/zh-CN.json @@ -1,4 +1,5 @@ { "Bulk edit": "批量编辑", - "Data will be updated": "更新的数据" + "Data will be updated": "更新的数据", + "Entire collection":"全表" } diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/BulkUpdateAction.Settings.tsx b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/BulkUpdateAction.Settings.tsx index 5be24f6b66..6521d54bf9 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/BulkUpdateAction.Settings.tsx +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/BulkUpdateAction.Settings.tsx @@ -33,7 +33,7 @@ function UpdateMode() { title={t('Data will be updated')} options={[ { label: t('Selected'), value: 'selected' }, - { label: t('All'), value: 'all' }, + { label: t('Entire collection', { ns: 'action-bulk-edit' }), value: 'all' }, ]} value={fieldSchema?.['x-action-settings']?.['updateMode']} onChange={(value) => { diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts index fb37fbaed5..73bd22caac 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/client/__e2e__/schemaSettings.test.ts @@ -24,7 +24,7 @@ test.describe('data will be updated && Assign field values && after successful s await expect(page.getByTitle('Data will be updated').getByText('Selected')).toBeVisible(); await page.getByRole('menuitem', { name: 'Data will be updated' }).click(); //切换为全部数据 - await page.getByRole('option', { name: 'All' }).click(); + await page.getByRole('option', { name: 'Entire collection' }).click(); //字段赋值 await page.getByRole('menuitem', { name: 'Assign field values' }).click(); await page.getByLabel('schema-initializer-Grid-assignFieldValuesForm:configureFields-general').click(); diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/src/locale/zh-CN.ts b/packages/plugins/@nocobase/plugin-action-bulk-update/src/locale/zh-CN.ts index f1ca06e0ea..71fdb1988c 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/src/locale/zh-CN.ts +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/src/locale/zh-CN.ts @@ -11,4 +11,5 @@ export default { 'Bulk update': '批量更新', 'After successful bulk update': '批量成功更新后', 'Please select the records to be updated': '请选择要更新的记录', + "Entire collection":"全表" };