feat(ide): 添加复杂流程编排功能

master
钟良源 3 months ago
parent 3cf8e605c5
commit 5a456d046f

@ -10,7 +10,7 @@ export const projectFlowHandle = (initialData, useDefault, setNodes, setEdges, d
const {
nodes: convertedNodes,
edges: convertedEdges
} = convertFlowData(initialData?.main.components, useDefault);
} = convertFlowData(initialData?.main?.components || initialData?.compData?.components, useDefault);
// 为所有边添加类型
const initialEdges: Edge[] = convertedEdges.map(edge => ({

@ -18,6 +18,7 @@ import { getAppListBySceneId } from '@/api/apps';
import { getProjectComp } from '@/api/scene';
import ProjectContainer from '@/pages/orchestration/project';
import ComplexContainer from '@/pages/orchestration/complex';
import ApplicationContainer from '@/pages/orchestration/application';
import EventContainer from '@/pages/orchestration/event';
import GlobalVarContainer from '@/pages/orchestration/globalVar';
@ -46,7 +47,7 @@ const EnvConfig = () => <div style={{ height: '100%', width: '100%' }}>环境配
// 所有可显示的组件路径列表
const ALL_PATHS = [
'compFlow', 'appFlow', 'compList', 'appInstance', 'event', 'globalVar', 'appCompList',
'compFlow', 'complexFlow', 'appFlow', 'compList', 'appInstance', 'event', 'globalVar', 'appCompList',
'myComponents', 'matchingComponents', 'componentReview', 'componentList',
'componentCoding', 'componentDeployment', 'componentTest', 'envConfig'
];
@ -220,6 +221,8 @@ function IDEContainer() {
switch (path) {
case 'compFlow':
return <ProjectContainer selected={selected} />;
case 'complexFlow':
return <ComplexContainer selected={selected} />;
case 'appFlow':
return <ApplicationContainer />;
case 'compList':

@ -53,6 +53,7 @@ const NavBar: React.ForwardRefRenderFunction<NavBarRef, NavBarProps> = ({
const key = selected.key;
const parentKey = selected.parentKey;
const title = selected.title;
const pathTitle = selected?.pathTitle || null;
// 检查tab是否已存在
const existingTab = tabs.find(tab => tab.key === (key) && tab.title === title);
@ -63,7 +64,8 @@ const NavBar: React.ForwardRefRenderFunction<NavBarRef, NavBarProps> = ({
key: key,
parentKey: parentKey,
title: title,
path: path
path: path,
pathTitle: pathTitle
};
setTabs(prev => [...prev, newTab]);
@ -128,7 +130,7 @@ const NavBar: React.ForwardRefRenderFunction<NavBarRef, NavBarProps> = ({
<TabPane
destroyOnHide
key={tab.key}
title={tab.title}
title={tab.pathTitle || tab.title}
>
</TabPane>
))}

@ -310,12 +310,11 @@ const SideBar: React.FC<SideBarProps> = ({
}, [menu, searchValue, activeKey]);
const getProjectEnvData = async (data) => {
if (!data.path || !data.key) return;
if (!data.path || !data.key || data.hasOwnProperty('compData')) return;
const parentKey = menu[activeKey]?.key;
const currentMenu = _.cloneDeep(menuData[identity]);
const index = currentMenu.findIndex(v => v.key === parentKey);
const res: any = await getAppInfoNew(data.id);
console.log('res.data:', res.data.subs);
if (res.code === 200) {
const children = currentMenu[index].children.find(v => v.id === data.id);
children.children[0].children = res.data.events.map(item => {
@ -340,7 +339,11 @@ const SideBar: React.FC<SideBarProps> = ({
title: info.flowName,
children: null,
icon: '/ideContainer/icon/tool.png',
compData: info
compData: info,
path: 'complexFlow',
key: info.flowId,
pathTitle: `${data.title} / ${info.flowName}`,
parentKey: 'appList'
};
})
};
@ -614,7 +617,6 @@ const SideBar: React.FC<SideBarProps> = ({
onSelect={async (_selectedKeys, info) => {
const selectedNode = info.node;
const originalData = selectedNode.props.dataRef;
console.log(originalData);
if (selected?.parentKey === 'appList') {
await getProjectEnvData(originalData);

@ -4,4 +4,5 @@ export interface Selected {
key?: string;
parentKey?: string;
children?: Selected[];
pathTitle?: string;
}

@ -0,0 +1,11 @@
import React, { useEffect, useState } from 'react';
import FlowEditor from '@/pages/flowEditor/index';
const complexContainer = ({ selected }) => {
return (
<FlowEditor initialData={selected.compData || {}} useDefault={true} />
);
};
export default complexContainer;
Loading…
Cancel
Save