Skip to content

Conversation

@Prasanth345
Copy link
Contributor

@Prasanth345 Prasanth345 commented Aug 20, 2025

Summary

This PR addresses #53458 by introducing task filtering options in both Graph and Grid views to improve task visualization and debugging.

Users can now filter the DAG to display:

  • Only upstream tasks
  • Only downstream tasks
  • Both upstream & downstream tasks
  • All tasks (default)

Implementation Details

  • Graph View
    • Added support for filtering visible nodes and edges based on selected task.
    • Users can toggle upstream, downstream, or both via a dropdown.
  • Grid View
    • Built adjacency maps (upstreamMap and downstreamMap) from DAG structure data.
    • Implemented DFS traversal to collect upstream and downstream task chains.
    • Introduced visibleIds logic to selectively show tasks based on filter selection.
    • Ensured group nodes remain visible to preserve layout.
  • UI Enhancements
    • Added a Filter dropdown with options:
      • Filter Dag by task (label for "all")
      • Only upstream
      • Only downstream
      • Both upstream & downstream
    • Improved ActionButton so display text (buttonLabel) can differ from dropdown item label.

Testing

  • Verified filtering in both Graph and Grid views.
  • Confirmed correct upstream/downstream traversal.
  • Checked that "all" restores full DAG display with button label as "Filter Dag by task".

Why

This improves DAG observability by letting users focus on relevant upstream/downstream chains. It is especially useful for large DAGs where visual noise makes debugging difficult.

Related Issue

Closes #53458

Below find the screenshots

Before filter added

Screenshot from 2025-08-20 15-42-32 Screenshot from 2025-08-20 15-42-12

After filter added

Screenshot from 2025-08-20 15-47-20 Screenshot from 2025-08-20 15-47-34 Screenshot from 2025-08-20 15-47-52 Screenshot from 2025-08-20 15-48-12 Screenshot from 2025-08-20 15-48-20 Screenshot from 2025-08-20 15-48-45 Screenshot from 2025-08-20 15-48-52 Screenshot from 2025-08-20 15-49-11 Screenshot from 2025-08-20 15-49-16 Screenshot from 2025-08-20 15-49-37 Screenshot from 2025-08-20 15-49-43

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Aug 20, 2025
@Prasanth345 Prasanth345 force-pushed the feature-53458-task-filter-dropdown branch from 392fc8d to d211557 Compare August 20, 2025 12:31
@bbovenzi
Copy link
Contributor

Thanks for adding this!

I think we need to make it more obvious when the grid+graph are filtered. Especially if I filter on one task but then click on a different task. Perhaps the filter button should be moved next to the "Options" dropdown?

Also, we should probably filter the Tasks list while we're at it: #54163

@r-richmond
Copy link
Contributor

I'm very excited to see this, thank you for adding it. I'm not a front end person so I'll leave the review to Brent

@r-richmond
Copy link
Contributor

Just FYI 3.1 is in the process of being prepared. If this PR isn't merged/completed by the end of the week it will miss 3.1 and we will have to wait for the next release.

@Prasanth345 Prasanth345 force-pushed the feature-53458-task-filter-dropdown branch from cbd1654 to 7a6e1f7 Compare September 11, 2025 18:09
/>
{isActiveForThisTask ? (
<Box
bg="blue.500"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use a semantic token here instead of hard coding blue.500

Comment on lines +97 to +104
"taskFilter": {
"action_prefix": "Filter",
"all": "All",
"both": "Both upstream & downstream",
"button_all": "Filter DAG by task",
"downstream": "Only downstream",
"upstream": "Only upstream"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

This is after translation freeze. You should post this PR in the i18n channel of the Airflow Slack.

taskInstance={taskInstance}
withText={containerWidth > 700}
/>
<FilterTaskButton withText={containerWidth > 700} />
Copy link
Contributor

Choose a reason for hiding this comment

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

We should change this hardcode value now that there are so many buttons. Do you mind making it const HEADER_BREAKPOINT = 1000;?

"action_prefix": "Filter",
"all": "All",
"both": "Both upstream & downstream",
"button_all": "Filter DAG by task",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"button_all": "Filter DAG by task",
"button_all": "Filter Dag by task",

@bbovenzi
Copy link
Contributor

bbovenzi commented Oct 8, 2025

@Prasanth345 Can you rebase this so we can get this PR for 3.2?

@pierrejeambrun
Copy link
Member

@Prasanth345 are you still working on this?

@bbovenzi
Copy link
Contributor

Closing now that #57237 was merged

@bbovenzi bbovenzi closed this Nov 20, 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.

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

5 participants