From 96832e61130f1ff3f15cda2e797aab98c1c27443 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Tue, 5 Mar 2024 20:56:05 +0800 Subject: [PATCH] fix: collection without filterTargetKey should not be able to add block (#3614) * fix: collection without filterTargetKey should not be able to add block * refactor: locale improve --- packages/core/client/src/locale/ko_KR.json | 2 +- packages/core/client/src/locale/zh-CN.json | 2 +- packages/core/client/src/locale/zh-TW.json | 2 +- .../__e2e__/form-create/schemaSettings.test.ts | 2 +- .../antd/action/Action.Designer.tsx | 2 +- .../buttons/RecordBlockInitializers.tsx | 16 ++++++++-------- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/core/client/src/locale/ko_KR.json b/packages/core/client/src/locale/ko_KR.json index bcf0dd13f..e92098e09 100644 --- a/packages/core/client/src/locale/ko_KR.json +++ b/packages/core/client/src/locale/ko_KR.json @@ -835,7 +835,7 @@ "Please use a valid SELECT or WITH AS statement": "유효한 SELECT 또는 WITH AS 문을 사용하세요", "Please confirm the SQL statement first": "먼저 SQL 문을 확인하세요", "Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects": "컬렉션에 의존하는 객체(예: 뷰)와 이러한 객체에 의존하는 모든 객체를 자동으로 삭제합니다", - "Second confirmation": "두 번째 확인", + "Secondary confirmation": "두 번째 확인", "Perform the {{title}}": "{{title}} 실행", "Are you sure you want to perform the {{title}} action?": "{{title}} 작업을 실행하시겠습니까?", "Sign in with another account": "다른 계정으로 로그인", diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 0c7bb8cba..96591b4b7 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -841,7 +841,7 @@ "Please use a valid SELECT or WITH AS statement": "请使用有效的 SELECT 或 WITH AS 语句", "Please confirm the SQL statement first": "请先确认 SQL 语句", "Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects": "自动删除依赖于该表的对象,以及依赖这些对象的对象", - "Second confirmation": "二次确认", + "Secondary confirmation": "二次确认", "Perform the {{title}}": "执行{{title}}", "Are you sure you want to perform the {{title}} action?": "你确定执行{{title}}操作吗?", "Sign in with another account": "登录其他账号", diff --git a/packages/core/client/src/locale/zh-TW.json b/packages/core/client/src/locale/zh-TW.json index 1d48aa43f..14aed365a 100644 --- a/packages/core/client/src/locale/zh-TW.json +++ b/packages/core/client/src/locale/zh-TW.json @@ -835,7 +835,7 @@ "Please use a valid SELECT or WITH AS statement": "請使用有效的 SELECT 或 WITH AS 語句", "Please confirm the SQL statement first": "請先確認 SQL 語句", "Automatically drop objects that depend on the collection (such as views), and in turn all objects that depend on those objects": "自動刪除依賴於該表的物件,以及依賴這些物件的物件", - "Second confirmation": "再次確認", + "Secondary confirmation": "再次確認", "Perform the {{title}}": "執行{{title}}", "Are you sure you want to perform the {{title}} action?": "你確定執行{{title}}動作嗎?", "Sign in with another account": "登入其他帳號", diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts index 4de6a0684..746d5cd65 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.ts @@ -1220,7 +1220,7 @@ test.describe('actions schema settings', () => { await page.getByRole('button', { name: 'Submit' }).hover(); await page.getByRole('button', { name: 'designer-schema-settings-Action-Action.Designer-users' }).hover(); }, - supportedOptions: ['Edit button', 'Second confirmation', 'Bind workflows', 'Delete'], + supportedOptions: ['Edit button', 'Secondary confirmation', 'Bind workflows', 'Delete'], }); }); diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index 88d11731b..19ac2679c 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -717,7 +717,7 @@ export function SecondConFirm() { return ( { if (!fieldSchema['x-component-props']) { diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx index 9c66efa23..5384c3d5d 100644 --- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx @@ -184,24 +184,24 @@ function useRecordBlocks() { const { actionInitializers } = options; const collection = useCollection_deprecated(); const { getChildrenCollections } = useCollectionManager_deprecated(); - const formChildrenCollections = getChildrenCollections(collection.name, collection.dataSource); - const hasFormChildCollection = formChildrenCollections?.length > 0; - const detailChildrenCollections = getChildrenCollections(collection.name, true); - const hasDetailChildCollection = detailChildrenCollections?.length > 0; + const collectionsWithView = getChildrenCollections(collection.name, true, collection.dataSource).filter( + (v) => v?.filterTargetKey, + ); + const hasChildCollection = collectionsWithView?.length > 0; const modifyFlag = (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; const detailChildren = useDetailCollections({ ...options, - childrenCollections: detailChildrenCollections, + childrenCollections: collectionsWithView, collection, }); const formChildren = useFormCollections({ ...options, - childrenCollections: formChildrenCollections, + childrenCollections: collectionsWithView, collection, }); const res = []; - if (hasDetailChildCollection) { + if (hasChildCollection) { res.push({ name: 'details', type: 'subMenu', @@ -217,7 +217,7 @@ function useRecordBlocks() { }); } - if (hasFormChildCollection) { + if (hasChildCollection) { res.push({ name: 'form', type: 'subMenu',