You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/03 07:58:29 UTC

[GitHub] [airflow] scrdest commented on a change in pull request #11652: Support for sorting DAGs in the web UI

scrdest commented on a change in pull request #11652:
URL: https://github.com/apache/airflow/pull/11652#discussion_r534857054



##########
File path: airflow/www/templates/airflow/dags.html
##########
@@ -20,6 +20,39 @@
 {% extends base_template %}
 {% from 'appbuilder/loading_dots.html' import loading_dots %}
 
+{%- macro verbose_ordering_name(ordering) -%}
+    {{ 'descending' if ordering == 'desc' else ('ascending' if ordering == 'asc' else ordering) }}
+{%- endmacro -%}
+
+{%- macro sorted_th_link(name, attr_name) -%}
+   {% set request_ordering = (request.args.get('orderBy', 'unsorted')) %}
+   {% set curr_ordering = ('unsorted' if request.args.get('sortBy') != attr_name else request_ordering ) %}
+   {% set new_ordering = ('asc' if request.args.get('sortBy') != attr_name or curr_ordering != 'asc' else 'desc' ) %}
+   <a href="{{ url_for('Airflow.index',
+                       status=request.args.get('status', 'all'),
+                       search=request.args.get('search', None),
+                       tags=request.args.get('tags', None),
+                       sortBy=attr_name,
+                       orderBy=new_ordering
+                       ) }}"
+   class="js-tooltip"
+   role="tooltip"
+   title="Press to sort by {{ verbose_ordering_name(new_ordering) }} {{ attr_name }}."

Review comment:
       Done!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org