Group and filter Dags by folder on the Dags page#68544
Conversation
|
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
|
|
Can you please add a screenshow or small video recording of how it looks like? |
|
Thanks for the review @jscheffl ! Here's what the feature looks like:
Enregistrement.de.l.ecran.2026-06-17.a.16.03.29.movI also removed the newsfragment as you suggested. One more note: a |
|
PR is marked as draft, are you planning additional work before being ready for review? |
|
Hi @pierrejeambrun No further work planned, it's ready for review. I've addressed @jscheffl 's feedback (added a screenshot + a short video of the feature, and removed the newsfragment). |
There was a problem hiding this comment.
Thanks for the PR, that's cool!
Tested and working as expected, a few suggestions though.
Always-rendered tree — even deployments with all Dags at the bundle root get the 280px sidebar (just "All Dags" + an empty message). Slight clutter for the flat case; consider hiding the panel when there are no folders. Or even better, a visual toggle to hide/display this sidebar.
CI need fixing (conflicts, rebasing should also fix the failing check)
a8d2151 to
ea0797e
Compare
ea0797e to
3040cb2
Compare
pierrejeambrun
left a comment
There was a problem hiding this comment.
LGTM, this needs a rebase + conflict solving before we can merge.
3040cb2 to
9fc1556
Compare
|
Need to fix the conflicts before we can merge. |
pierrejeambrun
left a comment
There was a problem hiding this comment.
I just had a chat with Jed, very good comment from him is that this doesn't take into account multi bundle deployment.
Meaning that dags coming from different bundle will be merged under the same tree. All dags will appear as if they were collocated under the same directory. Which probably isn't what the user expect.
Would it be possible to update the PR so when there are multiple bundles (has to be returned in the DagFolderCollectionResponse payload, for each folder basically) the bundle is displayed in the UI as the top level entry and then the folder tree appears under each bundle. When there is only one bundle keep the current UI.
Add a collapsible folder navigation tree to the Dags page, built from each Dag's relative_fileloc directory. Selecting a folder filters the list to the Dags it contains (and its subfolders) via a new server-side filter, so the result stays correct across pagination, sorting and other filters. Because relative_fileloc is relative to each bundle, folders are scoped to their bundle: in multi-bundle deployments the bundle is shown as the top-level entry with its folder tree nested underneath, so folders sharing the same path in different bundles stay separate. Single-bundle deployments keep the flat tree. Backend adds a relative_fileloc_prefix filter on GET /ui/dags and a new GET /ui/dags/folders endpoint returning the distinct (bundle, folder) pairs of all readable Dags. Dags at the bundle root contribute no folder and appear under 'All Dags'. The folder sidebar is hidden for flat deployments with no folders.
9fc1556 to
6025038
Compare
|
Thanks @pierrejeambrun and @jedcunningham, good catch on the multi-bundle case! I updated the PR. The folders endpoint now returns the bundle with each folder, since a folder path is relative to its bundle and can exist in more than one. When there are several bundles the tree shows the bundle first and the folders under it, so two bundles with the same path don't get mixed together. With a single bundle it stays flat like before. Selecting a folder now uses its bundle too (with the existing bundle_name filter), so team_a/etl in two bundles points to the right dags. Also rebased on main to fix the conflicts. Added tests for both (same path in two bundles staying separate, and the bundle grouping in the tree). |
| borderRadius="sm" | ||
| cursor="pointer" | ||
| gap={1} | ||
| onClick={() => onSelectFolder({ bundleName: bundle.bundleName, folder: undefined })} |
There was a problem hiding this comment.
We shouldn't be putting onClick handlers on flex and divs. They should be buttons. But fortunately, we don't have to do this ourselves. Chakra has a Tree View component that we can use!

What
Adds a folder navigation tree to the Dags page. The tree is built from each
Dag's
relative_filelocdirectory, and selecting a folder filters the Dag listto the Dags that live in it (and its subfolders).
Why
The Dags page only offered a flat list. In deployments with many Dags spread
across subfolders of the dags folder (e.g.
team_a/etl/…,team_b/ml/…) therewas no way to browse or filter by folder.
How
relative_fileloc_prefixfilter onGET /ui/dags(strict folder match, so
team_anever catchesteam_alpha) and a newGET /ui/dags/foldersendpoint returning the distinct folders of all readableDags. Filtering is done server-side so the result stays correct across
pagination, sorting and the other filters.
filter via a
dag_foldersearch param, with the tree hierarchy reconstructedclient-side from the folder paths.
Dags located at the bundle root contribute no folder and appear under "All Dags".
Tests: backend (folders endpoint + filter, incl. the
team_a/team_alphaedge case) and frontend (
buildFolderTreeunit tests +DagFolderTreecomponent tests).
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines
Important
🛠️ Maintainer triage note for @RabahAmrouche05 · by
@potiuk· 2026-07-02 17:46 UTCSome review feedback from
@pierrejeambrunis waiting on you:@pierrejeambrunneed a reply or a fix.The ball is in your court — you've been assigned to this PR. Reply or push a fix in each thread, then mark them resolved.
Automated triage — may be imperfect; a maintainer takes the next look.