Skip to content

Add URL param support to calendar view (#73237) - #73762

Merged
pierrejeambrun merged 5 commits into
apache:mainfrom
basantjamwal:fix-calendar-view-url-params-73237
Oct 8, 2026
Merged

pierrejeambrun merged 5 commits into
apache:mainfrom
basantjamwal:fix-calendar-view-url-params-73237

Conversation

@basantjamwal

Copy link
Copy Markdown
Contributor

closes: #73237

Description

The calendar view's granularity (daily/hourly), run-status filter (total/failed), and selected timeframe were previously stored in localStorage only, so the view's state was never reflected in the URL — meaning links to a specific calendar view couldn't be shared.

This PR moves that state entirely to URL search params (calendar-granularity, calendar-view-mode, calendar-date), removing the localStorage persistence. This follows the approach agreed on in the issue discussion: URL params for shareable view state, keeping localStorage reserved for genuinely personal settings (timezone, theme), which are unaffected by this change.

Changes

  • Calendar.tsx: replaced useState/useLocalStorage with useSearchParams
  • searchParams.ts: added CALENDAR_GRANULARITY, CALENDAR_VIEW_MODE, CALENDAR_DATE keys
  • localStorage.ts: removed the now-unused CALENDAR_GRANULARITY_KEY / CALENDAR_VIEW_MODE_KEY

Testing

  • Verified toggling granularity/run-status/date updates the URL correctly
  • Verified reloading the page preserves the exact view
  • Verified pasting the URL in an incognito window (fresh session) restores the same view
  • Verified visiting the bare /calendar URL with no params falls back cleanly to defaults

Shared link preserves view state — opening a URL with calendar-granularity=hourly&calendar-view-mode=failed&calendar-date=2026-07-26 in a fresh incognito session immediately shows that exact view:

Shared link preserves view state

Default view when no params are present — visiting the bare /calendar URL falls back cleanly to Daily / Total Runs / current month:

Default view with no params
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude (Anthropic) following the guidelines

@boring-cyborg

boring-cyborg Bot commented Sep 26, 2026

Copy link
Copy Markdown

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
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@basantjamwal
basantjamwal force-pushed the fix-calendar-view-url-params-73237 branch from a4a595a to dc6eac4 Compare September 26, 2026 17:58

@yuseok89 yuseok89 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change! A unit test for the calendar URL params would be nice to have.

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM tested and working as expected.

As requested a few tests would be nice. It's easy to regress at the moment.

Also CI seems unhappy. Restarted it a third time to see if those are transient or not might need fixing.

@pierrejeambrun

Copy link
Copy Markdown
Member

@basantjamwal Do you mind rebasing the PR, fixing the CI and adding a few tests so we can merge this. It would be a great addition.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.4.1 milestone Oct 2, 2026
@basantjamwal
basantjamwal force-pushed the fix-calendar-view-url-params-73237 branch from dc6eac4 to 0edad15 Compare October 2, 2026 18:20
@basantjamwal

Copy link
Copy Markdown
Contributor Author

Hi @pierrejeambrun, I've rebased the PR and added tests for the calendar URL params. The workflows are awaiting approval, so CI hasn't run yet. Let me know if anything else is needed!

@pierrejeambrun

Copy link
Copy Markdown
Member

Static check need fixing

@bbovenzi

bbovenzi commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Looks like dag-calendar-tab.spec.ts e2e test is broken

@basantjamwal
basantjamwal force-pushed the fix-calendar-view-url-params-73237 branch from 1f4d721 to 72f4ec4 Compare October 8, 2026 09:06
@basantjamwal

Copy link
Copy Markdown
Contributor Author

Fixed. The dag-calendar-tab.spec.ts page object now waits for the view-mode URL update before reading cells. Also rebased on latest main.

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks

@pierrejeambrun
pierrejeambrun merged commit 3fa1eb5 into apache:main Oct 8, 2026
90 checks passed
@boring-cyborg

boring-cyborg Bot commented Oct 8, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support URL params for calendar view

4 participants