Skip to content

Conversation

@OscarLigthart
Copy link
Contributor

@OscarLigthart OscarLigthart commented Oct 25, 2025

Overview

We noticed that the lineage filter was missing in the Graph layout. At our company, the DAGs get quite complex, and this was a beloved feature by our users. In this PR, I try to have a crack at implementing it. I did my best to ensure that it feels similar to the old button in Airflow 2 in terms of its behaviour.

UI addition

See image:

image

When dropping down, a user can select the same options as before:

image

When selected, it shows at the top what filter is active:

image

From here, the user can navigate with the active filter. When reselecting this filter dropdown on another task focus, the user gets the ability to take this selected task as root task for the filter:

image

Please feel free to mess around with it!

Some notes from me on UX:

  • I tried to make it feel natural, while also mimicking behaviour I saw in Airflow 2, but very open to hear suggestions on improving UX.
  • I moved it from the task overview (where it was in Airflow 2) to Graph & Grid, as I feel like these are the components controlled by the filter, and it's more natural to control it from there.
  • Implemented for both Graph & Grid, where filter selection persists while navigating.

Note to reviewer

I did some React back in the day, but it's a bit rusty. I'm here to contribute, but definitely also to learn. I'm also Dutch, so please feel free to tell me in a very direct manner which parts make no sense at all 😂 .

Related Issues

I believe this PR can contribute to resolving the below:

But there are more functionalities listed there, that I left out of scope for this PR.

Testing

I am unsure what the procedure is for testing in the UI. I spun up Breeze (love it btw, amazing tool) and clicked around there. Please advice on any further testing procedures or reading materials.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Oct 25, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default labels Oct 25, 2025
@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from 08c1fd5 to 5e00124 Compare October 25, 2025 11:56
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the feature!

In order not to add complexity to the layout with another dropdown, could you add the lineage filter to the existing "Options" dropdown - that would be a bit more consistent for the UX in my view?

@OscarLigthart
Copy link
Contributor Author

OscarLigthart commented Oct 25, 2025

Thanks for your swift reply!

In order not to add complexity to the layout with another dropdown, could you add the lineage filter to the existing "Options" dropdown - that would be a bit more consistent for the UX in my view?

I considered it. The reason I didn't was because a user would not be able to see whether a DAG is filtered or not on first glance. With this extra dropdown there is an instant feedback showing back to the user. Curious to hear your thoughts on that approach.

That being said, more than happy to move it to options. For us the feature is the more important thing.

I have an additional question: I realized that I have only implemented it for the graph view, and deliberately left out the task overview. However, in Airflow 2 it propagated to both. Shall I try to implement it for both in this PR as well?

Example:
image

to:
image

@jscheffl
Copy link
Contributor

I considered it. The reason I didn't was because a user would not be able to see whether a DAG is filtered or not on first glance. With this extra dropdown there is an instant feedback showing back to the user. Curious to hear your thoughts on that approach.

That being said, more than happy to move it to options. For us the feature is the more important thing.

Then before you rework and there might be different opinions, I think it is fair to also wait a second for other UI mainteainers feedback for UX - @pierrejeambrun / @bbovenzi What is your opinion about the UX?

@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from e5ed9dc to da02baa Compare October 25, 2025 15:42
@OscarLigthart
Copy link
Contributor Author

Perfect, in the meantime I took the liberty of ensuring the behaviour is consistent between the Grid and the Graph 👍 . This also simplified the code a bit.

Looking forward to hearing from the other UX maintainers!

@r-richmond
Copy link
Contributor

Hey Oscar thanks for tackling this p.s. #53458 was submitted for exactly this.

@OscarLigthart
Copy link
Contributor Author

OscarLigthart commented Oct 26, 2025

Hey Oscar thanks for tackling this p.s. #53458 was submitted for exactly this.

Ah I totally missed that one, thanks for the heads up! Regarding the other PR, let me know how you prefer to go ahead. Happy to continue with this PR, I have some time available for it.

@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from 0f55a58 to 4dd842e Compare October 26, 2025 12:07
@OscarLigthart OscarLigthart changed the title feat: add DAG graph lineage filter feat: add DAG Graph & Grid lineage filter Oct 26, 2025
@pierrejeambrun pierrejeambrun added this to the Airflow 3.2.0 milestone Oct 27, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super cool, I like it a lot.

I'm fine with having that as a separate dropdown than 'settings'.

I would have to play with it more but I think it's going in the right direction

@bbovenzi
Copy link
Contributor

  • I say we move forward with this PR. We haven't heard from the other PR author in a while.

  • Let's definitely not call it Lineage. That's a different concept. Just "Filter" is ok.

  • I think a separate dropdown is ok. I was tempted to put it in Options since that has plenty of other state that affects how the graph or grid are rendered, but it is important to make any filter very obvious.

@OscarLigthart
Copy link
Contributor Author

Thanks all for the feedback. I will try to find some time today or tomorrow to implement and get back to you 👍

@OscarLigthart OscarLigthart changed the title feat: add DAG Graph & Grid lineage filter feat: add task upstream/downstream filter to Graph & Grid Oct 29, 2025
@OscarLigthart
Copy link
Contributor Author

@bbovenzi I tried incorporating the feedback points you left. Thanks for the detailed review, points made a lot of sense to me. Please keep them coming!

@ashb, @bbovenzi , I changed the name to TaskStreamFilter. I wanted to be a bit more specific than just TaskFilter, as I think there are more variables that people can use for filtering tasks. However, I'm still not entirely sold by the name. So very open to suggestions.

@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from f819f6a to 9b7cfa8 Compare October 31, 2025 19:44
Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.

I think a lot of this PR can still be cleaned up.

We should make this filter the same as any table filter in Airflow and make use of searchParams. ?root=task_id&upstream=true. Then we can avoid all of this prop drilling and state management and any component that needs to be aware of the root can just check the searchParams.

@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from a206c78 to eee5cd2 Compare November 6, 2025 09:55
@OscarLigthart
Copy link
Contributor Author

We should make this filter the same as any table filter in Airflow and make use of searchParams. ?root=task_id&upstream=true. Then we can avoid all of this prop drilling and state management and any component that needs to be aware of the root can just check the searchParams.

That is actually an amazing piece of feedback! I should've thought of that before 😅 . Implemented!

Cleans up the hook and a lot of this state juggling.

@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch 2 times, most recently from e13a5b9 to 8278d6c Compare November 6, 2025 15:54
@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from 8278d6c to 78c31cf Compare November 15, 2025 08:18
@bbovenzi
Copy link
Contributor

Just have some linting issue. Please run pnpm lint:fix and pnpm format locally

@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from 0891fc9 to c23cac1 Compare November 18, 2025 19:38
@OscarLigthart OscarLigthart force-pushed the feat/ui-graph-lineage-filter branch from 3a3ce3a to c96adfc Compare November 18, 2025 19:42
@bbovenzi bbovenzi merged commit 497e0d4 into apache:main Nov 18, 2025
59 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 18, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

aaron-wolmutt pushed a commit to aaron-wolmutt/airflow that referenced this pull request Nov 20, 2025
* feat: add DAG graph lineage filter

* feat: propagate task filter to grid and graph view

* fix: rename to task stream filter and small improvements

* fix: bug in selecting root task in grid view

* refactor: use searchParams instead of LocalStorage hook

* fix: lint issues and improve light mode visuals
Copilot AI pushed a commit to jason810496/airflow that referenced this pull request Dec 5, 2025
* feat: add DAG graph lineage filter

* feat: propagate task filter to grid and graph view

* fix: rename to task stream filter and small improvements

* fix: bug in selecting root task in grid view

* refactor: use searchParams instead of LocalStorage hook

* fix: lint issues and improve light mode visuals
itayweb pushed a commit to itayweb/airflow that referenced this pull request Dec 6, 2025
* feat: add DAG graph lineage filter

* feat: propagate task filter to grid and graph view

* fix: rename to task stream filter and small improvements

* fix: bug in selecting root task in grid view

* refactor: use searchParams instead of LocalStorage hook

* fix: lint issues and improve light mode visuals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reimplement #29226 for Airflow 3 UI | Filter tasks to Upstream and/or Downstream

6 participants