|
|
|
@ -3,12 +3,14 @@ import { useStore } from '@xyflow/react';
|
|
|
|
import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
|
|
|
|
import styles from '@/components/FlowEditor/node/style/baseOther.module.less';
|
|
|
|
import DynamicIcon from '@/components/DynamicIcon';
|
|
|
|
import DynamicIcon from '@/components/DynamicIcon';
|
|
|
|
import NodeContentREST from '@/pages/flowEditor/components/nodeContentREST';
|
|
|
|
import NodeContentREST from '@/pages/flowEditor/components/nodeContentREST';
|
|
|
|
|
|
|
|
import NodeStatusIndicator, { NodeStatus } from '@/components/FlowEditor/NodeStatusIndicator';
|
|
|
|
|
|
|
|
import { useStore as useFlowStore } from '@xyflow/react';
|
|
|
|
|
|
|
|
|
|
|
|
const setIcon = () => {
|
|
|
|
const setIcon = () => {
|
|
|
|
return <DynamicIcon type="IconCloudDownload" style={{ fontSize: '16px', marginRight: '5px' }} />;
|
|
|
|
return <DynamicIcon type="IconCloudDownload" style={{ fontSize: '16px', marginRight: '5px' }} />;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const CodeNode = ({ data, id }: { data: any; id: string }) => {
|
|
|
|
const RestNode = ({ data, id }: { data: any; id: string }) => {
|
|
|
|
const title = data.title || 'REST调用';
|
|
|
|
const title = data.title || 'REST调用';
|
|
|
|
|
|
|
|
|
|
|
|
// 获取节点选中状态 - 适配React Flow v12 API
|
|
|
|
// 获取节点选中状态 - 适配React Flow v12 API
|
|
|
|
@ -16,15 +18,26 @@ const CodeNode = ({ data, id }: { data: any; id: string }) => {
|
|
|
|
state.nodeLookup.get(id)?.selected || false
|
|
|
|
state.nodeLookup.get(id)?.selected || false
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取节点运行状态
|
|
|
|
|
|
|
|
const nodeStatus: NodeStatus = useFlowStore((state) =>
|
|
|
|
|
|
|
|
(state.nodeLookup.get(id)?.data?.status as NodeStatus) || 'waiting'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取运行状态可见性
|
|
|
|
|
|
|
|
const isStatusVisible = useFlowStore((state) =>
|
|
|
|
|
|
|
|
!!state.nodeLookup.get(id)?.data?.isStatusVisible
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={`${styles['node-container']} ${isSelected ? styles.selected : ''}`}>
|
|
|
|
<div className={`${styles['node-container']} ${isSelected ? styles.selected : ''}`}>
|
|
|
|
<div className={styles['node-header']} style={{ backgroundColor: '#1890ff' }}>
|
|
|
|
<div className={styles['node-header']} style={{ backgroundColor: '#1890ff' }}>
|
|
|
|
{setIcon()}
|
|
|
|
{setIcon()}
|
|
|
|
{title}
|
|
|
|
{title}
|
|
|
|
|
|
|
|
<NodeStatusIndicator status={nodeStatus} isVisible={isStatusVisible} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<NodeContentREST data={data} />
|
|
|
|
<NodeContentREST data={data} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default CodeNode;
|
|
|
|
export default RestNode;
|