-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Feat: Support URL params for pre-filling Trigger and Backfill forms #59231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: Support URL params for pre-filling Trigger and Backfill forms #59231
Conversation
jscheffl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Looks clear and good for me.
I tried but the trigger form was not opening. Don't know if I mis-understood but I needed to click the "trigger" button to open the form pre-populated. Otherwise working fine. I'd expected it is oepning pre-populated when calling with a prepared/pre-filled URL.
|
|
||
| The ability to update params while triggering a Dag depends on the flag ``core.dag_run_conf_overrides_params``. | ||
| Setting this config to ``False`` will effectively turn your default params into constants. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you maybe add a chapter header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jscheffl Agreed. I have added a new section header "Pre-populating Trigger Form via URL" to clearly separate this topic in the documentation.
|
|
||
| - ``run_backwards`` - if set to true, the backfill is scheduled in reverse order. Defaults to ``false``. | ||
|
|
||
| The trigger form now supports two different ways of providing ``conf`` values. The available input methods are summarized in the table below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The term "now" is a bit relative... especially if you might read the same text in 10 years if the feature still exists.
| The trigger form now supports two different ways of providing ``conf`` values. The available input methods are summarized in the table below: | |
| The trigger form supports two different ways of providing ``conf`` values. The available input methods are summarized in the table below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The term "now" is a bit relative... especially if you might read the same text in 10 years if the feature still exists.
Good point. I have updated the text to remove the word "now" as suggested.
Hi @jscheffl Thanks for catching that! You are correct, I missed wiring the URL state to the modal visibility logic in the initial commit. I have pushed a fix in the latest commit (Overview.tsx) where I check for the mode parameter in the URL. Now, if the URL contains /trigger/single or /trigger/backfill, the modal will open automatically with the pre-populated values. |
closes: #54800
Description
This PR restores and enhances the ability to pre-populate the Trigger DAG and Backfill forms via URL query parameters in the Airflow 3.0 UI. This feature existed in Airflow 2.x and is useful for sharing pre-configured run links.
Key Changes:
URL Param Parsing:
useSearchParamshook (replacing manual parsing logic from stale PRs).getTriggerConfto handle both JSON strings (?conf={"a":1}) and Key-Value pairs (?a=1).Form Updates:
run_id,logical_date,note, andconf.from_date,to_date,max_active_runs,reprocess_behavior, andrun_backwards.Code Quality:
RunBackfillForm.tsxlogic to keep the file size strictly under the 250-line linting limit.from_date/to_date) to match the API and UI components.Documentation:
docs/core-concepts/params.rstto document the supported URL parameters and examples.How to reproduce / Test
You can test this by running the UI and navigating to any DAG (e.g.,
tutorial) using the following URLs:1. Trigger Single Run (JSON Config):
The modal should open, fields should be filled, and the JSON editor should show the config.
http://localhost:8080/dags/tutorial/trigger/single?run_id=test_run_01¬e=Testing_Note&conf={"environment":"dev","debug":true}
2. Trigger Single Run (Key-Value Config):
The "Advanced Options" should open and show
{"foo": "bar"}.http://localhost:8080/dags/tutorial/trigger/single?foo=bar&retry=3
3. Backfill Form:
The Backfill form should open with dates, max runs, and the "Run Backwards" checkbox pre-selected.
http://localhost:8080/dags/tutorial/trigger/backfill?from_date=2024-01-01T00:00:00&to_date=2024-01-05T00:00:00&max_active_runs=5&run_backwards=true
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.