You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/11/20 16:14:24 UTC

[airflow] 06/16: Fix Start Date tooltip on DAGs page (#10637)

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

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

commit f0b8e86140be943faf9307b5aef11cdafbebfdc7
Author: Alex Begg <ab...@gocurrency.com>
AuthorDate: Tue Oct 20 01:10:57 2020 -0700

    Fix Start Date tooltip on DAGs page (#10637)
    
    Closes #10350
---
 airflow/www_rbac/templates/airflow/dags.html | 9 +++++----
 airflow/www_rbac/views.py                    | 7 +++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/airflow/www_rbac/templates/airflow/dags.html b/airflow/www_rbac/templates/airflow/dags.html
index 6ae3f50..32dc1e0 100644
--- a/airflow/www_rbac/templates/airflow/dags.html
+++ b/airflow/www_rbac/templates/airflow/dags.html
@@ -363,14 +363,15 @@
     function lastDagRunsHandler(error, json) {
       for(var safe_dag_id in json) {
         dag_id = json[safe_dag_id].dag_id;
-        last_run = json[safe_dag_id].last_run;
+        execution_date = json[safe_dag_id].execution_date;
+        start_date = json[safe_dag_id].start_date;
         g = d3.select('div#last-run-' + safe_dag_id)
         g.selectAll('a')
-          .attr("href", "{{ url_for('Airflow.graph') }}?dag_id=" + encodeURIComponent(dag_id) + "&execution_date=" + encodeURIComponent(last_run))
-          .insert(isoDateToTimeEl.bind(null, last_run, {title: false}));
+          .attr("href", "{{ url_for('Airflow.graph') }}?dag_id=" + encodeURIComponent(dag_id) + "&execution_date=" + encodeURIComponent(execution_date))
+          .insert(isoDateToTimeEl.bind(null, execution_date, {title: false}));
         g.selectAll('span')
           // We don't translate the timezone in the tooltip, that stays in UTC.
-          .attr("data-original-title", "Start Date: " + last_run)
+          .attr("data-original-title", "Start Date: " + start_date)
           .style('display', null);
         g.selectAll(".loading-last-run").remove();
       }
diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py
index a7555f2..324ede3 100644
--- a/airflow/www_rbac/views.py
+++ b/airflow/www_rbac/views.py
@@ -545,7 +545,9 @@ class Airflow(AirflowBaseView):
             return wwwutils.json_response({})
 
         query = session.query(
-            DagRun.dag_id, sqla.func.max(DagRun.execution_date).label('last_run')
+            DagRun.dag_id,
+            sqla.func.max(DagRun.execution_date).label('execution_date'),
+            sqla.func.max(DagRun.start_date).label('start_date'),
         ).group_by(DagRun.dag_id)
 
         # Filter to only ask for accessible and selected dags
@@ -554,7 +556,8 @@ class Airflow(AirflowBaseView):
         resp = {
             r.dag_id.replace('.', '__dot__'): {
                 'dag_id': r.dag_id,
-                'last_run': r.last_run.isoformat(),
+                'execution_date': r.execution_date.isoformat(),
+                'start_date': r.start_date.isoformat(),
             } for r in query
         }
         return wwwutils.json_response(resp)