|
|
|
|
@ -5,6 +5,8 @@ import DynamicIcon from '@/components/DynamicIcon';
|
|
|
|
|
import { Handle, Position } from '@xyflow/react';
|
|
|
|
|
import NodeContentSwitch from '@/pages/flowEditor/components/nodeContentSwitch';
|
|
|
|
|
import { defaultNodeTypes } from '@/components/FlowEditor/node/types/defaultType';
|
|
|
|
|
import NodeStatusIndicator, { NodeStatus } from '@/components/FlowEditor/NodeStatusIndicator';
|
|
|
|
|
import { useStore as useFlowStore } from '@xyflow/react';
|
|
|
|
|
|
|
|
|
|
// 循环节点组件,用于显示循环开始和循环结束节点
|
|
|
|
|
const SwitchNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => {
|
|
|
|
|
@ -15,6 +17,16 @@ const SwitchNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => {
|
|
|
|
|
const isSelected = useStore((state) =>
|
|
|
|
|
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
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 设置图标
|
|
|
|
|
const setIcon = () => {
|
|
|
|
|
@ -147,6 +159,7 @@ const SwitchNode = ({ data, id }: { data: defaultNodeTypes; id: string }) => {
|
|
|
|
|
<div className={styles['node-header']} style={{ backgroundColor: '#1890ff' }}>
|
|
|
|
|
{setIcon()}
|
|
|
|
|
{title}
|
|
|
|
|
<NodeStatusIndicator status={nodeStatus} isVisible={isStatusVisible} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<NodeContentSwitch data={modifiedData} />
|
|
|
|
|
|