bbovenzi commented on code in PR #42959:
URL: https://github.com/apache/airflow/pull/42959#discussion_r1801059667


##########
airflow/api_fastapi/views/public/dags.py:
##########
@@ -92,6 +93,28 @@ async def get_dags(
     )
 
 
+@dags_router.get(
+    "/tags",
+    response_model=list[DAGTagResponse],
+    responses=create_openapi_http_exception_doc([400, 401, 403]),
+)
+async def get_dag_tags(
+    tags: QueryTagsFilter,
+    session: Annotated[Session, Depends(get_session)],
+) -> list[DAGTagResponse]:
+    """Get all DAG tags."""
+    dag_tag_names = 
session.query(distinct(DagTag.name)).order_by(DagTag.name).all()
+    if not dag_tag_names:
+        return []
+    selected_dag_tags = {}
+    if tags.value:
+        selected_dag_tags = {tag: True for tag in tags.value}
+    return [
+        DAGTagResponse(name=tag_name_row[0], 
selected=selected_dag_tags.get(tag_name_row[0], False))
+        for tag_name_row in dag_tag_names

Review Comment:
   I think this is an area where we need to adjust the implementation a bit. 
Before with FAB a lot of frontend logic was done on the webserver. Now, we 
should just send a list of tags to the UI and the UI handles all its own 
selection logic.
   
   So let's drop `selected`. But in addition to pagination, I think we'll need 
a `tag_name_pattern` filter param.
   
   Sorry for the confusion!



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to