@@ -1157,7 +1157,46 @@ export default {
1157
1157
})
1158
1158
const edges = this .getGraphEdges ()
1159
1159
1160
- // ----------------------------------------
1160
+ for (const cycle of this .collapseCycle ) {
1161
+ const cycleNode = this .cylcTree .$index [
1162
+ this .workflows [0 ].tokens .clone ({ cycle }).id
1163
+ ]
1164
+ if (! cycleNode) continue
1165
+ // ---------------REMOVE NODES BASED ON CYCLE POINT------------
1166
+ // must do this before removing nodes/edges based on family as cycle collapsing takes priority over families
1167
+ for (const { id } of this .allChildrenLookUp [cycleNode .id ]) {
1168
+ if (id !== cycleNode .id ) {
1169
+ // REMOVE NODES
1170
+ nodes = nodes .filter ((node ) => node .id !== id)
1171
+ // REMOVE EDGES
1172
+ // if there is an edge with a source or target it needs removing
1173
+ for (const edge of this .removeEdges (id, edges)) {
1174
+ // ---------------ADD EDGES BASED ON CYCLE POINT------------
1175
+ // prevent self-loop edges:
1176
+ if (edge .source .cycle === edge .target .cycle ) continue
1177
+
1178
+ const sourceName = this .collapseCycle .includes (edge .source .cycle )
1179
+ ? edge .source .cycle
1180
+ : this .getCollapsedAncestor (edge .source .id ) ?? edge .source .task
1181
+ const targetName = this .collapseCycle .includes (edge .target .cycle )
1182
+ ? edge .target .cycle
1183
+ : this .getCollapsedAncestor (edge .target .id ) ?? edge .target .task
1184
+
1185
+ edges .set (
1186
+ ... this .createEdge ({
1187
+ sourceName,
1188
+ sourceCycle: edge .source .cycle ,
1189
+ targetName,
1190
+ targetCycle: edge .target .cycle ,
1191
+ })
1192
+ )
1193
+ }
1194
+ }
1195
+ }
1196
+ // ---------------ADD NODES BASED ON CYCLE POINT------------
1197
+ nodes .push (cycleNode)
1198
+ }
1199
+
1161
1200
for (const family of this .collapseFamily ) {
1162
1201
for (const cycle of this .cycles ) {
1163
1202
// ...get the node from the index...
@@ -1167,8 +1206,6 @@ export default {
1167
1206
if (! famNode) continue
1168
1207
// ...now we have a node - we have to understand all its relations in the graph...
1169
1208
// ---------------REMOVE NODES BASED ON FAMILY------------
1170
- // must do this before removing nodes and edges based on cycle as
1171
- // cycle collapsing takes priority of families
1172
1209
// ...this node is collapsed so need to remove any of its children
1173
1210
// (nodes and edges) from the graph if it has any...
1174
1211
for (const { id } of this .allChildrenLookUp [famNode .id ]) {
@@ -1208,46 +1245,6 @@ export default {
1208
1245
}
1209
1246
}
1210
1247
}
1211
- for (const cycle of this .collapseCycle ) {
1212
- const cycleNode = this .cylcTree .$index [
1213
- this .workflows [0 ].tokens .clone ({ cycle }).id
1214
- ]
1215
- if (! cycleNode) continue
1216
- // ---------------REMOVE NODES BASED ON CYCLE POINT------------
1217
- for (const { id } of this .allChildrenLookUp [cycleNode .id ]) {
1218
- if (id !== cycleNode .id ) {
1219
- // REMOVE NODES
1220
- nodes = nodes .filter ((node ) => node .id !== id)
1221
- // REMOVE EDGES
1222
- // if there is an edge with a source or target it needs removing
1223
- for (const edge of this .removeEdges (id, edges)) {
1224
- // ---------------ADD EDGES BASED ON CYCLE POINT------------
1225
- // prevent self-loop edges:
1226
- if (edge .source .cycle === edge .target .cycle ) continue
1227
-
1228
- const sourceName = this .collapseCycle .includes (edge .source .cycle )
1229
- ? edge .source .cycle
1230
- : this .getCollapsedAncestor (edge .source .id ) ?? edge .source .task
1231
- const targetName = this .collapseCycle .includes (edge .target .cycle )
1232
- ? edge .target .cycle
1233
- : this .getCollapsedAncestor (edge .target .id ) ?? edge .target .task
1234
-
1235
- edges .set (
1236
- ... this .createEdge ({
1237
- sourceName,
1238
- sourceCycle: edge .source .cycle ,
1239
- targetName,
1240
- targetCycle: edge .target .cycle ,
1241
- })
1242
- )
1243
- }
1244
- }
1245
- }
1246
- // ---------------ADD NODES BASED ON CYCLE POINT------------
1247
- nodes .push (cycleNode)
1248
- }
1249
-
1250
- // ----------------------------------------
1251
1248
1252
1249
if (! nodes || ! nodes .length ) {
1253
1250
// we can't graph this, reset and wait for something to draw
0 commit comments