airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Add "Default DAG View" preference to User Settings (Grid / Graph / Gantt)

Open SachinyadavAug20 opened this issue 1 week ago • 1 comments

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:

  1. 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.
  2. Execution/timeline users: Performance engineers investigating runtime bottlenecks and concurrency bottlenecks often prefer the Gantt view.
  3. 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:

image

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:

image

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:

image

Proposed Solution & UI Design

  1. User Settings (src/pages/Settings/Settings.tsx & src/hooks/useUserSettings.ts):
    • Add a useDefaultDagView hook in useUserSettings.ts wrapping useLocalStorage<DagView>(DEFAULT_DAG_VIEW_KEY, "grid").
    • Add a SelectSetting in Settings.tsx under a new section Dag View (or under General):
      • Label: Default Dag view
      • Helper text: View shown by default when you open a Dag.
      • Options: Grid (default), Graph, Gantt.
  2. Details Layout (src/layouts/Details/DetailsLayout.tsx):
    • Use useDefaultDagView() so DetailsLayout reads the user's configured default seamlessly.
  3. Localization (public/i18n/locales/en/common.json):
    • Add translation strings under settings.dagView.
  4. Unit Tests:
    • Add tests in Settings.test.tsx verifying default value ("grid") and persistence when toggled to "graph" or "gantt".

Related issues

None found.

Are you willing to submit a PR?

  • [x] Yes I am willing to submit a PR!

Code of Conduct

SachinyadavAug20 avatar Nov 21 '26 12:11 SachinyadavAug20

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):

image

Summary of Implementation:

  • Hook (useUserSettings.ts): Added a dedicated useDefaultDagView() hook wrapping useLocalStorage<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 to useDefaultDagView() so opening any DAG seamlessly respects the user's configured preference.
  • Localization (common.json): Added i18n translation keys under settings.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!

SachinyadavAug20 avatar Nov 21 '26 13:11 SachinyadavAug20