BasPH commented on a change in pull request #6489: [AIRFLOW-3959] add UI filter 
with DAGs tags
URL: https://github.com/apache/airflow/pull/6489#discussion_r341838793
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -246,10 +266,20 @@ def get_int_arg(value, default=0):
                     DagModel.owners.ilike('%' + arg_search_query + '%')
                 )
 
+            if arg_tags_filter:
+                dags_query = 
dags_query.filter(DagModel.tags.any(DagTag.name.in_(arg_tags_filter)))
+
             if 'all_dags' not in filter_dag_ids:
                 dags_query = 
dags_query.filter(DagModel.dag_id.in_(filter_dag_ids))
 
             dags = 
dags_query.order_by(DagModel.dag_id).offset(start).limit(dags_per_page).all()
+            tags = []
+
+            for name, in 
session.query(DagTag.name).distinct(DagTag.name).all():
+                value = {'name': name, 'selected': False}
+                if arg_tags_filter and name in arg_tags_filter:
+                    value['selected'] = True
+                tags.append(value)
 
 Review comment:
   Shorter to write:
   
   ```python
   dagtags = session.query(DagTag.name).distinct(DagTag.name).all()
   tags = [{"name": name, "selected": True if arg_tags_filter and name in 
arg_tags_filter else False}]
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to