Skip to content

Commit

Permalink
Correctly select task in DAG Graph View when clicking on its name (ap…
Browse files Browse the repository at this point in the history
…ache#38782) (apache#42697)

* Fix in DAG Graph View, clicking Task on it's name doesn't select the task. (apache#37932)

* Updated TaskName onClick

* Fixed missing onToggleCollapse

* Added missing changes

* Updated: rebase

* fixed providers error message

* undo fab changes

* Update user_command.py

---------

Co-authored-by: jonhspyro <[email protected]>
  • Loading branch information
bbovenzi and jonhspyro authored Oct 3, 2024
1 parent fcbf6fe commit b9069e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 13 additions & 1 deletion airflow/www/static/js/dag/details/graph/DagNode.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/* global describe, test, expect */

import React from "react";
import { render } from "@testing-library/react";
import { fireEvent, render } from "@testing-library/react";

import { Wrapper } from "src/utils/testUtils";

Expand Down Expand Up @@ -124,4 +124,16 @@ describe("Test Graph Node", () => {

expect(getByTestId("node")).toHaveStyle("opacity: 0.3");
});

test("Clicks on taskName", async () => {
const { getByText } = render(<DagNode {...mockNode} />, {
wrapper: Wrapper,
});

const taskName = getByText("task_id");

fireEvent.click(taskName);

expect(taskName).toBeInTheDocument();
});
});
8 changes: 5 additions & 3 deletions airflow/www/static/js/dag/details/graph/DagNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const DagNode = ({
task,
isSelected,
latestDagRunId,
onToggleCollapse,
isOpen,
isActive,
setupTeardownType,
onToggleCollapse,
labelStyle,
style,
isZoomedOut,
Expand Down Expand Up @@ -139,8 +139,10 @@ const DagNode = ({
isOpen={isOpen}
isGroup={!!childCount}
onClick={(e) => {
e.stopPropagation();
onToggleCollapse();
if (childCount) {
e.stopPropagation();
onToggleCollapse();
}
}}
setupTeardownType={setupTeardownType}
isZoomedOut={isZoomedOut}
Expand Down

0 comments on commit b9069e7

Please sign in to comment.