This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v2-10-test by this push:
     new b9069e7fda Correctly select task in DAG Graph View when clicking on 
its name (#38782) (#42697)
b9069e7fda is described below

commit b9069e7fdad27003da8477a8c19b184f46a782a8
Author: Brent Bovenzi <[email protected]>
AuthorDate: Thu Oct 3 16:38:11 2024 +0200

    Correctly select task in DAG Graph View when clicking on its name (#38782) 
(#42697)
    
    * Fix in DAG Graph View, clicking Task on it's name doesn't select the 
task. (#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]>
---
 airflow/www/static/js/dag/details/graph/DagNode.test.tsx | 14 +++++++++++++-
 airflow/www/static/js/dag/details/graph/DagNode.tsx      |  8 +++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/airflow/www/static/js/dag/details/graph/DagNode.test.tsx 
b/airflow/www/static/js/dag/details/graph/DagNode.test.tsx
index 34ddac7506..7c6dea7584 100644
--- a/airflow/www/static/js/dag/details/graph/DagNode.test.tsx
+++ b/airflow/www/static/js/dag/details/graph/DagNode.test.tsx
@@ -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";
 
@@ -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();
+  });
 });
diff --git a/airflow/www/static/js/dag/details/graph/DagNode.tsx 
b/airflow/www/static/js/dag/details/graph/DagNode.tsx
index c2f9b01296..4ac1be8ef4 100644
--- a/airflow/www/static/js/dag/details/graph/DagNode.tsx
+++ b/airflow/www/static/js/dag/details/graph/DagNode.tsx
@@ -42,10 +42,10 @@ const DagNode = ({
     task,
     isSelected,
     latestDagRunId,
-    onToggleCollapse,
     isOpen,
     isActive,
     setupTeardownType,
+    onToggleCollapse,
     labelStyle,
     style,
     isZoomedOut,
@@ -139,8 +139,10 @@ const DagNode = ({
           isOpen={isOpen}
           isGroup={!!childCount}
           onClick={(e) => {
-            e.stopPropagation();
-            onToggleCollapse();
+            if (childCount) {
+              e.stopPropagation();
+              onToggleCollapse();
+            }
           }}
           setupTeardownType={setupTeardownType}
           isZoomedOut={isZoomedOut}

Reply via email to