apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
35.37k stars 13.81k forks source link

Add ability to filter DAGs in DAGs View by tags using "AND" instead of default behavior "OR" #38147

Open understructure opened 4 months ago

understructure commented 4 months ago

Description

In the DAGs View, we can enter tags in the "Filter DAGs by tag" box by entering one or more tags. However, this results in an OR-type behavior, where the results show every DAG with any of the entered tags.

With this feature enabled, the list of DAGs returned would be a list only of those DAGs containing ALL of the user-entered tags, rather than a list of DAGs containing ANY of the user-entered tags.

Use case/motivation

This feature could be as simple as adding a checkbox next to the "Filter DAGs by tag" box (marked "use AND" or similar). This will be a great help to filter DAGs when tagging is used extensively and there are hundreds of DAGs on an instance. For instance, we're migrating legacy ELT procedures that use legacy systems. We're tagging these DAGs with all the legacy systems they use. If we could zero in on which DAGs are using legacy system A and legacy system B, it would help us to understand the relationships between those systems, and what needs to be done to no longer rely on either.

Related issues

None I'm aware of.

Are you willing to submit a PR?

Code of Conduct

boring-cyborg[bot] commented 4 months ago

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

RNHTTR commented 3 months ago

@understructure would you like me to assign this task to you?

lotrias17 commented 2 months ago

Hello, could a colleague (@TiDeane) and I be assigned to this issue? We are working for a university project and would be grateful to implement this feature. Thank you in advance.

understructure commented 2 months ago

@RNHTTR I'd love to but unfortunately this is a really inopportune time for me :(

RNHTTR commented 2 months ago

@RNHTTR I'd love to but unfortunately this is a really inopportune time for me :(

No problem! Come back to the project when you have some more time!

Hello, could a colleague (@TiDeane) and I be assigned to this issue? We are working for a university project and would be grateful to implement this feature. Thank you in advance.

Done!

Tristan-Zaleski commented 4 weeks ago

Attempted to mimic this logic in Airflow 2.6.3 standalone, but checkbox is not registering when checked in views.py. Seems like use_and is not being set. Have placed all changes on the commit, still no luck.

Not as familiar with front-end UI and Javascript, so not sure how to test/log the use_and getting set via JS in the python script, so any help is appreciated.

TiDeane commented 3 weeks ago

@Tristan-Zaleski That's strange, I've just rebased with upstream/main and it seems to be working on my end. Would it work differently with Breeze?

Tristan-Zaleski commented 3 weeks ago

When I manually add &use_and=true to the url after selecting tags, it works, so the JS appears to not update the query in applyTagFilter, leading to the views.py to never update its own check. Not sure what you mean by Breeze as I am not familiar.

TiDeane commented 2 weeks ago

Sorry - Breeze is the development environment. However, Breeze is using Airflow Standalone, so there should be no difference. It works perfectly for me, so this is strange.