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

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1950efe9dc Use operator_name instead of task_type in UI (#31662)
1950efe9dc is described below

commit 1950efe9dca05f7ceba736202ad77821fb363099
Author: Utkarsh Sharma <[email protected]>
AuthorDate: Thu Jun 15 23:27:12 2023 +0530

    Use operator_name instead of task_type in UI (#31662)
---
 airflow/www/static/js/task_instances.js  | 4 ++--
 airflow/www/templates/airflow/graph.html | 2 +-
 airflow/www/views.py                     | 5 ++++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/airflow/www/static/js/task_instances.js 
b/airflow/www/static/js/task_instances.js
index 8df8b46841..61ff192599 100644
--- a/airflow/www/static/js/task_instances.js
+++ b/airflow/www/static/js/task_instances.js
@@ -151,8 +151,8 @@ export function taskNoInstanceTooltip(taskId, task) {
   if (taskId) {
     tt += `Task_id: ${escapeHtml(taskId)}<br>`;
   }
-  if (task.task_type !== undefined) {
-    tt += `Operator: ${escapeHtml(task.task_type)}<br>`;
+  if (task.operator_name !== undefined) {
+    tt += `Operator: ${escapeHtml(task.operator_name)}<br>`;
   }
   tt += "<br><em>DAG has yet to run.</em>";
   return tt;
diff --git a/airflow/www/templates/airflow/graph.html 
b/airflow/www/templates/airflow/graph.html
index 9d4ee6e817..64b9a03c73 100644
--- a/airflow/www/templates/airflow/graph.html
+++ b/airflow/www/templates/airflow/graph.html
@@ -90,7 +90,7 @@
   <div class="legend-row">
     <div>
       {% for op in operators %}<span class="legend-item" style="color: {{ 
op.ui_fgcolor }};background: {{ op.ui_color }};">
-        {{ op.task_type }}</span>{% endfor %}
+        {{ op.operator_name }}</span>{% endfor %}
     </div>
     <div>
       {% for state, state_color in state_color_mapping.items() %}
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 23c00d0346..f50df518fe 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -3087,6 +3087,7 @@ class Airflow(AirflowBaseView):
             t.task_id: {
                 "dag_id": t.dag_id,
                 "task_type": t.task_type,
+                "operator_name": t.operator_name,
                 "extra_links": t.extra_links,
                 "is_mapped": isinstance(t, MappedOperator),
                 "trigger_rule": t.trigger_rule,
@@ -3115,7 +3116,9 @@ class Airflow(AirflowBaseView):
             state_token=wwwutils.state_token(dt_nr_dr_data["dr_state"]),
             doc_md=doc_md,
             arrange=arrange,
-            operators=sorted({op.task_type: op for op in dag.tasks}.values(), 
key=lambda x: x.task_type),
+            operators=sorted(
+                {op.operator_name: op for op in dag.tasks}.values(), 
key=lambda x: x.operator_name
+            ),
             root=root or "",
             task_instances=task_instances,
             tasks=tasks,

Reply via email to