Skip to content

Commit

Permalink
modify selected workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tlakshmi authored and tlakshmi committed Nov 21, 2024
1 parent 9320696 commit 2fd0220
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@anywidget/react": "^0.0.7",
"@xyflow/react": "^12.0.4",
"@xyflow/react": "^12.3.5",
"elkjs": "^0.9.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
21 changes: 18 additions & 3 deletions pyironflow/reactflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,31 @@ def get_selected_workflow(self):

wf = Workflow(workflow_label)
dict_nodes = json.loads(self.gui.selected_nodes)
print(dict_nodes)
node_labels = []
for dict_node in dict_nodes:
node = dict_to_node(dict_node)
wf.add_child(node)
node_labels.append(dict_node["data"]["label"])
# wf.add_child(node(label=node.label))
print("Nodes:")
print(node_labels)
print("\n")

nodes = wf._children
dict_edges = json.loads(self.gui.selected_edges)
print(dict_edges)
for dict_edge in dict_edges:
subset_dict_edges = []
edge_labels = []
for edge in dict_edges:
if edge["source"] in node_labels and edge["target"] in node_labels:
subset_dict_edges.append(edge)
edge_labels.append(edge["id"])
print("Edges:")
print(edge_labels)
print("\n")

for dict_edge in subset_dict_edges:
dict_to_edge(dict_edge, nodes)
print("Sub-workflow:")
print(wf)

return wf

0 comments on commit 2fd0220

Please sign in to comment.