Merge branches 'feat/dataSource-manager' and 'feat/dataSource-manager' of https://github.com/nocobase/nocobase into feat/dataSource-manager

This commit is contained in:
dream2023 2024-01-26 11:05:29 +08:00
commit 1f84914342
2 changed files with 7 additions and 12 deletions

View File

@ -109,10 +109,7 @@ export const CollectionFields = () => {
const { targetScope } = options;
const isFieldInherits = field.props?.name === 'inherits';
const { data } = await api.request({
url: 'dataSourcesCollections:list',
headers: {
'X-Database': dataSourceKey,
},
url: `dataSources/${dataSourceKey}/collections:list`,
params: {
paginate: false,
appends: ['fields'],

View File

@ -42,10 +42,10 @@ export const ForeignKey = observer(
const { value, disabled } = props;
const api = useAPIClient();
const [options, setOptions] = useState([]);
const { connectionName, name: collectionName, fields } = useRecord();
const { name: dataSourceKey } = useParams();
const { name: collectionName, fields } = useRecord();
const compile = useCompile();
const form = useForm();
const { name } = useParams();
const { target, type, through } = form.values;
const [initialValue, setInitialValue] = useState(value);
const field: any = useField();
@ -86,8 +86,7 @@ export const ForeignKey = observer(
: target;
if (effectField && open) {
const { data } = await api.request({
url: `remoteCollections/${effectField}/fields:list`,
headers: { 'X-Database': connectionName || name },
url: `dataSourcesCollections/${dataSourceKey}.${effectField}/fields:list`,
params: {
paginate: false,
filter: {
@ -123,12 +122,12 @@ export const ForeignKey = observer(
export const TargetKey = observer(
(props: any) => {
const { value, disabled } = props;
const { connectionName, targetKey } = useRecord();
const { targetKey } = useRecord();
const { name: dataSourceKey } = useParams();
const api = useAPIClient();
const [options, setOptions] = useState([]);
const [initialValue, setInitialValue] = useState(value || targetKey);
const form = useForm();
const { name } = useParams();
const compile = useCompile();
const field: any = useField();
field.required = true;
@ -140,8 +139,7 @@ export const TargetKey = observer(
const { target } = form.values;
if (target && open) {
const { data } = await api.request({
url: `remoteCollections/${target}/fields:list`,
headers: { 'X-Database': connectionName || name },
url: `dataSourcesCollections/${dataSourceKey}.${target}/fields:list`,
params: {
paginate: false,
filter: {