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
This commit is contained in:
katherinehhh 2024-03-05 20:56:05 +08:00 committed by GitHub
parent 5a72e41a9d
commit 96832e6113
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 13 deletions

View File

@ -835,7 +835,7 @@
"Please use a valid SELECT or WITH AS statement": "유효한 SELECT 또는 WITH AS 문을 사용하세요", "Please use a valid SELECT or WITH AS statement": "유효한 SELECT 또는 WITH AS 문을 사용하세요",
"Please confirm the SQL statement first": "먼저 SQL 문을 확인하세요", "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": "컬렉션에 의존하는 객체(예: 뷰)와 이러한 객체에 의존하는 모든 객체를 자동으로 삭제합니다", "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}} 실행", "Perform the {{title}}": "{{title}} 실행",
"Are you sure you want to perform the {{title}} action?": "{{title}} 작업을 실행하시겠습니까?", "Are you sure you want to perform the {{title}} action?": "{{title}} 작업을 실행하시겠습니까?",
"Sign in with another account": "다른 계정으로 로그인", "Sign in with another account": "다른 계정으로 로그인",

View File

@ -841,7 +841,7 @@
"Please use a valid SELECT or WITH AS statement": "请使用有效的 SELECT 或 WITH AS 语句", "Please use a valid SELECT or WITH AS statement": "请使用有效的 SELECT 或 WITH AS 语句",
"Please confirm the SQL statement first": "请先确认 SQL 语句", "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": "自动删除依赖于该表的对象,以及依赖这些对象的对象", "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}}", "Perform the {{title}}": "执行{{title}}",
"Are you sure you want to perform the {{title}} action?": "你确定执行{{title}}操作吗?", "Are you sure you want to perform the {{title}} action?": "你确定执行{{title}}操作吗?",
"Sign in with another account": "登录其他账号", "Sign in with another account": "登录其他账号",

View File

@ -835,7 +835,7 @@
"Please use a valid SELECT or WITH AS statement": "請使用有效的 SELECT 或 WITH AS 語句", "Please use a valid SELECT or WITH AS statement": "請使用有效的 SELECT 或 WITH AS 語句",
"Please confirm the SQL statement first": "請先確認 SQL 語句", "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": "自動刪除依賴於該表的物件,以及依賴這些物件的物件", "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}}", "Perform the {{title}}": "執行{{title}}",
"Are you sure you want to perform the {{title}} action?": "你確定執行{{title}}動作嗎?", "Are you sure you want to perform the {{title}} action?": "你確定執行{{title}}動作嗎?",
"Sign in with another account": "登入其他帳號", "Sign in with another account": "登入其他帳號",

View File

@ -1220,7 +1220,7 @@ test.describe('actions schema settings', () => {
await page.getByRole('button', { name: 'Submit' }).hover(); await page.getByRole('button', { name: 'Submit' }).hover();
await page.getByRole('button', { name: 'designer-schema-settings-Action-Action.Designer-users' }).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'],
}); });
}); });

View File

@ -717,7 +717,7 @@ export function SecondConFirm() {
return ( return (
<SchemaSettingsSwitchItem <SchemaSettingsSwitchItem
title={t('Second confirmation')} title={t('Secondary confirmation')}
checked={!!fieldSchema?.['x-component-props']?.confirm?.content} checked={!!fieldSchema?.['x-component-props']?.confirm?.content}
onChange={(value) => { onChange={(value) => {
if (!fieldSchema['x-component-props']) { if (!fieldSchema['x-component-props']) {

View File

@ -184,24 +184,24 @@ function useRecordBlocks() {
const { actionInitializers } = options; const { actionInitializers } = options;
const collection = useCollection_deprecated(); const collection = useCollection_deprecated();
const { getChildrenCollections } = useCollectionManager_deprecated(); const { getChildrenCollections } = useCollectionManager_deprecated();
const formChildrenCollections = getChildrenCollections(collection.name, collection.dataSource); const collectionsWithView = getChildrenCollections(collection.name, true, collection.dataSource).filter(
const hasFormChildCollection = formChildrenCollections?.length > 0; (v) => v?.filterTargetKey,
const detailChildrenCollections = getChildrenCollections(collection.name, true); );
const hasDetailChildCollection = detailChildrenCollections?.length > 0; const hasChildCollection = collectionsWithView?.length > 0;
const modifyFlag = (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql'; const modifyFlag = (collection.template !== 'view' || collection?.writableView) && collection.template !== 'sql';
const detailChildren = useDetailCollections({ const detailChildren = useDetailCollections({
...options, ...options,
childrenCollections: detailChildrenCollections, childrenCollections: collectionsWithView,
collection, collection,
}); });
const formChildren = useFormCollections({ const formChildren = useFormCollections({
...options, ...options,
childrenCollections: formChildrenCollections, childrenCollections: collectionsWithView,
collection, collection,
}); });
const res = []; const res = [];
if (hasDetailChildCollection) { if (hasChildCollection) {
res.push({ res.push({
name: 'details', name: 'details',
type: 'subMenu', type: 'subMenu',
@ -217,7 +217,7 @@ function useRecordBlocks() {
}); });
} }
if (hasFormChildCollection) { if (hasChildCollection) {
res.push({ res.push({
name: 'form', name: 'form',
type: 'subMenu', type: 'subMenu',