Skip to content

Commit 0a97d14

Browse files
authored
Merge pull request #21145 from ahmedhamidawan/fix_invocation_view_connection_animations
[25.1] Remove invocation view connection animations
2 parents 156b51b + 0726a58 commit 0a97d14

File tree

4 files changed

+13
-139
lines changed

4 files changed

+13
-139
lines changed

client/src/components/Workflow/Editor/SVGConnection.vue

Lines changed: 11 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
<script setup lang="ts">
22
import { curveBasis, line } from "d3";
3-
import { computed } from "vue";
3+
import { computed, type PropType } from "vue";
44
55
import { useWorkflowStores } from "@/composables/workflowStores";
66
import { getConnectionId } from "@/stores/workflowConnectionStore";
77
import type { TerminalPosition } from "@/stores/workflowEditorStateStore";
88
import type { Connection } from "@/stores/workflowStoreTypes";
99
10-
interface Props {
11-
id: string;
12-
connection: Connection;
13-
terminalPosition?: TerminalPosition | null;
14-
flowing?: boolean;
15-
breathing?: boolean;
16-
}
17-
18-
const props = withDefaults(defineProps<Props>(), {
19-
terminalPosition: null,
20-
flowing: false,
21-
breathing: false,
10+
const props = defineProps({
11+
id: String,
12+
connection: {
13+
type: Object as PropType<Connection>,
14+
required: true,
15+
},
16+
terminalPosition: {
17+
type: Object as PropType<TerminalPosition | null>,
18+
default: null,
19+
},
2220
});
2321
2422
const ribbonMargin = 4;
@@ -166,24 +164,6 @@ const paths = computed(() => {
166164
return lines.map((l) => curve(l)!);
167165
});
168166
169-
// Estimate path length for animation timing on flowing connections
170-
const estimatedPathLength = computed(() => {
171-
if (!props.flowing) {
172-
return 0;
173-
}
174-
175-
if (!connectionPosition.value) {
176-
return 100;
177-
}
178-
179-
const deltaX = connectionPosition.value.endX - connectionPosition.value.startX;
180-
const deltaY = connectionPosition.value.endY - connectionPosition.value.startY;
181-
const straightDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
182-
183-
// Add some extra length to account for curves
184-
return Math.max(100, straightDistance * 1.3);
185-
});
186-
187167
const lineWidth = computed(() => {
188168
if (inputIsMappedOver.value || outputIsMappedOver.value) {
189169
return 2;
@@ -203,10 +183,6 @@ const connectionClass = computed(() => {
203183
classList.push("invalid");
204184
}
205185
206-
if (props.breathing) {
207-
classList.push("breathing");
208-
}
209-
210186
return classList.join(" ");
211187
});
212188
@@ -253,22 +229,6 @@ function keyForIndex(index: number) {
253229
:stroke-width="lineWidth"
254230
fill="none">
255231
</path>
256-
257-
<template v-if="props.flowing">
258-
<path
259-
v-for="(path, index) in paths"
260-
:key="`particle-${keyForIndex(index)}`"
261-
class="connection-particle"
262-
:d="path"
263-
:stroke-width="lineWidth * 2"
264-
:style="{
265-
'--path-length': `${estimatedPathLength}px`,
266-
'--animation-duration': `${Math.max(2, estimatedPathLength / 80)}s`,
267-
}"
268-
stroke-linecap="round"
269-
fill="none">
270-
</path>
271-
</template>
272232
</g>
273233
</template>
274234

@@ -287,45 +247,6 @@ function keyForIndex(index: number) {
287247
&.invalid {
288248
stroke: #{$brand-warning};
289249
}
290-
291-
&.breathing {
292-
animation: breathe 2s ease-in-out infinite;
293-
}
294-
}
295-
296-
.connection-particle {
297-
stroke: white;
298-
stroke-dasharray: 0 calc(var(--path-length, 100px) / 2) 0 var(--path-length, 100px);
299-
animation: flow var(--animation-duration, 1s) linear infinite;
300-
}
301-
}
302-
303-
@keyframes flow {
304-
0% {
305-
stroke-dashoffset: 0;
306-
}
307-
100% {
308-
stroke-dashoffset: calc(-2 * var(--path-length, 100px) - 8px);
309-
}
310-
}
311-
312-
@keyframes breathe {
313-
0%,
314-
100% {
315-
stroke-width: var(--stroke-width, 4px);
316-
opacity: 0.8;
317-
}
318-
25% {
319-
stroke-width: calc(var(--stroke-width, 4px) * 1.2);
320-
opacity: 0.9;
321-
}
322-
50% {
323-
stroke-width: calc(var(--stroke-width, 4px) * 1.4);
324-
opacity: 1;
325-
}
326-
75% {
327-
stroke-width: calc(var(--stroke-width, 4px) * 1.2);
328-
opacity: 0.9;
329250
}
330251
}
331252
</style>

client/src/components/Workflow/Editor/WorkflowEdges.vue

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ const props = defineProps<{
1414
draggingConnection: TerminalPosition | null;
1515
draggingTerminal: OutputTerminals | null;
1616
transform: { x: number; y: number; k: number };
17-
/** Stores the step IDs for steps in the invocation which should have a
18-
* "breathing" or "flowing" animation applied to their connections.
19-
*/
20-
stepConnectionClasses?: {
21-
breathing: number[];
22-
flowing: number[];
23-
};
2417
}>();
2518
2619
const { connectionStore } = useWorkflowStores();
@@ -50,36 +43,20 @@ function key(connection: Connection) {
5043
function id(connection: Connection) {
5144
return `connection-node-${connection.input.stepId}-input-${connection.input.name}-node-${connection.output.stepId}-output-${connection.output.name}`;
5245
}
53-
54-
/** Checks the connection's input and output step IDs to determine if a "breathing"
55-
* or "flowing" class should be applied in the `SVGConnection` component.
56-
*/
57-
function getConnectionState(connection: Connection, stateType: "breathing" | "flowing") {
58-
if (props.stepConnectionClasses) {
59-
return (
60-
props.stepConnectionClasses[stateType].includes(connection.output.stepId) ||
61-
props.stepConnectionClasses[stateType].includes(connection.input.stepId)
62-
);
63-
}
64-
return false;
65-
}
6646
</script>
6747

6848
<template>
6949
<div class="workflow-edges">
7050
<svg class="workflow-edges">
7151
<SVGConnection
7252
v-if="draggingConnection"
73-
id="dragging-connection"
7453
:connection="draggingConnection[0]"
7554
:terminal-position="draggingConnection[1]" />
7655
<SVGConnection
7756
v-for="connection in connections"
7857
:id="id(connection)"
7958
:key="key(connection)"
80-
:connection="connection"
81-
:flowing="getConnectionState(connection, 'flowing')"
82-
:breathing="getConnectionState(connection, 'breathing')" />
59+
:connection="connection" />
8360
</svg>
8461
</div>
8562
</template>

client/src/components/Workflow/Editor/WorkflowGraph.vue

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { storeToRefs } from "pinia";
44
import { computed, type PropType, provide, reactive, type Ref, ref, watch, watchEffect } from "vue";
55
66
import { DatatypesMapperModel } from "@/components/Datatypes/model";
7-
import { isGraphStep } from "@/composables/useInvocationGraph";
87
import { useWorkflowStores } from "@/composables/workflowStores";
98
import type { TerminalPosition, XYPosition } from "@/stores/workflowEditorStateStore";
109
import type { Step } from "@/stores/workflowStepStore";
@@ -73,24 +72,6 @@ const { viewportBoundingBox, updateViewportBaseBoundingBox } = useViewportBoundi
7372
);
7473
const { getWorkflowBoundingBox } = useWorkflowBoundingBox();
7574
76-
const stepConnectionClasses = computed<{
77-
breathing: number[];
78-
flowing: number[];
79-
}>(() => {
80-
const retVal: { breathing: number[]; flowing: number[] } = { breathing: [], flowing: [] };
81-
for (const stepId in props.steps) {
82-
const step = props.steps[stepId];
83-
if (step && isGraphStep(step) && step.state) {
84-
if (["queued", "new", "waiting"].includes(step.state)) {
85-
retVal.breathing.push(step.id);
86-
} else if (step.state === "running") {
87-
retVal.flowing.push(step.id);
88-
}
89-
}
90-
}
91-
return retVal;
92-
});
93-
9475
function fitWorkflow(minimumFitZoom = 0.5, maximumFitZoom = 1.0, padding = 50.0) {
9576
if (!Object.keys(props.steps).length) {
9677
// If there are no steps, we cannot fit the workflow.
@@ -225,8 +206,7 @@ defineExpose({
225206
<WorkflowEdges
226207
:transform="transform"
227208
:dragging-terminal="draggingTerminal"
228-
:dragging-connection="draggingPosition"
229-
:step-connection-classes="stepConnectionClasses" />
209+
:dragging-connection="draggingPosition" />
230210
<WorkflowNode
231211
v-for="(step, key) in steps"
232212
:id="step.id"

client/src/composables/useInvocationGraph.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,3 @@ export function getHeaderClass(state: string) {
366366
[`header-${state}`]: !!state,
367367
};
368368
}
369-
370-
export function isGraphStep(step: Step | GraphStep): step is GraphStep {
371-
return "jobs" in step;
372-
}

0 commit comments

Comments
 (0)