@yiyi_zhang/reactflow-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -0
- package/dist/WorkflowIDE.d.ts +108 -0
- package/dist/components/AICopilot/AIChatPanel.d.ts +8 -0
- package/dist/components/AICopilot/ParameterSuggester.d.ts +16 -0
- package/dist/components/ConfirmDialog.d.ts +7 -0
- package/dist/components/Controls/ActionBar.d.ts +10 -0
- package/dist/components/Controls/ControlButton.d.ts +13 -0
- package/dist/components/Controls/ControlHub.d.ts +3 -0
- package/dist/components/Editor/NodeSelector.d.ts +8 -0
- package/dist/components/EmptyStatePanel.d.ts +7 -0
- package/dist/components/ExecutionStatusBar.d.ts +5 -0
- package/dist/components/ExecutionTaskPanel.d.ts +5 -0
- package/dist/components/HealthCheckPanel.d.ts +12 -0
- package/dist/components/TaskDetailPanel.d.ts +11 -0
- package/dist/components/Toast.d.ts +11 -0
- package/dist/components/WorkflowDesigner.d.ts +15 -0
- package/dist/components/WorkflowSettingsPanel.d.ts +10 -0
- package/dist/components/edges/AddableEdge.d.ts +8 -0
- package/dist/components/nodes/DecisionNode.d.ts +5 -0
- package/dist/components/nodes/ExecutionStatusBadge.d.ts +7 -0
- package/dist/components/nodes/ForkJoinNode.d.ts +16 -0
- package/dist/components/nodes/LoopNode.d.ts +5 -0
- package/dist/components/nodes/NodeLayout.d.ts +16 -0
- package/dist/components/nodes/NodeWrapper.d.ts +15 -0
- package/dist/components/nodes/SubWorkflowNode.d.ts +5 -0
- package/dist/components/nodes/TaskNode.d.ts +5 -0
- package/dist/config/taskTypes.d.ts +14 -0
- package/dist/hooks/useConfirm.d.ts +14 -0
- package/dist/hooks/useNodeExecution.d.ts +8 -0
- package/dist/hooks/useNodeLayout.d.ts +10 -0
- package/dist/hooks/useShortcuts.d.ts +11 -0
- package/dist/hooks/useToast.d.ts +9 -0
- package/dist/index.d.ts +5 -0
- package/dist/layout/autoLayout.d.ts +22 -0
- package/dist/parser/conductorGenerator.d.ts +28 -0
- package/dist/parser/conductorParser.d.ts +24 -0
- package/dist/reactflow-ui.css +1 -0
- package/dist/reactflow-ui.es.js +11035 -0
- package/dist/reactflow-ui.umd.js +229 -0
- package/dist/sample-workflows/complex-workflow.json +210 -0
- package/dist/sample-workflows/decision-workflow.json +118 -0
- package/dist/sample-workflows/fork-join-workflow.json +112 -0
- package/dist/sample-workflows/sample-execution.json +327 -0
- package/dist/sample-workflows/simple-workflow.json +42 -0
- package/dist/services/aiService.d.ts +24 -0
- package/dist/services/promptTemplates.d.ts +6 -0
- package/dist/store/workflowStore.d.ts +30 -0
- package/dist/types/conductor.d.ts +170 -0
- package/dist/types/workflow.d.ts +165 -0
- package/dist/utils/validationRules.d.ts +85 -0
- package/dist/utils/validator.d.ts +6 -0
- package/dist/vite.svg +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Node, Edge, Position } from 'reactflow';
|
|
2
|
+
import { WorkflowDef, TaskDef, WorkflowInstance, TaskInstance } from './conductor';
|
|
3
|
+
/**
|
|
4
|
+
* 布局方向
|
|
5
|
+
*/
|
|
6
|
+
export type LayoutDirection = 'TB' | 'LR';
|
|
7
|
+
/**
|
|
8
|
+
* 编辑模式
|
|
9
|
+
*/
|
|
10
|
+
export type EditorMode = 'view' | 'edit' | 'run';
|
|
11
|
+
/**
|
|
12
|
+
* 执行状态(Conductor OSS TaskStatus)
|
|
13
|
+
*/
|
|
14
|
+
export type ExecutionStatus = 'SCHEDULED' | 'IN_PROGRESS' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'FAILED' | 'FAILED_WITH_TERMINAL_ERROR' | 'TIMED_OUT' | 'SKIPPED' | 'CANCELED';
|
|
15
|
+
/**
|
|
16
|
+
* 任务执行数据
|
|
17
|
+
*/
|
|
18
|
+
export interface TaskExecutionData {
|
|
19
|
+
taskReferenceName: string;
|
|
20
|
+
status: ExecutionStatus;
|
|
21
|
+
attempts: TaskInstance[];
|
|
22
|
+
startTime?: number;
|
|
23
|
+
endTime?: number;
|
|
24
|
+
output?: any;
|
|
25
|
+
input?: any;
|
|
26
|
+
reasonForIncompletion?: string;
|
|
27
|
+
iteration?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 解析结果
|
|
31
|
+
*/
|
|
32
|
+
export interface ParserResult {
|
|
33
|
+
nodes: WorkflowNode[];
|
|
34
|
+
edges: Edge[];
|
|
35
|
+
taskMap: Record<string, TaskDef>;
|
|
36
|
+
nextId: number;
|
|
37
|
+
joinNodeId?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 校验条目
|
|
41
|
+
*/
|
|
42
|
+
export interface ValidationItem {
|
|
43
|
+
type: 'TASK' | 'GLOBAL';
|
|
44
|
+
ref: string;
|
|
45
|
+
message: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 校验结果
|
|
49
|
+
*/
|
|
50
|
+
export interface ValidationResults {
|
|
51
|
+
isValid: boolean;
|
|
52
|
+
errors: ValidationItem[];
|
|
53
|
+
warnings: ValidationItem[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 节点数据结构
|
|
57
|
+
*/
|
|
58
|
+
export interface WorkflowNodeData {
|
|
59
|
+
label: string;
|
|
60
|
+
taskReferenceName: string;
|
|
61
|
+
taskType: string;
|
|
62
|
+
task?: TaskDef;
|
|
63
|
+
layoutDirection: LayoutDirection;
|
|
64
|
+
isHighlighted?: boolean;
|
|
65
|
+
isError?: boolean;
|
|
66
|
+
hasWarning?: boolean;
|
|
67
|
+
isDynamic?: boolean;
|
|
68
|
+
subWorkflowName?: string;
|
|
69
|
+
loopOver?: TaskDef[];
|
|
70
|
+
loopCondition?: string;
|
|
71
|
+
decisionCases?: Record<string, TaskDef[]>;
|
|
72
|
+
sourcePosition?: Position;
|
|
73
|
+
targetPosition?: Position;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 强类型节点
|
|
77
|
+
*/
|
|
78
|
+
export type WorkflowNode = Node<WorkflowNodeData>;
|
|
79
|
+
/**
|
|
80
|
+
* 应用主题模式
|
|
81
|
+
* - `dark`: 暗色模式
|
|
82
|
+
* - `light`: 亮色模式
|
|
83
|
+
*/
|
|
84
|
+
export type ThemeMode = 'dark' | 'light';
|
|
85
|
+
/**
|
|
86
|
+
* 品牌主色调
|
|
87
|
+
* - `blue`: 科技蓝
|
|
88
|
+
* - `orange`: 活力橙
|
|
89
|
+
*/
|
|
90
|
+
export type ThemeColor = 'blue' | 'orange';
|
|
91
|
+
/**
|
|
92
|
+
* 工作流存储状态
|
|
93
|
+
*/
|
|
94
|
+
export interface WorkflowState {
|
|
95
|
+
mode: EditorMode;
|
|
96
|
+
workflowDef: WorkflowDef | null;
|
|
97
|
+
workflowInstance: WorkflowInstance | null;
|
|
98
|
+
nodes: WorkflowNode[];
|
|
99
|
+
edges: Edge[];
|
|
100
|
+
taskMap: Record<string, TaskDef>;
|
|
101
|
+
layoutDirection: LayoutDirection;
|
|
102
|
+
selectedTask: TaskDef | null;
|
|
103
|
+
selectedTaskInstance: TaskInstance | null;
|
|
104
|
+
executionData: Record<string, TaskExecutionData> | null;
|
|
105
|
+
validationResults: ValidationResults;
|
|
106
|
+
theme: ThemeMode;
|
|
107
|
+
themeColor: ThemeColor;
|
|
108
|
+
edgeType: string;
|
|
109
|
+
nodesLocked: boolean;
|
|
110
|
+
copiedTask: TaskDef | null;
|
|
111
|
+
isDetailPanelOpen: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 工作流操作接口
|
|
115
|
+
*/
|
|
116
|
+
export interface WorkflowActions {
|
|
117
|
+
setWorkflow: (workflowJson: any, direction?: LayoutDirection) => void;
|
|
118
|
+
setMode: (mode: EditorMode) => void;
|
|
119
|
+
setExecutionData: (data: Record<string, TaskExecutionData> | null) => void;
|
|
120
|
+
updateTaskStatus: (taskRef: string, status: ExecutionStatus) => void;
|
|
121
|
+
loadSampleExecution: () => Promise<void>;
|
|
122
|
+
importExecutionJSON: (json: any) => void;
|
|
123
|
+
setLayoutDirection: (direction: LayoutDirection) => void;
|
|
124
|
+
onNodesChange: (changes: any) => void;
|
|
125
|
+
onEdgesChange: (changes: any) => void;
|
|
126
|
+
onConnect: (connection: any) => void;
|
|
127
|
+
setSelectedTask: (task: TaskDef | null) => void;
|
|
128
|
+
setSelectedTaskInstance: (instance: TaskInstance | null) => void;
|
|
129
|
+
checkTaskRefUniqueness: (newRef: string, currentRef: string) => boolean;
|
|
130
|
+
updateTask: (taskRef: string, field: string | Record<string, any>, value?: any) => void;
|
|
131
|
+
updateWorkflowProperties: (properties: Partial<WorkflowDef>) => void;
|
|
132
|
+
addNode: (newNode: any, sourceId: string, targetId: string, edgeId: string, edgeData?: any) => void;
|
|
133
|
+
removeNode: (nodeId: string) => void;
|
|
134
|
+
addLoopTask: (loopRef: string, taskType: string) => void;
|
|
135
|
+
removeLoopTask: (loopRef: string, taskRef: string) => void;
|
|
136
|
+
addDecisionBranch: (taskRef: string, caseName: string) => void;
|
|
137
|
+
removeDecisionBranch: (taskRef: string, caseName: string) => void;
|
|
138
|
+
addForkBranch: (taskRef: string) => void;
|
|
139
|
+
copyTask: (task: TaskDef) => void;
|
|
140
|
+
pasteTask: (task: TaskDef) => void;
|
|
141
|
+
setTheme: (theme: ThemeMode) => void;
|
|
142
|
+
setThemeColor: (color: ThemeColor) => void;
|
|
143
|
+
setEdgeType: (edgeType: string) => void;
|
|
144
|
+
setNodesLocked: (nodesLocked: boolean) => void;
|
|
145
|
+
createBlankWorkflow: (name?: string) => void;
|
|
146
|
+
applyAIGeneratedWorkflow: (workflowJson: any) => void;
|
|
147
|
+
setIsDetailPanelOpen: (isOpen: boolean) => void;
|
|
148
|
+
selectTaskAction: (task: TaskDef | null, openPanel?: boolean) => void;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 运行态操作回调
|
|
152
|
+
* 集成方通过此接口注入工作流执行操作(暂停/恢复/停止/重试/重启)的回调函数。
|
|
153
|
+
* 未传入的回调对应的按钮不会渲染。
|
|
154
|
+
*/
|
|
155
|
+
export interface ExecutionActions {
|
|
156
|
+
onRestart?: (workflowId: string) => void;
|
|
157
|
+
onPause?: (workflowId: string) => void;
|
|
158
|
+
onResume?: (workflowId: string) => void;
|
|
159
|
+
onTerminate?: (workflowId: string) => void;
|
|
160
|
+
onRetry?: (workflowId: string) => void;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 组合 Store 类型
|
|
164
|
+
*/
|
|
165
|
+
export type WorkflowStore = WorkflowState & WorkflowActions;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conductor 校验规则配置
|
|
3
|
+
*/
|
|
4
|
+
export declare const WORKFLOW_RULES: ({
|
|
5
|
+
field: string;
|
|
6
|
+
type: string;
|
|
7
|
+
message: string;
|
|
8
|
+
value?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
field: string;
|
|
11
|
+
type: string;
|
|
12
|
+
value: number;
|
|
13
|
+
message: string;
|
|
14
|
+
})[];
|
|
15
|
+
export declare const TASK_RULES: {
|
|
16
|
+
common: ({
|
|
17
|
+
field: string;
|
|
18
|
+
type: string;
|
|
19
|
+
message: string;
|
|
20
|
+
value?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
field: string;
|
|
23
|
+
type: string;
|
|
24
|
+
value: RegExp;
|
|
25
|
+
message: string;
|
|
26
|
+
})[];
|
|
27
|
+
types: {
|
|
28
|
+
HTTP: ({
|
|
29
|
+
field: string;
|
|
30
|
+
type: string;
|
|
31
|
+
message: string;
|
|
32
|
+
level?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
field: string;
|
|
35
|
+
type: string;
|
|
36
|
+
level: string;
|
|
37
|
+
message: string;
|
|
38
|
+
})[];
|
|
39
|
+
LAMBDA: {
|
|
40
|
+
field: string;
|
|
41
|
+
type: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}[];
|
|
44
|
+
JSON_JQ_TRANSFORM: {
|
|
45
|
+
field: string;
|
|
46
|
+
type: string;
|
|
47
|
+
message: string;
|
|
48
|
+
}[];
|
|
49
|
+
SUB_WORKFLOW: {
|
|
50
|
+
field: string;
|
|
51
|
+
type: string;
|
|
52
|
+
message: string;
|
|
53
|
+
}[];
|
|
54
|
+
TERMINATE: ({
|
|
55
|
+
field: string;
|
|
56
|
+
type: string;
|
|
57
|
+
level: string;
|
|
58
|
+
message: string;
|
|
59
|
+
value?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
field: string;
|
|
62
|
+
type: string;
|
|
63
|
+
value: string[];
|
|
64
|
+
message: string;
|
|
65
|
+
level?: undefined;
|
|
66
|
+
})[];
|
|
67
|
+
DO_WHILE: {
|
|
68
|
+
field: string;
|
|
69
|
+
type: string;
|
|
70
|
+
message: string;
|
|
71
|
+
}[];
|
|
72
|
+
DECISION: {
|
|
73
|
+
field: string;
|
|
74
|
+
type: string;
|
|
75
|
+
validate: (val: any) => boolean;
|
|
76
|
+
message: string;
|
|
77
|
+
}[];
|
|
78
|
+
SWITCH: {
|
|
79
|
+
field: string;
|
|
80
|
+
type: string;
|
|
81
|
+
validate: (val: any) => boolean;
|
|
82
|
+
message: string;
|
|
83
|
+
}[];
|
|
84
|
+
};
|
|
85
|
+
};
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yiyi_zhang/reactflow-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Conductor Workflow IDE — a visual workflow designer built with React 19, ReactFlow and Zustand for editing, validating and monitoring Netflix Conductor workflows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"conductor",
|
|
7
|
+
"workflow",
|
|
8
|
+
"reactflow",
|
|
9
|
+
"react",
|
|
10
|
+
"visual-editor",
|
|
11
|
+
"dag"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/yiyisf/reactflow-ui.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/yiyisf/reactflow-ui#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/yiyisf/reactflow-ui/issues"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/reactflow-ui.umd.js",
|
|
24
|
+
"module": "./dist/reactflow-ui.es.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/reactflow-ui.es.js",
|
|
30
|
+
"require": "./dist/reactflow-ui.umd.js"
|
|
31
|
+
},
|
|
32
|
+
"./style.css": "./dist/reactflow-ui.css"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "vite",
|
|
39
|
+
"build": "tsc && vite build && tsc -p tsconfig.build.json",
|
|
40
|
+
"lint": "eslint .",
|
|
41
|
+
"preview": "vite preview"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"dagre": "^0.8.5",
|
|
45
|
+
"lucide-react": "^0.562.0",
|
|
46
|
+
"react-hotkeys-hook": "^5.2.1",
|
|
47
|
+
"zundo": "^2.3.0",
|
|
48
|
+
"zustand": "^5.0.9"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
52
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
53
|
+
"reactflow": "^11.11.4"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@eslint/js": "^9.39.1",
|
|
57
|
+
"@types/dagre": "^0.7.53",
|
|
58
|
+
"@types/react": "^19.2.5",
|
|
59
|
+
"@types/react-dom": "^19.2.3",
|
|
60
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
61
|
+
"eslint": "^9.39.1",
|
|
62
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
63
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
64
|
+
"globals": "^16.5.0",
|
|
65
|
+
"react": "^19.2.0",
|
|
66
|
+
"react-dom": "^19.2.0",
|
|
67
|
+
"reactflow": "^11.11.4",
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"vite": "^7.2.4"
|
|
70
|
+
}
|
|
71
|
+
}
|