@kestra-io/ui-libs 0.0.22 → 0.0.23

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.22",
3
+ "version": "v0.0.23",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -111,11 +111,6 @@
111
111
  data: {
112
112
  type: Object,
113
113
  required: true
114
- },
115
- style: {
116
- type: Object,
117
- required: false,
118
- default: undefined
119
114
  }
120
115
  },
121
116
  methods: {
@@ -173,6 +168,7 @@
173
168
  },
174
169
  classes() {
175
170
  return {
171
+ "unused-path": this.data.unused,
176
172
  [`border-${this.borderColor}`]: this.borderColor,
177
173
  "disabled": this.data.node.task?.disabled,
178
174
  [this.$attrs.class]: true
@@ -1,16 +1,18 @@
1
1
  <template>
2
- <span class="badge rounded-pill text-truncate text-color" :class="[`bg-${data.color}`]">{{ clusterName }}</span>
3
- <div class="top-button-div text-white d-flex">
4
- <span
5
- v-if="data.collapsable"
6
- class="rounded-button"
7
- :class="[`bg-${data.color}`]"
8
- @click="collapse()"
9
- >
10
- <tooltip :title="$t('collapse')">
11
- <ArrowCollapse class="button-icon" alt="Collapse task" />
12
- </tooltip>
13
- </span>
2
+ <div :class="classes">
3
+ <span class="badge rounded-pill text-truncate text-color" :class="[`bg-${data.color}`]">{{ clusterName }}</span>
4
+ <div class="top-button-div text-white d-flex">
5
+ <span
6
+ v-if="data.collapsable"
7
+ class="rounded-button"
8
+ :class="[`bg-${data.color}`]"
9
+ @click="collapse()"
10
+ >
11
+ <tooltip :title="$t('collapse')">
12
+ <ArrowCollapse class="button-icon" alt="Collapse task" />
13
+ </tooltip>
14
+ </span>
15
+ </div>
14
16
  </div>
15
17
  </template>
16
18
  <script setup>
@@ -55,6 +57,9 @@
55
57
  }
56
58
  },
57
59
  computed: {
60
+ classes() {
61
+ return {"unused-path": this.data.unused}
62
+ },
58
63
  clusterName() {
59
64
  const taskNode = this.data.taskNode;
60
65
  if (taskNode?.type?.endsWith("SubflowGraphTask")) {
@@ -1,9 +1,11 @@
1
1
  <template>
2
- <Handle type="source" class="custom-handle" :position="sourcePosition" />
3
- <div class="dot">
4
- <CircleIcon :class="{'text-danger': data.node.error}" class="circle" alt="circle" />
2
+ <div :class="classes">
3
+ <Handle type="source" class="custom-handle" :position="sourcePosition" />
4
+ <div class="dot">
5
+ <CircleIcon :class="{'text-danger': data.node.error}" class="circle" alt="circle" />
6
+ </div>
7
+ <Handle type="target" class="custom-handle" :position="targetPosition" />
5
8
  </div>
6
- <Handle type="target" class="custom-handle" :position="targetPosition" />
7
9
  </template>
8
10
 
9
11
  <script>
@@ -31,6 +33,11 @@
31
33
  type: String
32
34
  }
33
35
  },
36
+ computed: {
37
+ classes() {
38
+ return {"unused-path": this.data.unused};
39
+ }
40
+ }
34
41
  }
35
42
  </script>
36
43
  <style scoped>
@@ -35,6 +35,7 @@
35
35
  return {
36
36
  "vue-flow__edge-path": true,
37
37
  ["stroke-" + this.data.color]: this.data.color,
38
+ "unused-path": this.data.unused
38
39
  }
39
40
  },
40
41
  },
@@ -52,7 +53,7 @@
52
53
  <template>
53
54
  <path
54
55
  :id="id"
55
- :class="'vue-flow__edge-path stroke-'+data.color"
56
+ :class="classes"
56
57
  :style="data.haveDashArray ?
57
58
  {
58
59
  strokeDasharray: '2',
@@ -7,7 +7,6 @@
7
7
  import SplitCellsHorizontal from "../../assets/icons/SplitCellsHorizontal.vue";
8
8
  import {cssVariable} from "../../utils/global.js";
9
9
  import {VueFlowUtils, YamlUtils} from "../../index.js";
10
- import VueflowUtils from "../../utils/VueFlowUtils.js";
11
10
  import {CLUSTER_PREFIX, EVENTS} from "../../utils/constants.js";
12
11
  import {Background} from "@vue-flow/background";
13
12
  import Utils from "../../utils/Utils.js";
@@ -108,7 +107,7 @@
108
107
  edgeReplacer.value = {};
109
108
  oldCollapsed.forEach(n => collapseCluster(CLUSTER_PREFIX + n, false, false))
110
109
 
111
- const elements = VueflowUtils.generateGraph(
110
+ const elements = VueFlowUtils.generateGraph(
112
111
  props.id,
113
112
  props.flowId,
114
113
  props.namespace,
@@ -364,5 +363,7 @@
364
363
  </template>
365
364
 
366
365
  <style scoped lang="scss">
367
-
366
+ :deep(.unused-path) {
367
+ opacity: 0.3;
368
+ }
368
369
  </style>
@@ -349,44 +349,9 @@ export default class VueFlowUtils {
349
349
  const dagreGraph = this.generateDagreGraph(flowGraph, hiddenNodes, isHorizontal, clustersWithoutRootNode, edgeReplacer, collapsed, clusterToNode);
350
350
 
351
351
  const clusterByNodeUid = {};
352
-
353
352
  const clusters = flowGraph.clusters || [];
354
353
  const rawClusters = clusters.map(c => c.cluster);
355
354
  const readOnlyUidPrefixes = rawClusters.filter(c => c.type.endsWith("SubflowGraphCluster")).map(c => c.taskNode.uid);
356
- for (let cluster of clusters) {
357
- if (!edgeReplacer[cluster.cluster.uid] && !collapsed.has(cluster.cluster.uid)) {
358
- if (cluster.cluster.taskNode?.task?.type === "io.kestra.core.tasks.flows.Dag") {
359
- readOnlyUidPrefixes.push(cluster.cluster.taskNode.uid);
360
- }
361
-
362
- for (let nodeUid of cluster.nodes) {
363
- clusterByNodeUid[nodeUid] = cluster.cluster;
364
- }
365
-
366
- const clusterUid = cluster.cluster.uid;
367
- const dagreNode = dagreGraph.node(clusterUid)
368
- const parentNode = cluster.parents ? cluster.parents[cluster.parents.length - 1] : undefined;
369
-
370
- const clusterColor = this.computeClusterColor(cluster.cluster);
371
-
372
- elements.push({
373
- id: clusterUid,
374
- type: "cluster",
375
- parentNode: parentNode,
376
- position: this.getNodePosition(dagreNode, parentNode ? dagreGraph.node(parentNode) : undefined),
377
- style: {
378
- width: clusterUid === TRIGGERS_NODE_UID && isHorizontal ? NODE_SIZES.TRIGGER_CLUSTER_WIDTH + "px" : dagreNode.width + "px",
379
- height: clusterUid === TRIGGERS_NODE_UID && !isHorizontal ? NODE_SIZES.TRIGGER_CLUSTER_HEIGHT + "px" : dagreNode.height + "px"
380
- },
381
- data: {
382
- collapsable: true,
383
- color: clusterColor,
384
- taskNode: cluster.cluster.taskNode
385
- },
386
- class: `bg-light-${clusterColor}-border rounded p-2`,
387
- })
388
- }
389
- }
390
355
 
391
356
  const nodeByUid = {};
392
357
  for (const node of flowGraph.nodes.concat(clusterToNode)) {
@@ -426,13 +391,50 @@ export default class VueFlowUtils {
426
391
  expandable: this.isExpandableTask(node, clusterByNodeUid, edgeReplacer),
427
392
  isReadOnly: isReadOnlyTask,
428
393
  iconComponent: this.isCollapsedCluster(node) ? "webhook" : null,
429
- executionId: node.executionId
394
+ executionId: node.executionId,
395
+ unused: node.unused
430
396
  },
431
397
  class: node.type === "collapsedcluster" ? `bg-light-${color}-border rounded` : "",
432
398
  })
433
399
  }
434
400
  }
435
401
 
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
+
436
438
  const clusterRootTaskNodeUids = rawClusters.filter(c => c.taskNode).map(c => c.taskNode.uid);
437
439
  const edges = flowGraph.edges ?? [];
438
440
 
@@ -454,7 +456,8 @@ export default class VueFlowUtils {
454
456
  haveDashArray: nodeByUid[edge.source].type.endsWith("GraphTrigger")
455
457
  || nodeByUid[edge.target].type.endsWith("GraphTrigger")
456
458
  || edge.source.startsWith(TRIGGERS_NODE_UID),
457
- color: this.getEdgeColor(edge, nodeByUid)
459
+ color: this.getEdgeColor(edge, nodeByUid),
460
+ unused: edge.unused
458
461
  },
459
462
  style: {
460
463
  zIndex: 10,