feat: workflow route provider

This commit is contained in:
chenos 2022-03-27 16:15:58 +08:00
parent b59a239a82
commit 246e06eb7a
3 changed files with 24 additions and 7 deletions

View File

@ -26,10 +26,10 @@ import {
SignupPage,
SystemSettingsProvider,
SystemSettingsShortcut,
useRequest,
useRoutes,
WorkflowPage,
WorkflowShortcut,
useRoutes
WorkflowRouteProvider,
WorkflowShortcut
} from '@nocobase/client';
import { notification } from 'antd';
import 'antd/dist/antd.css';
@ -97,6 +97,7 @@ const providers = [
],
AntdSchemaComponentProvider,
ChinaRegionProvider,
WorkflowRouteProvider,
[DocumentTitleProvider, { addonAfter: 'NocoBase' }],
];

View File

@ -0,0 +1,14 @@
import React, { useContext } from 'react';
import { RouteSwitchContext } from '../route-switch';
export const WorkflowRouteProvider = (props) => {
const { routes, ...others } = useContext(RouteSwitchContext);
routes[1].routes.unshift(
{
type: 'route',
path: '/admin/workflows/:id',
component: 'WorkflowPage',
},
);
return <RouteSwitchContext.Provider value={{ ...others, routes }}>{props.children}</RouteSwitchContext.Provider>;
};

View File

@ -1,5 +1,7 @@
export * from './WorkflowPage';
export * from './WorkflowLink';
export * from './WorkflowTable';
export * from './WorkflowShortcut';
export * from './ExecutionResourceProvider';
export * from './WorkflowLink';
export * from './WorkflowPage';
export * from './WorkflowRouteProvider';
export * from './WorkflowShortcut';
export * from './WorkflowTable';