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 2022/04/03 14:29:16 UTC
[GitHub] [airflow] pierrejeambrun commented on a change in pull request #22671: Support for sorting DAGs in the web UI
pierrejeambrun commented on a change in pull request #22671:
URL: https://github.com/apache/airflow/pull/22671#discussion_r841230979
##########
File path: airflow/www/views.py
##########
@@ -670,6 +670,8 @@ def index(self):
arg_search_query = request.args.get('search')
arg_tags_filter = request.args.getlist('tags')
arg_status_filter = request.args.get('status')
+ arg_sorting_key = request.args.get('sorting_key', "dag_id")
Review comment:
Thank you for your review, done.
##########
File path: airflow/www/views.py
##########
@@ -740,13 +742,12 @@ def index(self):
current_dags = all_dags
num_of_all_dags = all_dags_count
- dags = (
- current_dags.order_by(DagModel.dag_id)
- .options(joinedload(DagModel.tags))
- .offset(start)
- .limit(dags_per_page)
- .all()
+ sort_column = DagModel.__table__.c[arg_sorting_key]
+ current_dags = current_dags.order_by(
+ sort_column.is_(None), desc(sort_column) if arg_sorting_direction == "desc" else sort_column
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org