SachinyadavAug20 opened a new pull request, #77450:
URL: https://github.com/apache/airflow/pull/77450

   closes: #77436
   
   ### Description
   Adds a user-configurable **Default DAG View** setting (`Grid`, `Graph`, 
`Gantt`) to the Airflow User Settings page (`/settings`).
   
   - Users can configure their global default landing preference for opening 
DAGs (defaulting to `grid`).
   - Active DAG view toggling is cleanly scoped per DAG in localStorage via 
`dagViewKey(dagId)` (mirroring the established `directionKey(dagId)` pattern 
from `Graph.tsx`), preventing transient in-page view changes from clobbering 
the user's global preference.
   - Non-destructive view derivation (`effectiveDagView = !Boolean(runId) && 
dagView === "gantt" ? "grid" : dagView`) ensures users with a `gantt` 
preference can browse runless DAG pages safely without their stored preference 
being wiped out.
   - Active view selection persists seamlessly across DAG sub-route navigation 
(`/dags/:dagId` -> `/dags/:dagId/tasks/:taskId` -> `/dags/:dagId/runs/:runId`).
   
   ### Key Changes
   - `src/hooks/useUserSettings.ts`: Exported `useDefaultDagView()` hook.
   - `src/constants/localStorage.ts`: Added `DEFAULT_DAG_VIEW_KEY` and 
`dagViewKey(dagId)` helper.
   - `src/pages/Settings/Settings.tsx`: Added `Dag View` section with selector 
for `Grid`, `Graph`, and `Gantt`.
   - `src/layouts/Details/DetailsLayout.tsx`: Scoped active view per-DAG and 
derived effective view non-destructively.
   - `public/i18n/locales/en/common.json`: Added `settings.dagView` 
localization strings.
   - Unit tests: Added comprehensive coverage in `Settings.test.tsx`, 
`DetailsLayout.test.tsx`, and `useUserSettings.test.tsx`.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (Antigravity)
   
   Generated-by: Antigravity following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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]

  • [PR] Add default Dag view prefer... SachinyadavAug20 (via GitHub) via commits

Reply via email to