@kestra-io/ui-libs 0.0.23 → 0.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kestra-io/ui-libs",
3
- "version": "v0.0.23",
3
+ "version": "v0.0.24",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -353,10 +353,44 @@ export default class VueFlowUtils {
353
353
  const rawClusters = clusters.map(c => c.cluster);
354
354
  const readOnlyUidPrefixes = rawClusters.filter(c => c.type.endsWith("SubflowGraphCluster")).map(c => c.taskNode.uid);
355
355
 
356
- const nodeByUid = {};
357
- for (const node of flowGraph.nodes.concat(clusterToNode)) {
358
- nodeByUid[node.uid] = node;
356
+ const nodeByUid = Object.fromEntries(flowGraph.nodes.concat(clusterToNode).map(node => [node.uid, node]));
357
+ for (let cluster of clusters) {
358
+ if (!edgeReplacer[cluster.cluster.uid] && !collapsed.has(cluster.cluster.uid)) {
359
+ if (cluster.cluster.taskNode?.task?.type === "io.kestra.core.tasks.flows.Dag") {
360
+ readOnlyUidPrefixes.push(cluster.cluster.taskNode.uid);
361
+ }
362
+
363
+ for (let nodeUid of cluster.nodes) {
364
+ clusterByNodeUid[nodeUid] = cluster.cluster;
365
+ }
359
366
 
367
+ const clusterUid = cluster.cluster.uid;
368
+ const dagreNode = dagreGraph.node(clusterUid)
369
+ const parentNode = cluster.parents ? cluster.parents[cluster.parents.length - 1] : undefined;
370
+
371
+ const clusterColor = this.computeClusterColor(cluster.cluster);
372
+
373
+ elements.push({
374
+ id: clusterUid,
375
+ type: "cluster",
376
+ parentNode: parentNode,
377
+ position: this.getNodePosition(dagreNode, parentNode ? dagreGraph.node(parentNode) : undefined),
378
+ style: {
379
+ width: clusterUid === TRIGGERS_NODE_UID && isHorizontal ? NODE_SIZES.TRIGGER_CLUSTER_WIDTH + "px" : dagreNode.width + "px",
380
+ height: clusterUid === TRIGGERS_NODE_UID && !isHorizontal ? NODE_SIZES.TRIGGER_CLUSTER_HEIGHT + "px" : dagreNode.height + "px"
381
+ },
382
+ data: {
383
+ collapsable: true,
384
+ color: clusterColor,
385
+ taskNode: cluster.cluster.taskNode,
386
+ unused: nodeByUid[cluster.cluster.taskNode.uid].unused
387
+ },
388
+ class: `bg-light-${clusterColor}-border rounded p-2`,
389
+ })
390
+ }
391
+ }
392
+
393
+ for (const node of flowGraph.nodes.concat(clusterToNode)) {
360
394
  if (!hiddenNodes.includes(node.uid)) {
361
395
  const dagreNode = dagreGraph.node(node.uid);
362
396
  let nodeType = "task";
@@ -399,42 +433,6 @@ export default class VueFlowUtils {
399
433
  }
400
434
  }
401
435
 
402
- for (let cluster of clusters) {
403
- if (!edgeReplacer[cluster.cluster.uid] && !collapsed.has(cluster.cluster.uid)) {
404
- if (cluster.cluster.taskNode?.task?.type === "io.kestra.core.tasks.flows.Dag") {
405
- readOnlyUidPrefixes.push(cluster.cluster.taskNode.uid);
406
- }
407
-
408
- for (let nodeUid of cluster.nodes) {
409
- clusterByNodeUid[nodeUid] = cluster.cluster;
410
- }
411
-
412
- const clusterUid = cluster.cluster.uid;
413
- const dagreNode = dagreGraph.node(clusterUid)
414
- const parentNode = cluster.parents ? cluster.parents[cluster.parents.length - 1] : undefined;
415
-
416
- const clusterColor = this.computeClusterColor(cluster.cluster);
417
-
418
- elements.push({
419
- id: clusterUid,
420
- type: "cluster",
421
- parentNode: parentNode,
422
- position: this.getNodePosition(dagreNode, parentNode ? dagreGraph.node(parentNode) : undefined),
423
- style: {
424
- width: clusterUid === TRIGGERS_NODE_UID && isHorizontal ? NODE_SIZES.TRIGGER_CLUSTER_WIDTH + "px" : dagreNode.width + "px",
425
- height: clusterUid === TRIGGERS_NODE_UID && !isHorizontal ? NODE_SIZES.TRIGGER_CLUSTER_HEIGHT + "px" : dagreNode.height + "px"
426
- },
427
- data: {
428
- collapsable: true,
429
- color: clusterColor,
430
- taskNode: cluster.cluster.taskNode,
431
- unused: nodeByUid[cluster.cluster.taskNode.uid].unused
432
- },
433
- class: `bg-light-${clusterColor}-border rounded p-2`,
434
- })
435
- }
436
- }
437
-
438
436
  const clusterRootTaskNodeUids = rawClusters.filter(c => c.taskNode).map(c => c.taskNode.uid);
439
437
  const edges = flowGraph.edges ?? [];
440
438