From cd5d48eb805d337adbafc733521a198f18df86c0 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 8 Aug 2024 15:52:06 +0800 Subject: [PATCH] fix: source field type filtering association fields in sql collection & view collection (#5014) * fix: source field type filtering relationship fields in sql collection and view collection * fix: bug * fix: bug --- .../templates/components/PreviewFields.tsx | 2 +- .../templates/components/sql-collection/FieldsConfigure.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx index fa77da458f..e1098151e0 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx @@ -69,7 +69,7 @@ const PreviewCom = (props) => { }; }); const children = collection.fields - .filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type)) + .filter((v) => !['obo', 'oho', 'm2m', 'o2m'].includes(v?.interface)) ?.map((v) => { return { value: v.name, key: v.name, label: t(v.uiSchema?.title || v.name) }; }) diff --git a/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx b/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx index 0935adfdf1..541dbcb89f 100644 --- a/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx +++ b/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx @@ -68,11 +68,12 @@ const useSourceFieldsOptions = () => { return; } const children = (collection.fields as FieldOptions[]) - .filter((v) => !['hasOne', 'hasMany', 'belongsToMany'].includes(v?.type)) + .filter((v) => { + return !['hasOne', 'hasMany', 'belongsToMany', 'belongsTo'].includes(v?.type); + }) ?.map((v) => { return { value: v.name, label: t(v.uiSchema?.title) }; }); - data.push({ value: item, label: t(collection.title), @@ -110,7 +111,6 @@ export const FieldsConfigure = observer( [compile], ); const sourceFieldsOptions = useSourceFieldsOptions(); - const refGetInterface = useRef(getInterface); useEffect(() => { const fieldsMp = new Map();