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 a4f6df85e6544cda5a0ef33d5ca5e50ba6075b34 Author: Kaxil Naik <[email protected]> AuthorDate: Sat Jun 20 20:33:08 2020 +0100 Show Dag's Markdown docs on Tree View (#9448) (cherry picked from commit d0cf232919839d0e338dcc38a5c7a1841077eaae) --- airflow/www/templates/airflow/tree.html | 3 +++ airflow/www/views.py | 2 ++ airflow/www_rbac/templates/airflow/tree.html | 3 +++ airflow/www_rbac/views.py | 2 ++ docs/concepts.rst | 2 +- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/airflow/www/templates/airflow/tree.html b/airflow/www/templates/airflow/tree.html index 5804efc..66255f6 100644 --- a/airflow/www/templates/airflow/tree.html +++ b/airflow/www/templates/airflow/tree.html @@ -28,6 +28,9 @@ {% block body %} {{ super() }} +{% if doc_md %} +{{ doc_md }} +{% endif %} <div style="float: left" class="form-inline"> <form method="get" style="float:left;"> Base date: {{ form.base_date(class_="form-control") }} diff --git a/airflow/www/views.py b/airflow/www/views.py index e98096d..6238f02 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -1662,6 +1662,7 @@ class Airflow(AirflowViewMixin, BaseView): form = DateTimeWithNumRunsForm(data={'base_date': max_date, 'num_runs': num_runs}) external_logs = conf.get('elasticsearch', 'frontend') + doc_md = wrapped_markdown(getattr(dag, 'doc_md', None), css_class='dag-doc') return self.render( 'airflow/tree.html', operators=sorted({op.task_type: op for op in dag.tasks}.values(), @@ -1669,6 +1670,7 @@ class Airflow(AirflowViewMixin, BaseView): root=root, form=form, dag=dag, data=data, blur=blur, num_runs=num_runs, + doc_md=doc_md, show_external_logs=bool(external_logs)) @expose('/graph') diff --git a/airflow/www_rbac/templates/airflow/tree.html b/airflow/www_rbac/templates/airflow/tree.html index 627091a..68723d3 100644 --- a/airflow/www_rbac/templates/airflow/tree.html +++ b/airflow/www_rbac/templates/airflow/tree.html @@ -25,6 +25,9 @@ {% block content %} {{ super() }} +{% if doc_md %} +{{ doc_md }} +{% endif %} <div style="float: left" class="form-inline"> <form method="get" style="float:left;"> Base date: {{ form.base_date(class_="form-control") }} diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py index f9f7604..a09f77b 100644 --- a/airflow/www_rbac/views.py +++ b/airflow/www_rbac/views.py @@ -1524,6 +1524,7 @@ class Airflow(AirflowBaseView): form = DateTimeWithNumRunsForm(data={'base_date': max_date, 'num_runs': num_runs}) external_logs = conf.get('elasticsearch', 'frontend') + doc_md = wwwutils.wrapped_markdown(getattr(dag, 'doc_md', None), css_class='dag-doc') return self.render_template( 'airflow/tree.html', @@ -1532,6 +1533,7 @@ class Airflow(AirflowBaseView): root=root, form=form, dag=dag, + doc_md=doc_md, # avoid spaces to reduce payload size data=htmlsafe_json_dumps(data, separators=(',', ':')), blur=blur, num_runs=num_runs, diff --git a/docs/concepts.rst b/docs/concepts.rst index 603a729..b365aba 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -1085,7 +1085,7 @@ Documentation & Notes ===================== It's possible to add documentation or notes to your DAGs & task objects that -become visible in the web interface ("Graph View" for DAGs, "Task Details" for +become visible in the web interface ("Graph View" & "Tree View" for DAGs, "Task Details" for tasks). There are a set of special task attributes that get rendered as rich content if defined:
