balibabu
commited on
Commit
·
6430aeb
1
Parent(s):
996fe99
Feat: Delete useless code #4242 (#4267)
Browse files### What problem does this PR solve?
Feat: Delete useless code #4242
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/pages/workflow.less +0 -5
- web/src/pages/workflow.tsx +0 -151
- web/src/routes.ts +0 -5
web/src/pages/workflow.less
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
.react-flow-subflows-example {
|
| 2 |
-
.react-flow__node-group {
|
| 3 |
-
padding: 0;
|
| 4 |
-
}
|
| 5 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/src/pages/workflow.tsx
DELETED
|
@@ -1,151 +0,0 @@
|
|
| 1 |
-
import { useCallback } from 'react';
|
| 2 |
-
import ReactFlow, {
|
| 3 |
-
Background,
|
| 4 |
-
Controls,
|
| 5 |
-
Handle,
|
| 6 |
-
MiniMap,
|
| 7 |
-
NodeProps,
|
| 8 |
-
Position,
|
| 9 |
-
addEdge,
|
| 10 |
-
useEdgesState,
|
| 11 |
-
useNodesState,
|
| 12 |
-
} from 'reactflow';
|
| 13 |
-
import 'reactflow/dist/style.css';
|
| 14 |
-
|
| 15 |
-
import './workflow.less';
|
| 16 |
-
|
| 17 |
-
const initialNodes = [
|
| 18 |
-
{
|
| 19 |
-
id: '1',
|
| 20 |
-
type: 'input',
|
| 21 |
-
data: { label: 'Node 0' },
|
| 22 |
-
position: { x: 250, y: 5 },
|
| 23 |
-
className: 'light',
|
| 24 |
-
},
|
| 25 |
-
{
|
| 26 |
-
id: '2',
|
| 27 |
-
data: { label: 'Group A' },
|
| 28 |
-
position: { x: 100, y: 100 },
|
| 29 |
-
className: 'light',
|
| 30 |
-
style: { backgroundColor: 'rgba(255, 0, 0, 0.2)', width: 200, height: 200 },
|
| 31 |
-
},
|
| 32 |
-
{
|
| 33 |
-
id: '2a',
|
| 34 |
-
data: { label: 'Node A.1' },
|
| 35 |
-
position: { x: 10, y: 50 },
|
| 36 |
-
parentId: '2',
|
| 37 |
-
},
|
| 38 |
-
{
|
| 39 |
-
id: '3',
|
| 40 |
-
data: { label: 'Node 1' },
|
| 41 |
-
position: { x: 320, y: 100 },
|
| 42 |
-
className: 'light',
|
| 43 |
-
},
|
| 44 |
-
{
|
| 45 |
-
id: '4',
|
| 46 |
-
data: { label: 'Group B' },
|
| 47 |
-
position: { x: 320, y: 200 },
|
| 48 |
-
className: 'light',
|
| 49 |
-
style: { backgroundColor: 'rgba(255, 0, 0, 0.2)', width: 300, height: 300 },
|
| 50 |
-
type: 'group',
|
| 51 |
-
},
|
| 52 |
-
{
|
| 53 |
-
id: '4a',
|
| 54 |
-
data: { label: 'Node B.1' },
|
| 55 |
-
position: { x: 15, y: 65 },
|
| 56 |
-
className: 'light',
|
| 57 |
-
parentId: '4',
|
| 58 |
-
extent: 'parent',
|
| 59 |
-
draggable: false,
|
| 60 |
-
},
|
| 61 |
-
{
|
| 62 |
-
id: '4b',
|
| 63 |
-
data: { label: 'Group B.A' },
|
| 64 |
-
position: { x: 15, y: 120 },
|
| 65 |
-
className: 'light',
|
| 66 |
-
style: {
|
| 67 |
-
backgroundColor: 'rgba(255, 0, 255, 0.2)',
|
| 68 |
-
height: 150,
|
| 69 |
-
width: 270,
|
| 70 |
-
},
|
| 71 |
-
parentId: '4',
|
| 72 |
-
},
|
| 73 |
-
{
|
| 74 |
-
id: '4b1',
|
| 75 |
-
data: { label: 'Node B.A.1' },
|
| 76 |
-
position: { x: 20, y: 40 },
|
| 77 |
-
className: 'light',
|
| 78 |
-
parentId: '4b',
|
| 79 |
-
},
|
| 80 |
-
{
|
| 81 |
-
id: '4b2',
|
| 82 |
-
data: { label: 'Node B.A.2' },
|
| 83 |
-
position: { x: 100, y: 100 },
|
| 84 |
-
className: 'light',
|
| 85 |
-
parentId: '4b',
|
| 86 |
-
},
|
| 87 |
-
];
|
| 88 |
-
|
| 89 |
-
const initialEdges = [
|
| 90 |
-
{ id: 'e1-2', source: '1', target: '2', animated: true },
|
| 91 |
-
{ id: 'e1-3', source: '1', target: '3' },
|
| 92 |
-
{ id: 'e2a-4a', source: '2a', target: '4a' },
|
| 93 |
-
{ id: 'e3-4b', source: '3', target: '4b' },
|
| 94 |
-
{ id: 'e4a-4b1', source: '4a', target: '4b1' },
|
| 95 |
-
{ id: 'e4a-4b2', source: '4a', target: '4b2' },
|
| 96 |
-
{ id: 'e4b1-4b2', source: '4b1', target: '4b2' },
|
| 97 |
-
];
|
| 98 |
-
|
| 99 |
-
export function RagNode({ id, data, isConnectable = true }: NodeProps<any>) {
|
| 100 |
-
return (
|
| 101 |
-
<section className="ragflow-group w-full h-full">
|
| 102 |
-
<div className="h-10 bg-slate-200 text-orange-400">header</div>
|
| 103 |
-
<Handle
|
| 104 |
-
id="c"
|
| 105 |
-
type="source"
|
| 106 |
-
position={Position.Left}
|
| 107 |
-
isConnectable={isConnectable}
|
| 108 |
-
></Handle>
|
| 109 |
-
<Handle
|
| 110 |
-
type="source"
|
| 111 |
-
position={Position.Right}
|
| 112 |
-
isConnectable={isConnectable}
|
| 113 |
-
id="b"
|
| 114 |
-
></Handle>
|
| 115 |
-
<div className="w-full h-10">xxx</div>
|
| 116 |
-
</section>
|
| 117 |
-
);
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
const nodeTypes = { group: RagNode };
|
| 121 |
-
|
| 122 |
-
const NestedFlow = () => {
|
| 123 |
-
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
| 124 |
-
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
| 125 |
-
|
| 126 |
-
const onConnect = useCallback((connection) => {
|
| 127 |
-
setEdges((eds) => addEdge(connection, eds));
|
| 128 |
-
}, []);
|
| 129 |
-
|
| 130 |
-
return (
|
| 131 |
-
<ReactFlow
|
| 132 |
-
nodes={nodes}
|
| 133 |
-
edges={edges}
|
| 134 |
-
onNodesChange={onNodesChange}
|
| 135 |
-
onEdgesChange={onEdgesChange}
|
| 136 |
-
onConnect={onConnect}
|
| 137 |
-
className="react-flow-subflows-example"
|
| 138 |
-
fitView
|
| 139 |
-
onNodeClick={(node) => {
|
| 140 |
-
console.log(node);
|
| 141 |
-
}}
|
| 142 |
-
nodeTypes={nodeTypes}
|
| 143 |
-
>
|
| 144 |
-
<MiniMap />
|
| 145 |
-
<Controls />
|
| 146 |
-
<Background />
|
| 147 |
-
</ReactFlow>
|
| 148 |
-
);
|
| 149 |
-
};
|
| 150 |
-
|
| 151 |
-
export default NestedFlow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/src/routes.ts
CHANGED
|
@@ -246,11 +246,6 @@ const routes = [
|
|
| 246 |
},
|
| 247 |
],
|
| 248 |
},
|
| 249 |
-
{
|
| 250 |
-
path: '/workflow',
|
| 251 |
-
component: '@/pages/workflow',
|
| 252 |
-
layout: false,
|
| 253 |
-
},
|
| 254 |
];
|
| 255 |
|
| 256 |
export default routes;
|
|
|
|
| 246 |
},
|
| 247 |
],
|
| 248 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
];
|
| 250 |
|
| 251 |
export default routes;
|