Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"otherDagRuns": "+Other Dag Runs",
"taskCount_one": "{{count}} Task",
"taskCount_other": "{{count}} Tasks",
"taskGroup": "Task Group"
"taskGroup": "Task Group",
"zoomToTask": "Zoom to selected task"
},
"limitedList": "+{{count}} more",
"limitedList.allItems": "All {{count}} items:",
Expand Down
22 changes: 11 additions & 11 deletions airflow-core/src/airflow/ui/src/components/Graph/Edge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ import { Text, useToken } from "@chakra-ui/react";
import { Group } from "@visx/group";
import { LinePath } from "@visx/shape";
import type { Edge as EdgeType } from "@xyflow/react";
import { useNodesData } from "@xyflow/react";
import type { ElkPoint } from "elkjs";

import type { EdgeData } from "./reactflowUtils";

type Props = EdgeType<EdgeData>;

const CustomEdge = ({ data }: Props) => {
const CustomEdge = ({ data, source, target }: Props) => {
const [strokeColor, blueColor, dataEdgeColor] = useToken("colors", [
"border.inverted",
"blue.500",
"purple.500",
]);

// Read isSelected directly from the node store so that selection changes
// don't require the parent to rebuild and pass down a new edges array.
// useNodesData subscribes to data changes for these specific node IDs only.
const nodesData = useNodesData([source, target]);
const isSelected = nodesData.some((node) => Boolean(node.data.isSelected));

if (data === undefined) {
return undefined;
}
const { rest } = data;

// Determine edge color based on type
const getEdgeColor = () => {
if (rest.isSelected) {
return rest.edgeType === "data" ? dataEdgeColor : blueColor;
}

return strokeColor;
};
const edgeStrokeColor = isSelected ? (rest.edgeType === "data" ? dataEdgeColor : blueColor) : strokeColor;

return (
<>
Expand Down Expand Up @@ -73,9 +73,9 @@ const CustomEdge = ({ data }: Props) => {
<LinePath
data={[section.startPoint, ...(section.bendPoints ?? []), section.endPoint]}
key={section.id}
stroke={getEdgeColor()}
stroke={edgeStrokeColor}
strokeDasharray={rest.isSetupTeardown ? "10,5" : undefined}
strokeWidth={rest.isSelected ? 3 : 1}
strokeWidth={isSelected ? 3 : 1}
x={(point: ElkPoint) => point.x}
y={(point: ElkPoint) => point.y}
/>
Expand Down
Loading
Loading