mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix(Link): cannot use 'current user' variable (#6536)
This commit is contained in:
parent
57c8722c3c
commit
322f3d749e
@ -14,6 +14,14 @@ import React, { useCallback, useContext } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Router } from 'react-router-dom';
|
import { Router } from 'react-router-dom';
|
||||||
import { SchemaInitializerItem } from '../../application';
|
import { SchemaInitializerItem } from '../../application';
|
||||||
|
import {
|
||||||
|
CollectionManagerProvider,
|
||||||
|
useCollectionManager,
|
||||||
|
} from '../../data-source/collection/CollectionManagerProvider';
|
||||||
|
import {
|
||||||
|
DataSourceManagerProvider,
|
||||||
|
useDataSourceManager,
|
||||||
|
} from '../../data-source/data-source/DataSourceManagerProvider';
|
||||||
import { useGlobalTheme } from '../../global-theme';
|
import { useGlobalTheme } from '../../global-theme';
|
||||||
import { NocoBaseDesktopRouteType } from '../../route-switch/antd/admin-layout/convertRoutesToSchema';
|
import { NocoBaseDesktopRouteType } from '../../route-switch/antd/admin-layout/convertRoutesToSchema';
|
||||||
import {
|
import {
|
||||||
@ -34,6 +42,8 @@ export const LinkMenuItem = () => {
|
|||||||
const { urlSchema, paramsSchema } = useURLAndHTMLSchema();
|
const { urlSchema, paramsSchema } = useURLAndHTMLSchema();
|
||||||
const parentRoute = useParentRoute();
|
const parentRoute = useParentRoute();
|
||||||
const { createRoute } = useNocoBaseRoutes();
|
const { createRoute } = useNocoBaseRoutes();
|
||||||
|
const dm = useDataSourceManager();
|
||||||
|
const cm = useCollectionManager();
|
||||||
|
|
||||||
const handleClick = useCallback(async () => {
|
const handleClick = useCallback(async () => {
|
||||||
const values = await FormDialog(
|
const values = await FormDialog(
|
||||||
@ -41,6 +51,8 @@ export const LinkMenuItem = () => {
|
|||||||
() => {
|
() => {
|
||||||
const history = createMemoryHistory();
|
const history = createMemoryHistory();
|
||||||
return (
|
return (
|
||||||
|
<DataSourceManagerProvider dataSourceManager={dm}>
|
||||||
|
<CollectionManagerProvider instance={cm} dataSource={cm?.dataSource?.key}>
|
||||||
<Router location={history.location} navigator={history}>
|
<Router location={history.location} navigator={history}>
|
||||||
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
<SchemaComponentOptions scope={options.scope} components={{ ...options.components }}>
|
||||||
<FormLayout layout={'vertical'}>
|
<FormLayout layout={'vertical'}>
|
||||||
@ -66,6 +78,8 @@ export const LinkMenuItem = () => {
|
|||||||
</FormLayout>
|
</FormLayout>
|
||||||
</SchemaComponentOptions>
|
</SchemaComponentOptions>
|
||||||
</Router>
|
</Router>
|
||||||
|
</CollectionManagerProvider>
|
||||||
|
</DataSourceManagerProvider>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
theme,
|
theme,
|
||||||
|
@ -92,7 +92,7 @@ export const useGetFilterFieldOptions = () => {
|
|||||||
|
|
||||||
const getOptions = (fields, depth, usedInVariable?: boolean) => {
|
const getOptions = (fields, depth, usedInVariable?: boolean) => {
|
||||||
const options = [];
|
const options = [];
|
||||||
fields.forEach((field) => {
|
fields?.forEach((field) => {
|
||||||
const option = field2option(field, depth, usedInVariable);
|
const option = field2option(field, depth, usedInVariable);
|
||||||
if (option) {
|
if (option) {
|
||||||
options.push(option);
|
options.push(option);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user