viiccwen opened a new pull request, #55277:
URL: https://github.com/apache/airflow/pull/55277
## Description
This PR introduces a new feature that allows **trigger DAG modals** with
**Single/Backfill** mode to be opened directly via URL using the query string
parameter.
The feature also supports **pre-populating form fields** from URL
parameters, improving automation and integration with external tools.
## Changes
### 1. Trigger Modal Opening
* When visiting a DAG page with `?trigger=true` or `?trigger=1`, the Trigger
Modal automatically opens.
* This behavior applies to both **single run** and **backfill run** modes.
### 2. URL Parameter Pre-Population
Trigger form supports (you can check its functionality on UI):
* `conf` (parsed as JSON if valid)
* `dag_run_id`
* `logical_date`
* `note`
Backfill form supports (you can check its functionality on UI):
* `start_date`
* `end_date`
* `run_backwards`
* `reprocess_behavior`
* `max_active_runs`
* `conf` (parsed as JSON if valid)
### 3. Utilities Added
New helpers in `utils/query.ts`:
* `decodeParam`: safely decode URL parameters
* `parseJsonSafe`: parse JSON safely, fallback to raw string if invalid
* `getUrlParam`: unified function for extracting parameters, with optional
JSON parsing
### 4. Advanced Options
* The **Advanced Options** section is expanded automatically when pre-filled
values are detected from URL parameters.
### 5. UX Details
* Closing the modal clears the parameter to prevent reopening on refresh.
## Examples
### 1. Single mode
`?trigger=true&mode=single&conf={"environment":"production","debug":true,"user":"admin"}&run_id=test_run_001&logical_date=2024-01-15T10:30:00.000¬e=testing
note`
### 2. Backfill mode
`?trigger=true&mode=backfill&start_date=2024-01-01&end_date=2024-01-31&run_backwards=true&reprocess_behavior=missing_runs&max_active_runs=3&conf={"environment":"staging","batch_size":1000}`
## Snapshot
In the video, I tried with
`?trigger=true&mode=backfill&start_date=2024-01-01&end_date=2024-01-05&reprocess_behavior=all_runs&conf={"foo":"loo"}`
https://github.com/user-attachments/assets/c74ad3f2-bc2f-46bb-9b22-937f622d0d25
## Question
Should we modify:
1. field name?
2. trigger way (now we use `?trigger`, maybe use `/trigger`) 🤔
## Related Issue
resolves #54800
--
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]