Skip to content

Conversation

@stuart23
Copy link
Contributor

@stuart23 stuart23 commented Oct 8, 2025


The tags on the DAGs card view are rendered in the order they are received from the API server which can be inconsistent and makes it difficult to compare DAGs with the same tag-set. This sorts the labels first before rendering them.

A test has been added as well to confirm the functionality.

- Replace non-null assertion with proper null check and array destructuring
- Add explicit error handling for missing mock data
- Add Jest DOM types import for TypeScript compatibility
- Maintains test functionality while following linting rules
@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Oct 8, 2025
@bbovenzi
Copy link
Contributor

bbovenzi commented Oct 8, 2025

I feel like we should add sorting to the API instead.

@tirkarthi
Copy link
Contributor

tirkarthi commented Oct 8, 2025

Something like this can be added in the API side that should sort tags by name.

diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py
index 23aa4ec300..3ff50fd2b5 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py
@@ -29,6 +29,7 @@ from pydantic import (
     ConfigDict,
     computed_field,
     field_validator,
+    field_serializer
 )
 
 from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel
@@ -114,6 +115,9 @@ class DAGResponse(BaseModel):
         }
         return serializer.dumps(payload)
 
+    @field_serializer('tags')
+    def serialize_tags(tags: list[DagTagResponse]):
+        return sorted(tags, key=lambda tag: tag.name)

@pierrejeambrun
Copy link
Member

I aggree that this should be done at the API level. +1 for a field serializer.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Nov 29, 2025
@stuart23
Copy link
Contributor Author

stuart23 commented Dec 1, 2025

Closed in favour of #58883 as per recommendations

@stuart23 stuart23 closed this Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants