@kestra-io/ui-libs 0.0.16 → 0.0.18
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
|
@@ -100,6 +100,14 @@
|
|
|
100
100
|
|
|
101
101
|
nextTick(() => {
|
|
102
102
|
forwardEvent("loading", true);
|
|
103
|
+
|
|
104
|
+
// Workaround due to start & end nodes regeneration when fetching the graph again
|
|
105
|
+
const oldCollapsed = collapsed.value;
|
|
106
|
+
collapsed.value = new Set();
|
|
107
|
+
hiddenNodes.value = [];
|
|
108
|
+
edgeReplacer.value = {};
|
|
109
|
+
oldCollapsed.forEach(n => collapseCluster(CLUSTER_PREFIX + n, false, false))
|
|
110
|
+
|
|
103
111
|
const elements = VueflowUtils.generateGraph(
|
|
104
112
|
props.id,
|
|
105
113
|
props.flowId,
|
|
@@ -187,21 +195,19 @@
|
|
|
187
195
|
lastPosition.value = null;
|
|
188
196
|
})
|
|
189
197
|
|
|
190
|
-
const
|
|
198
|
+
const subflowPrefixes = computed(() => {
|
|
191
199
|
if(!props.flowGraph) {
|
|
192
200
|
return [];
|
|
193
201
|
}
|
|
194
202
|
|
|
195
203
|
return props.flowGraph.clusters.filter(cluster => cluster.cluster.type.endsWith("SubflowGraphCluster"))
|
|
196
|
-
.
|
|
197
|
-
cluster.nodes.filter(node => node !== cluster.cluster.taskNode.uid)
|
|
198
|
-
);
|
|
204
|
+
.map(cluster => cluster.cluster.taskNode.uid + ".");
|
|
199
205
|
})
|
|
200
206
|
|
|
201
207
|
onNodeDrag((e) => {
|
|
202
208
|
resetNodesStyle();
|
|
203
|
-
getNodes.value.filter(n =>
|
|
204
|
-
if (n.type === "trigger" || (n.type === "task" && n.id.startsWith(e.node.id + ".")) ||
|
|
209
|
+
getNodes.value.filter(n => n.id !== e.node.id).forEach(n => {
|
|
210
|
+
if (n.type === "trigger" || (n.type === "task" && (n.id.startsWith(e.node.id + ".") || e.node.id.startsWith(n.id + "."))) || subflowPrefixes.value.some(subflowPrefix => n.id.startsWith(subflowPrefix))) {
|
|
205
211
|
n.style = {...n.style, opacity: "0.5"}
|
|
206
212
|
} else {
|
|
207
213
|
n.style = {...n.style, opacity: "1"}
|
|
@@ -239,29 +245,21 @@
|
|
|
239
245
|
|
|
240
246
|
const collapseCluster = (clusterUid, regenerate, recursive) => {
|
|
241
247
|
const cluster = props.flowGraph.clusters.find(cluster => cluster.cluster.uid.endsWith(clusterUid));
|
|
242
|
-
const nodeId = clusterUid
|
|
248
|
+
const nodeId = clusterUid.replace(CLUSTER_PREFIX, "");
|
|
243
249
|
collapsed.value.add(nodeId)
|
|
244
250
|
|
|
245
251
|
hiddenNodes.value = hiddenNodes.value.concat(cluster.nodes.filter(e => e !== nodeId || recursive));
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
edgeReplacer.value
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
252
|
+
hiddenNodes.value = hiddenNodes.value.concat([cluster.cluster.uid])
|
|
253
|
+
edgeReplacer.value = {
|
|
254
|
+
...edgeReplacer.value,
|
|
255
|
+
[cluster.cluster.uid]: nodeId,
|
|
256
|
+
[cluster.start]: nodeId,
|
|
257
|
+
[cluster.end]: nodeId
|
|
258
|
+
}
|
|
254
259
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
edgeReplacer.value = {
|
|
262
|
-
...edgeReplacer.value,
|
|
263
|
-
[cluster.start]: nodeId,
|
|
264
|
-
[cluster.end]: nodeId
|
|
260
|
+
for (let child of cluster.nodes) {
|
|
261
|
+
if (props.flowGraph.clusters.map(cluster => cluster.cluster.uid).includes(child)) {
|
|
262
|
+
collapseCluster(child, false, true);
|
|
265
263
|
}
|
|
266
264
|
}
|
|
267
265
|
|