-
+
+ 📥
+
@@ -88,16 +90,23 @@ const processLabel = toRef(() => {
.process-node {
padding: 10px;
color: white;
- border: 1px solid #4b5563;
border-radius: 99px;
- font-size: 12px;
- width: 18px;
- height: 18px;
+ font-size: 14px;
+ width: 24px;
+ height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
+.process-node .vue-flow__handle {
+ border: none;
+ height: unset;
+ width: unset;
+ background: transparent;
+ font-size: 12px;
+}
+
.spinner {
border: 3px solid #f3f3f3;
border-top: 3px solid #2563eb;
diff --git a/docs/examples/layout/useRunProcess.js b/docs/examples/layout/useRunProcess.js
index e2615ba8..c7410382 100644
--- a/docs/examples/layout/useRunProcess.js
+++ b/docs/examples/layout/useRunProcess.js
@@ -10,7 +10,7 @@ import { useVueFlow } from '@vue-flow/core'
* When a node has multiple descendants, it will run them in parallel.
*/
export function useRunProcess(dagreGraph) {
- const { updateNodeData } = useVueFlow()
+ const { updateNodeData, getConnectedEdges } = useVueFlow()
const graph = toRef(() => toValue(dagreGraph))
@@ -23,6 +23,15 @@ export function useRunProcess(dagreGraph) {
return
}
+ const incomers = getConnectedEdges(node.id).filter((connection) => connection.target === node.id)
+
+ await Promise.all(incomers.map((incomer) => until(() => !incomer.data.isAnimating)))
+
+ if (!isRunning.value) {
+ // The process was stopped
+ return
+ }
+
executedNodes.add(node.id)
updateNodeData(node.id, { isRunning: true, isFinished: false, hasError: false, isCancelled: false })
@@ -121,3 +130,14 @@ export function useRunProcess(dagreGraph) {
return { run, stop, reset, isRunning }
}
+
+async function until(condition) {
+ return new Promise((resolve) => {
+ const interval = setInterval(() => {
+ if (condition()) {
+ clearInterval(interval)
+ resolve()
+ }
+ }, 100)
+ })
+}