SachinyadavAug20 opened a new issue, #77436:
URL: https://github.com/apache/airflow/issues/77436
### 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:
<img width="1906" height="1046" alt="image"
src="https://github.com/user-attachments/assets/dcaf1a69-4498-4674-be3c-0aaf5f4df9c0"
/>
#### 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:
<img width="1906" height="1046" alt="image"
src="https://github.com/user-attachments/assets/3b7c98c8-8d52-4469-aebf-c7d423aef51c"
/>
#### 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:
<img width="1906" height="1046" alt="image"
src="https://github.com/user-attachments/assets/c552f848-0b9f-41ef-af04-6607d6e10c0d"
/>
---
### 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
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]