darabos commited on
Commit
83cc307
·
1 Parent(s): 1ac38b4

SvelteFlow renamed parentNode to parentId.

Browse files
server/workspace.py CHANGED
@@ -27,7 +27,7 @@ class WorkspaceNode(BaseConfig):
27
  type: str
28
  data: WorkspaceNodeData
29
  position: Position
30
- parentNode: Optional[str] = None
31
 
32
  class WorkspaceEdge(BaseConfig):
33
  id: str
@@ -41,11 +41,11 @@ class Workspace(BaseConfig):
41
 
42
  def execute(ws):
43
  # Nodes are responsible for interpreting/executing their child nodes.
44
- nodes = [n for n in ws.nodes if not n.parentNode]
45
  children = {}
46
  for n in ws.nodes:
47
- if n.parentNode:
48
- children.setdefault(n.parentNode, []).append(n)
49
  outputs = {}
50
  failed = 0
51
  while len(outputs) + failed < len(nodes):
 
27
  type: str
28
  data: WorkspaceNodeData
29
  position: Position
30
+ parentId: Optional[str] = None
31
 
32
  class WorkspaceEdge(BaseConfig):
33
  id: str
 
41
 
42
  def execute(ws):
43
  # Nodes are responsible for interpreting/executing their child nodes.
44
+ nodes = [n for n in ws.nodes if not n.parentId]
45
  children = {}
46
  for n in ws.nodes:
47
+ if n.parentId:
48
+ children.setdefault(n.parentId, []).append(n)
49
  outputs = {}
50
  failed = 0
51
  while len(outputs) + failed < len(nodes):
web/src/LynxKiteFlow.svelte CHANGED
@@ -77,10 +77,10 @@
77
  i += 1;
78
  node.id = `${title} ${i}`;
79
  }
80
- node.parentNode = nodeSearchSettings.parentNode;
81
- if (node.parentNode) {
82
  node.extent = 'parent';
83
- const parent = n.find((x) => x.id === node.parentNode);
84
  node.position = { x: node.position.x - parent.position.x, y: node.position.y - parent.position.y };
85
  }
86
  return [...n, node]
@@ -98,7 +98,7 @@
98
  let nodeSearchSettings: {
99
  pos: XYPosition,
100
  boxes: any[],
101
- parentNode: string,
102
  };
103
 
104
  const graph = derived([nodes, edges], ([nodes, edges]) => ({ nodes, edges }));
@@ -158,7 +158,7 @@
158
  nodeSearchSettings = {
159
  pos: { x: event.clientX, y: event.clientY },
160
  boxes: sub_nodes,
161
- parentNode: node.id,
162
  };
163
  }
164
 
 
77
  i += 1;
78
  node.id = `${title} ${i}`;
79
  }
80
+ node.parentId = nodeSearchSettings.parentId;
81
+ if (node.parentId) {
82
  node.extent = 'parent';
83
+ const parent = n.find((x) => x.id === node.parentId);
84
  node.position = { x: node.position.x - parent.position.x, y: node.position.y - parent.position.y };
85
  }
86
  return [...n, node]
 
98
  let nodeSearchSettings: {
99
  pos: XYPosition,
100
  boxes: any[],
101
+ parentId: string,
102
  };
103
 
104
  const graph = derived([nodes, edges], ([nodes, edges]) => ({ nodes, edges }));
 
158
  nodeSearchSettings = {
159
  pos: { x: event.clientX, y: event.clientY },
160
  boxes: sub_nodes,
161
+ parentId: node.id,
162
  };
163
  }
164
 
web/src/NodeWithSubFlow.svelte CHANGED
@@ -10,7 +10,7 @@
10
  isExpanded = expanded;
11
  nodes.update((n) =>
12
  n.map((node) =>
13
- node.parentNode === id
14
  ? { ...node, hidden: !expanded }
15
  : node));
16
  }
@@ -18,7 +18,7 @@
18
  let width = 200;
19
  let height = 200;
20
  for (const node of nodes) {
21
- if (node.parentNode === id) {
22
  width = Math.max(width, node.position.x + 300);
23
  height = Math.max(height, node.position.y + 200);
24
  }
 
10
  isExpanded = expanded;
11
  nodes.update((n) =>
12
  n.map((node) =>
13
+ node.parentId === id
14
  ? { ...node, hidden: !expanded }
15
  : node));
16
  }
 
18
  let width = 200;
19
  let height = 200;
20
  for (const node of nodes) {
21
+ if (node.parentId === id) {
22
  width = Math.max(width, node.position.x + 300);
23
  height = Math.max(height, node.position.y + 200);
24
  }