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

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


The following commit(s) were added to refs/heads/v2-5-test by this push:
     new 0be7ab413e Fix task id when making the mapped task label in graph view 
(#28993)
0be7ab413e is described below

commit 0be7ab413e4fbbd93abb80b7e21014af5f066788
Author: Brent Bovenzi <[email protected]>
AuthorDate: Tue Jan 17 16:36:59 2023 -0300

    Fix task id when making the mapped task label in graph view (#28993)
    
    (cherry picked from commit c56887431a76c94b537ff3a1282948bca97b5466)
---
 airflow/www/static/js/graph.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js
index 19a7b4ec1f..a4f01c4cb4 100644
--- a/airflow/www/static/js/graph.js
+++ b/airflow/www/static/js/graph.js
@@ -90,7 +90,7 @@ const updateNodeLabels = (node, instances) => {
   let { label } = node.value;
   // Check if there is a count of mapped instances
   if ((tasks[node.id] && tasks[node.id].is_mapped) || node.value.isMapped) {
-    const firstChildId = node.children[0].id;
+    const id = !!node.children && node.children.length ? node.children[0].id : 
node.value.id;
 
     let count = ' ';
 
@@ -98,8 +98,8 @@ const updateNodeLabels = (node, instances) => {
     // TODO: update this count for when we can nest mapped tasks inside of 
mapped task groups
     if (instances[node.id] && instances[node.id].mapped_states) {
       count = instances[node.id].mapped_states.length;
-    } else if (firstChildId && instances[firstChildId]) {
-      count = instances[firstChildId].mapped_states.length;
+    } else if (id && instances[id]) {
+      count = instances[id].mapped_states.length;
     }
 
     if (!label.includes(`[${count}]`)) {

Reply via email to