diff --git a/ui/src/workflows/WorkflowCanvas.vue b/ui/src/workflows/WorkflowCanvas.vue index d65eebe5e..3687ce9cb 100644 --- a/ui/src/workflows/WorkflowCanvas.vue +++ b/ui/src/workflows/WorkflowCanvas.vue @@ -228,24 +228,14 @@ function framing(width: number): { x: number; zoom: number } { } // Start at a readable size rather than shrinking a long workflow until -// nothing on it can be read, scrolled to the furthest step the watched run has -// reached so the step that is moving stays in view. +// nothing on it can be read, with the top of the graph at the top. function place(store?: VueFlowStore): void { - const animate = !store; flow = store ?? flow; if (!flow) return; - const width = container.value?.clientWidth ?? 800; - const height = container.value?.clientHeight ?? 560; - const { x, zoom } = framing(width); - // Scroll only when the furthest step reached would be out of view. - const reached = graph.value.nodes.find((node) => props.marks?.[node.id]) ?? graph.value.nodes.filter((node) => node.data.run).at(-1); - const below = reached && 24 + (reached.position.y - top.value + 180) * zoom > height; - const y = below ? height / 3 - reached.position.y * zoom : 24 - top.value * zoom; - void flow.setViewport({ x, y, zoom }, { duration: animate ? 300 : 0 }); + const { x, zoom } = framing(container.value?.clientWidth ?? 800); + void flow.setViewport({ x, y: 24 - top.value * zoom, zoom }); } -watch(() => graph.value.nodes.filter((node) => node.data.run).length, () => place()); -watch(() => props.marks, () => place()); // A card opened low on the canvas scrolls up so its form is in view, and one // opened wider than the canvas allows is framed so its edges stay reachable. watch(anchor, async (node) => { diff --git a/ui/src/workflows/WorkflowsPage.vue b/ui/src/workflows/WorkflowsPage.vue index 474eb654b..0f5cfd8bc 100644 --- a/ui/src/workflows/WorkflowsPage.vue +++ b/ui/src/workflows/WorkflowsPage.vue @@ -176,7 +176,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
-