fix:pg view creation issue, resolve error when selecting views across schemas (#5881)

* fix: pg view creation issue, resolve error when selecting views across schemas

* fix: pg view creation issue, resolve error when selecting views across schemas

* refactor: locale

* fix: bug
This commit is contained in:
Katherine 2024-12-14 22:59:36 +08:00 committed by GitHub
parent f05e18fb94
commit 6ff60c1b8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 6 deletions

View File

@ -266,7 +266,11 @@ const PreviewCom = (props) => {
};
function areEqual(prevProps, nextProps) {
return nextProps.name === prevProps.name && nextProps.sources === prevProps.sources;
return (
nextProps.viewName === prevProps.viewName &&
nextProps.schema === prevProps.schema &&
nextProps.source === prevProps.source
);
}
export const PreviewFields = React.memo(PreviewCom, areEqual);

View File

@ -73,7 +73,7 @@ export class ViewCollectionTemplate extends CollectionTemplate {
when: '{{isPG}}',
fulfill: {
state: {
value: "{{$deps[0].split('_')?.[0]}}",
value: "{{$deps[0].split('@')?.[0]}}",
},
},
otherwise: {
@ -91,7 +91,7 @@ export class ViewCollectionTemplate extends CollectionTemplate {
when: '{{isPG}}',
fulfill: {
state: {
value: '{{$deps[0].match(/^([^_]+)_(.*)$/)?.[2]}}',
value: "{{$deps[0].split('@')?.[1]}}",
},
},
otherwise: {
@ -125,6 +125,7 @@ export class ViewCollectionTemplate extends CollectionTemplate {
type: 'array',
'x-component': PreviewFields,
'x-hidden': '{{ !createOnly }}',
'x-decorator': 'FormItem',
'x-reactions': {
dependencies: ['name'],
fulfill: {
@ -133,6 +134,7 @@ export class ViewCollectionTemplate extends CollectionTemplate {
},
},
},
description: `{{t("Fields can only be used correctly if they are defined with an interface.")}}`,
},
preview: {
type: 'void',

View File

@ -1031,5 +1031,6 @@
"Plugin": "插件",
"Bulk enable": "批量激活",
"Search plugin...": "搜索插件...",
"Package name": "包名"
"Package name": "包名",
"Fields can only be used correctly if they are defined with an interface.": "只有字段设置了interface字段才能正常使用"
}

View File

@ -161,7 +161,7 @@ export const ConfigurationTable = () => {
const schema = item.schema;
return {
label: schema ? `${schema}.${compile(item.name)}` : item.name,
value: schema ? `${schema}_${item.name}` : item.name,
value: schema ? `${schema}@${item.name}` : item.name,
};
});
});