fix: change plugin routes
This commit is contained in:
		
							parent
							
								
									be235786d0
								
							
						
					
					
						commit
						3735d71e70
					
				@ -101,6 +101,9 @@ const InternalAdminLayout = (props: any) => {
 | 
				
			|||||||
                return filterByACL(data, ctx);
 | 
					                return filterByACL(data, ctx);
 | 
				
			||||||
              }}
 | 
					              }}
 | 
				
			||||||
              onSuccess={(data) => {
 | 
					              onSuccess={(data) => {
 | 
				
			||||||
 | 
					                if (defaultSelectedUid && defaultSelectedUid.includes('/')) {
 | 
				
			||||||
 | 
					                  return;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                const schema = filterByACL(data?.data, ctx);
 | 
					                const schema = filterByACL(data?.data, ctx);
 | 
				
			||||||
                if (defaultSelectedUid) {
 | 
					                if (defaultSelectedUid) {
 | 
				
			||||||
                  const s = findByUid(schema, defaultSelectedUid);
 | 
					                  const s = findByUid(schema, defaultSelectedUid);
 | 
				
			||||||
 | 
				
			|||||||
@ -76,7 +76,7 @@ export const BlockTemplateDetails = () => {
 | 
				
			|||||||
    <div>
 | 
					    <div>
 | 
				
			||||||
      <AntdPageHeader
 | 
					      <AntdPageHeader
 | 
				
			||||||
        onBack={() => {
 | 
					        onBack={() => {
 | 
				
			||||||
          history.push('/admin/block-templates');
 | 
					          history.push('/admin/plugins/block-templates');
 | 
				
			||||||
        }}
 | 
					        }}
 | 
				
			||||||
        ghost={false}
 | 
					        ghost={false}
 | 
				
			||||||
        title={<EditableTitle filterByTk={key} title={data?.data?.name} />}
 | 
					        title={<EditableTitle filterByTk={key} title={data?.data?.name} />}
 | 
				
			||||||
 | 
				
			|||||||
@ -15,12 +15,12 @@ const SchemaTemplateRouteProvider = (props) => {
 | 
				
			|||||||
  routes[1].routes.unshift(
 | 
					  routes[1].routes.unshift(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      type: 'route',
 | 
					      type: 'route',
 | 
				
			||||||
      path: '/admin/block-templates/:key',
 | 
					      path: '/admin/plugins/block-templates/:key',
 | 
				
			||||||
      component: 'BlockTemplateDetails',
 | 
					      component: 'BlockTemplateDetails',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      type: 'route',
 | 
					      type: 'route',
 | 
				
			||||||
      path: '/admin/block-templates',
 | 
					      path: '/admin/plugins/block-templates',
 | 
				
			||||||
      component: 'BlockTemplatePage',
 | 
					      component: 'BlockTemplatePage',
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ export const SchemaTemplateShortcut = () => {
 | 
				
			|||||||
      icon={<LayoutOutlined />}
 | 
					      icon={<LayoutOutlined />}
 | 
				
			||||||
      title={t('Block templates')}
 | 
					      title={t('Block templates')}
 | 
				
			||||||
      onClick={() => {
 | 
					      onClick={() => {
 | 
				
			||||||
        history.push('/admin/block-templates');
 | 
					        history.push('/admin/plugins/block-templates');
 | 
				
			||||||
      }}
 | 
					      }}
 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ export const uiSchemaTemplatesSchema: ISchema = {
 | 
				
			|||||||
                      'x-action': 'view',
 | 
					                      'x-action': 'view',
 | 
				
			||||||
                      'x-component': 'RecordLink',
 | 
					                      'x-component': 'RecordLink',
 | 
				
			||||||
                      'x-component-props': {
 | 
					                      'x-component-props': {
 | 
				
			||||||
                        to: '/admin/block-templates/${record.key}',
 | 
					                        to: '/admin/plugins/block-templates/${record.key}',
 | 
				
			||||||
                      },
 | 
					                      },
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    edit: {
 | 
					                    edit: {
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,6 @@ export const WorkflowLink = () => {
 | 
				
			|||||||
  const { id } = useRecord();
 | 
					  const { id } = useRecord();
 | 
				
			||||||
  const { setVisible } = useActionContext();
 | 
					  const { setVisible } = useActionContext();
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <Link to={`/admin/workflows/${id}`} onClick={() => setVisible(false)}>流程配置</Link>
 | 
					    <Link to={`/admin/plugins/workflows/${id}`} onClick={() => setVisible(false)}>流程配置</Link>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,11 @@
 | 
				
			|||||||
 | 
					import { cx } from '@emotion/css';
 | 
				
			||||||
 | 
					import { ISchema } from '@formily/react';
 | 
				
			||||||
import React from 'react';
 | 
					import React from 'react';
 | 
				
			||||||
import { useRouteMatch } from 'react-router-dom';
 | 
					import { useRouteMatch } from 'react-router-dom';
 | 
				
			||||||
import { ISchema } from '@formily/react';
 | 
					 | 
				
			||||||
import { cx } from '@emotion/css';
 | 
					 | 
				
			||||||
import { SchemaComponent } from '..';
 | 
					import { SchemaComponent } from '..';
 | 
				
			||||||
import { TriggerConfig } from './triggers';
 | 
					 | 
				
			||||||
import { WorkflowCanvas } from './WorkflowCanvas'
 | 
					 | 
				
			||||||
import { workflowPageClass } from './style';
 | 
					import { workflowPageClass } from './style';
 | 
				
			||||||
 | 
					import { TriggerConfig } from './triggers';
 | 
				
			||||||
 | 
					import { WorkflowCanvas } from './WorkflowCanvas';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const workflowCollection = {
 | 
					const workflowCollection = {
 | 
				
			||||||
  name: 'workflow',
 | 
					  name: 'workflow',
 | 
				
			||||||
@ -22,12 +20,12 @@ const workflowCollection = {
 | 
				
			|||||||
        'x-component': 'Input',
 | 
					        'x-component': 'Input',
 | 
				
			||||||
        required: true,
 | 
					        required: true,
 | 
				
			||||||
      } as ISchema,
 | 
					      } as ISchema,
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
  ]
 | 
					  ],
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const WorkflowPage = () => {
 | 
					export const WorkflowPage = () => {
 | 
				
			||||||
  const { params } = useRouteMatch();
 | 
					  const { params } = useRouteMatch<any>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div className={cx(workflowPageClass)}>
 | 
					    <div className={cx(workflowPageClass)}>
 | 
				
			||||||
@ -36,7 +34,7 @@ export const WorkflowPage = () => {
 | 
				
			|||||||
          schema={{
 | 
					          schema={{
 | 
				
			||||||
            type: 'void',
 | 
					            type: 'void',
 | 
				
			||||||
            properties: {
 | 
					            properties: {
 | 
				
			||||||
              provider: {
 | 
					              [`provider_${params.id}`]: {
 | 
				
			||||||
                type: 'void',
 | 
					                type: 'void',
 | 
				
			||||||
                'x-decorator': 'ResourceActionProvider',
 | 
					                'x-decorator': 'ResourceActionProvider',
 | 
				
			||||||
                'x-decorator-props': {
 | 
					                'x-decorator-props': {
 | 
				
			||||||
@ -47,14 +45,14 @@ export const WorkflowPage = () => {
 | 
				
			|||||||
                    action: 'get',
 | 
					                    action: 'get',
 | 
				
			||||||
                    params: {
 | 
					                    params: {
 | 
				
			||||||
                      filter: params,
 | 
					                      filter: params,
 | 
				
			||||||
                      appends: ['nodes']
 | 
					                      appends: ['nodes'],
 | 
				
			||||||
                    }
 | 
					                    },
 | 
				
			||||||
                  }
 | 
					                  },
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                properties: {
 | 
					                properties: {
 | 
				
			||||||
                  trigger: {
 | 
					                  trigger: {
 | 
				
			||||||
                    type: 'void',
 | 
					                    type: 'void',
 | 
				
			||||||
                    'x-component': 'TriggerConfig'
 | 
					                    'x-component': 'TriggerConfig',
 | 
				
			||||||
                  },
 | 
					                  },
 | 
				
			||||||
                  nodes: {
 | 
					                  nodes: {
 | 
				
			||||||
                    type: 'void',
 | 
					                    type: 'void',
 | 
				
			||||||
@ -70,7 +68,7 @@ export const WorkflowPage = () => {
 | 
				
			|||||||
                            uiSchema: {
 | 
					                            uiSchema: {
 | 
				
			||||||
                              title: '节点名称',
 | 
					                              title: '节点名称',
 | 
				
			||||||
                              type: 'string',
 | 
					                              type: 'string',
 | 
				
			||||||
                              'x-component': 'Input'
 | 
					                              'x-component': 'Input',
 | 
				
			||||||
                            },
 | 
					                            },
 | 
				
			||||||
                          },
 | 
					                          },
 | 
				
			||||||
                          {
 | 
					                          {
 | 
				
			||||||
@ -82,23 +80,23 @@ export const WorkflowPage = () => {
 | 
				
			|||||||
                              type: 'string',
 | 
					                              type: 'string',
 | 
				
			||||||
                              'x-component': 'Select',
 | 
					                              'x-component': 'Select',
 | 
				
			||||||
                              required: true,
 | 
					                              required: true,
 | 
				
			||||||
                            }
 | 
					                            },
 | 
				
			||||||
                          }
 | 
					                          },
 | 
				
			||||||
                        ]
 | 
					                        ],
 | 
				
			||||||
                      }
 | 
					                      },
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    'x-component': 'WorkflowCanvas',
 | 
					                    'x-component': 'WorkflowCanvas',
 | 
				
			||||||
                    'x-component-props': {
 | 
					                    'x-component-props': {
 | 
				
			||||||
                      // nodes
 | 
					                      // nodes
 | 
				
			||||||
                    }
 | 
					                    },
 | 
				
			||||||
                  }
 | 
					                  },
 | 
				
			||||||
                }
 | 
					                },
 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
            }
 | 
					            },
 | 
				
			||||||
          }}
 | 
					          }}
 | 
				
			||||||
          components={{
 | 
					          components={{
 | 
				
			||||||
            TriggerConfig,
 | 
					            TriggerConfig,
 | 
				
			||||||
            WorkflowCanvas
 | 
					            WorkflowCanvas,
 | 
				
			||||||
          }}
 | 
					          }}
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -3,12 +3,10 @@ import { RouteSwitchContext } from '../route-switch';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const WorkflowRouteProvider = (props) => {
 | 
					export const WorkflowRouteProvider = (props) => {
 | 
				
			||||||
  const { routes, ...others } = useContext(RouteSwitchContext);
 | 
					  const { routes, ...others } = useContext(RouteSwitchContext);
 | 
				
			||||||
  routes[1].routes.unshift(
 | 
					  routes[1].routes.unshift({
 | 
				
			||||||
    {
 | 
					    type: 'route',
 | 
				
			||||||
      type: 'route',
 | 
					    path: '/admin/plugins/workflows/:id',
 | 
				
			||||||
      path: '/admin/workflows/:id',
 | 
					    component: 'WorkflowPage',
 | 
				
			||||||
      component: 'WorkflowPage',
 | 
					  });
 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
  return <RouteSwitchContext.Provider value={{ ...others, routes }}>{props.children}</RouteSwitchContext.Provider>;
 | 
					  return <RouteSwitchContext.Provider value={{ ...others, routes }}>{props.children}</RouteSwitchContext.Provider>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -39,11 +39,11 @@ export class UiRoutesStoragePlugin extends Plugin {
 | 
				
			|||||||
        title: 'NocoBase Admin',
 | 
					        title: 'NocoBase Admin',
 | 
				
			||||||
        routes: [
 | 
					        routes: [
 | 
				
			||||||
          // test...
 | 
					          // test...
 | 
				
			||||||
          {
 | 
					          // {
 | 
				
			||||||
            type: 'route',
 | 
					          //   type: 'route',
 | 
				
			||||||
            path: '/admin/workflows/:id',
 | 
					          //   path: '/admin/workflows/:id',
 | 
				
			||||||
            component: 'WorkflowPage',
 | 
					          //   component: 'WorkflowPage',
 | 
				
			||||||
          },
 | 
					          // },
 | 
				
			||||||
          // {
 | 
					          // {
 | 
				
			||||||
          //   type: 'route',
 | 
					          //   type: 'route',
 | 
				
			||||||
          //   path: '/admin/block-templates/:key',
 | 
					          //   path: '/admin/block-templates/:key',
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user