Add "Default DAG View" preference to User Settings (Grid / Graph / Gantt)
Description
Add a user-configurable Default DAG View setting (Grid, Graph, Gantt) to the Airflow User Settings page (/settings).
Currently, when users open any DAG page (/dags/{dag_id}), Airflow always defaults to the Grid view unless the user manually toggles the view to Graph or Gantt. While the UI tracks DEFAULT_DAG_VIEW_KEY in localStorage, there is no explicit setting in /settings allowing users to configure their global preference.
This proposal adds a "Default DAG view" selector in /settings under a dedicated Dag View section (or under General), matching the existing user preference options like defaultLandingPage, defaultTaskInstanceTab, and defaultGraphDirection.
Use case/motivation
Use case/motivation
Data practitioners, pipeline operators, and Airflow developers frequently have differing workflow preferences:
- Graph-first users: Data engineers investigating task dependencies and DAG structure often prefer immediately seeing the topological Graph view rather than the execution run grid.
- Execution/timeline users: Performance engineers investigating runtime bottlenecks and concurrency bottlenecks often prefer the Gantt view.
- Run-history users: Operators monitoring batch status prefer the default Grid view.
In Airflow 3, the User Settings page (/settings) allows users to customize several personal defaults, including:
- Landing page: Dashboard vs. DAGs list
- Default task instance tab: Logs vs. Details vs. Code vs. Rendered Templates, etc.
- Default graph direction: Left-to-Right, Top-to-Bottom, etc.
- Expand task groups by default: On / Off
- Match anywhere by default: On / Off
However, there is no setting to choose your default DAG view. If a user prefers the Graph view or Gantt view, they must manually click the view switch every time their browser storage resets or across different workstations. Exposing this in User Settings completes the user customization experience and aligns with all other Airflow 3 preference controls.
Current Behavior & Visual Evidence
1. Opening a DAG always defaults to Grid view
When navigating to /dags/{dag_id}, the UI always lands on the Grid view:
2. Switching to Graph or Gantt view
Users can switch to the Graph view or Gantt view via the toolbar toggle, but cannot persist this as their default landing view:
3. User Settings page lacks a Default DAG View option
The /settings page contains configurations for Landing page, Search, Graph direction, and Task instance tabs, but no option for Default DAG view:
Proposed Solution & UI Design
- User Settings (
src/pages/Settings/Settings.tsx&src/hooks/useUserSettings.ts):- Add a
useDefaultDagViewhook inuseUserSettings.tswrappinguseLocalStorage<DagView>(DEFAULT_DAG_VIEW_KEY, "grid"). - Add a
SelectSettinginSettings.tsxunder a new sectionDag View(or underGeneral):- Label:
Default Dag view - Helper text:
View shown by default when you open a Dag. - Options:
Grid(default),Graph,Gantt.
- Label:
- Add a
- Details Layout (
src/layouts/Details/DetailsLayout.tsx):- Use
useDefaultDagView()soDetailsLayoutreads the user's configured default seamlessly.
- Use
- Localization (
public/i18n/locales/en/common.json):- Add translation strings under
settings.dagView.
- Add translation strings under
- Unit Tests:
- Add tests in
Settings.test.tsxverifying default value ("grid") and persistence when toggled to "graph" or "gantt".
- Add tests in
Related issues
None found.
Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Implementation Update & UI Preview:
I have put together a local working implementation of this feature and verified it with tests
Working UI in User Settings (/settings):
Summary of Implementation:
- Hook (
useUserSettings.ts): Added a dedicateduseDefaultDagView()hook wrappinguseLocalStorage<DagView>(DEFAULT_DAG_VIEW_KEY, "grid"). - User Settings (
Settings.tsx): Added a dedicated Dag View section between Dags List and Graph with options for Grid (default), Graph, and Gantt. - Details Layout (
DetailsLayout.tsx): Switched touseDefaultDagView()so opening any DAG seamlessly respects the user's configured preference. - Localization (
common.json): Added i18n translation keys undersettings.dagView. - Testing (
Settings.test.tsx): Added unit test coverage verifying default value (grid), dropdown rendering, and state persistence.
All unit tests (vitest), linter (oxlint, eslint), and formatting (oxfmt) pass cleanly.
I have the branch ready with DCO sign-off and can submit the pull request whenever maintainers are happy to proceed!