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/07 15:56:25 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #22671: Support for sorting DAGs in the web UI

uranusjr commented on code in PR #22671:
URL: https://github.com/apache/airflow/pull/22671#discussion_r845302277


##########
airflow/www/views.py:
##########
@@ -756,13 +758,13 @@ 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.get(arg_sorting_key)
+            if sort_column is not None:
+                if arg_sorting_direction == 'desc':
+                    sort_column = desc(sort_column)

Review Comment:
   ```suggestion
                       sort_column = sort_column.desc()
   ```
   
   I think you can do this instead?



-- 
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