diff --git a/packages/core/client/src/collection-manager/Configuration/ConfigurationTable.tsx b/packages/core/client/src/collection-manager/Configuration/ConfigurationTable.tsx index f0210c0a2..54c94c74c 100644 --- a/packages/core/client/src/collection-manager/Configuration/ConfigurationTable.tsx +++ b/packages/core/client/src/collection-manager/Configuration/ConfigurationTable.tsx @@ -85,7 +85,7 @@ export const ConfigurationTable = () => { ?.filter((item) => !(item.autoCreate && item.isThrough)) .filter((item) => targetScope - ? targetScope['template']?.includes(item.template) || targetScope['name']?.includes(item.name) + ? targetScope['template']?.includes(item.template) || targetScope[field.props.name]?.includes(item.name) : true, ) .map((item: any) => ({ diff --git a/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx b/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx index ed107ee69..7016a56b6 100644 --- a/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx +++ b/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx @@ -128,23 +128,26 @@ const getIsOverriding = (currentFields, record) => { }; export const OverridingFieldAction = (props) => { const { scope, getContainer, item: record, children, currentCollection } = props; - const { target } = record; + const { target, through } = record; const { getInterface, getCurrentCollectionFields, getChildrenCollections } = useCollectionManager(); const [visible, setVisible] = useState(false); const [schema, setSchema] = useState({}); const api = useAPIClient(); const { t } = useTranslation(); const compile = useCompile(); - const childCollections = - target && - getChildrenCollections(target) - ?.map((v) => v.name) - .concat([target]); + const getFilterCollections = (filterKey) => { + const childCollections = + filterKey && + getChildrenCollections(filterKey) + ?.map((v) => v.name) + .concat([filterKey]); + return childCollections; + }; const [data, setData] = useState({}); const currentFields = getCurrentCollectionFields(currentCollection); const disabled = getIsOverriding(currentFields, record); return ( - + { useCancelAction, showReverseFieldConfig: !data?.reverseField, createOnly: true, + override: true, isOverride: true, - targetScope: { name: childCollections }, + targetScope: { target: getFilterCollections(target), through: getFilterCollections(through) }, ...scope, }} /> diff --git a/packages/core/client/src/collection-manager/interfaces/m2m.tsx b/packages/core/client/src/collection-manager/interfaces/m2m.tsx index 8177c4983..2bc4c4c14 100644 --- a/packages/core/client/src/collection-manager/interfaces/m2m.tsx +++ b/packages/core/client/src/collection-manager/interfaces/m2m.tsx @@ -190,7 +190,7 @@ export const m2m: IField = { 'x-decorator': 'FormItem', 'x-component': 'Input', 'x-validator': 'uid', - 'x-disabled': '{{ !createOnly }}', + 'x-disabled': '{{ !createOnly||override }}', }, }, }, @@ -224,7 +224,7 @@ export const m2m: IField = { 'x-decorator': 'FormItem', 'x-component': 'Input', 'x-validator': 'uid', - 'x-disabled': '{{ !createOnly }}', + 'x-disabled': '{{ !createOnly||override }}', }, }, },