1
This commit is contained in:
parent
337320bfcd
commit
c7bbdb3444
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { NodeCategory } from '../types';
|
||||
import { NODE_DEFINITIONS } from '../nodes';
|
||||
import { NodeCategory } from '../nodes/types';
|
||||
import type { WorkflowNodeDefinition } from '../nodes/types';
|
||||
|
||||
interface NodePanelProps {
|
||||
|
||||
@ -2,8 +2,7 @@ import { useCallback, useState } from 'react';
|
||||
import { message } from 'antd';
|
||||
import * as definitionService from '../../Definition/service';
|
||||
import type { FlowNode, FlowEdge } from '../types';
|
||||
import { NodeType } from '../types';
|
||||
import { isConfigurableNode } from '../nodes/types';
|
||||
import { NodeType, isConfigurableNode } from '../nodes/types';
|
||||
|
||||
interface WorkflowSaveData {
|
||||
nodes: FlowNode[];
|
||||
|
||||
@ -152,23 +152,6 @@ export interface ConfigurableNodeDefinition extends BaseNodeDefinition {
|
||||
// 工作流节点定义(联合类型)
|
||||
export type WorkflowNodeDefinition = BaseNodeDefinition | ConfigurableNodeDefinition;
|
||||
|
||||
// 节点实例数据(运行时)
|
||||
export interface NodeInstanceData {
|
||||
nodeCode: string;
|
||||
nodeName: string;
|
||||
nodeType: NodeType;
|
||||
category: NodeCategory;
|
||||
description?: string;
|
||||
|
||||
// 运行时数据
|
||||
configs?: Record<string, any>; // 基本配置数据(包含基本信息+节点配置)
|
||||
inputMapping?: Record<string, any>; // 输入映射(用户配置)
|
||||
outputs?: OutputField[]; // 输出能力定义(从节点定义中获取)
|
||||
|
||||
// UI位置信息
|
||||
position: { x: number; y: number };
|
||||
}
|
||||
|
||||
// 判断是否为可配置节点
|
||||
export const isConfigurableNode = (def: WorkflowNodeDefinition): def is ConfigurableNodeDefinition => {
|
||||
return 'inputMappingSchema' in def || 'outputs' in def;
|
||||
|
||||
@ -1,38 +1,7 @@
|
||||
import type { Node, Edge } from '@xyflow/react';
|
||||
import type { NodeType, NodeCategory } from './nodes/types';
|
||||
|
||||
// 节点类型枚举 - 与原有系统保持一致
|
||||
export enum NodeType {
|
||||
START_EVENT = 'START_EVENT',
|
||||
END_EVENT = 'END_EVENT',
|
||||
USER_TASK = 'USER_TASK',
|
||||
SERVICE_TASK = 'SERVICE_TASK',
|
||||
SCRIPT_TASK = 'SCRIPT_TASK',
|
||||
DEPLOY_NODE = 'DEPLOY_NODE',
|
||||
JENKINS_BUILD = 'JENKINS_BUILD',
|
||||
NOTIFICATION = 'NOTIFICATION',
|
||||
GATEWAY_NODE = 'GATEWAY_NODE',
|
||||
SUB_PROCESS = 'SUB_PROCESS',
|
||||
CALL_ACTIVITY = 'CALL_ACTIVITY'
|
||||
}
|
||||
|
||||
// 节点分类
|
||||
export enum NodeCategory {
|
||||
EVENT = 'EVENT',
|
||||
TASK = 'TASK',
|
||||
GATEWAY = 'GATEWAY',
|
||||
CONTAINER = 'CONTAINER'
|
||||
}
|
||||
|
||||
// 节点定义数据结构
|
||||
export interface NodeDefinitionData {
|
||||
nodeCode: string;
|
||||
nodeName: string;
|
||||
nodeType: NodeType;
|
||||
category: NodeCategory;
|
||||
description?: string;
|
||||
icon: string;
|
||||
color: string;
|
||||
}
|
||||
// ✅ NodeType 和 NodeCategory 已从 nodes/types.ts 导入,避免重复定义
|
||||
|
||||
// React Flow 节点数据 - 添加索引签名以满足React Flow的类型约束
|
||||
export interface FlowNodeData extends Record<string, unknown> {
|
||||
@ -68,12 +37,6 @@ export type FlowNode = Node<FlowNodeData>;
|
||||
// 扩展的React Flow边类型
|
||||
export type FlowEdge = Edge<FlowEdgeData>;
|
||||
|
||||
// 工作流画布数据
|
||||
export interface WorkflowFlowData {
|
||||
nodes: FlowNode[];
|
||||
edges: FlowEdge[];
|
||||
}
|
||||
|
||||
// 节点配置模态框属性
|
||||
export interface NodeConfigModalProps {
|
||||
visible: boolean;
|
||||
@ -90,31 +53,4 @@ export interface EdgeConfigModalProps {
|
||||
onOk: (edge: FlowEdge, updatedData: Partial<FlowEdgeData>) => void;
|
||||
}
|
||||
|
||||
// 工具栏操作类型
|
||||
export interface ToolbarActions {
|
||||
onSave: () => void;
|
||||
onUndo: () => void;
|
||||
onRedo: () => void;
|
||||
onZoomIn: () => void;
|
||||
onZoomOut: () => void;
|
||||
onFitView: () => void;
|
||||
onCopy: () => void;
|
||||
onPaste: () => void;
|
||||
onDelete: () => void;
|
||||
onBack: () => void;
|
||||
}
|
||||
|
||||
// 画布状态
|
||||
export interface CanvasState {
|
||||
zoom: number;
|
||||
canUndo: boolean;
|
||||
canRedo: boolean;
|
||||
selectedNodes: FlowNode[];
|
||||
selectedEdges: FlowEdge[];
|
||||
}
|
||||
|
||||
// 节点拖拽数据
|
||||
export interface DragNodeData {
|
||||
nodeType: NodeType;
|
||||
nodeDefinition: NodeDefinitionData;
|
||||
}
|
||||
// ✅ 已删除未使用的类型:ToolbarActions, CanvasState, DragNodeData
|
||||
|
||||
Loading…
Reference in New Issue
Block a user