This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 1197f2ff65 Bugfix Triggering DAG with parameters is mandatory when
show_trigger_form_if_no_params is enabled (#37063)
1197f2ff65 is described below
commit 1197f2ff654e2fdafbb9d410a8d99cb6d6d3f8e6
Author: Jens Scheffler <[email protected]>
AuthorDate: Mon Jan 29 13:50:56 2024 +0100
Bugfix Triggering DAG with parameters is mandatory when
show_trigger_form_if_no_params is enabled (#37063)
* Add a requested default configuration to form call to start w/o form
display
* Follow-up bugfix - ensure bad form values are transferred when key exists
---
airflow/www/templates/airflow/dag.html | 1 +
airflow/www/templates/airflow/dags.html | 1 +
airflow/www/views.py | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/airflow/www/templates/airflow/dag.html
b/airflow/www/templates/airflow/dag.html
index 8d39d05a40..8d77db0181 100644
--- a/airflow/www/templates/airflow/dag.html
+++ b/airflow/www/templates/airflow/dag.html
@@ -231,6 +231,7 @@
<input type="hidden" name="csrf_token" value="{{
csrf_token() }}">
<input type="hidden" name="dag_id" value="{{ dag.dag_id }}">
<input type="hidden" name="unpause" value="True">
+ <input type="hidden" name="conf" value="{}">
<!-- for task instance detail pages, dag_id is still a query
param -->
{% if 'dag_id' in request.args %}
<input type="hidden" name="origin" value="{{
url_for(request.endpoint, **request.args) }}">
diff --git a/airflow/www/templates/airflow/dags.html
b/airflow/www/templates/airflow/dags.html
index 93d03dfdcf..0acd68b5a1 100644
--- a/airflow/www/templates/airflow/dags.html
+++ b/airflow/www/templates/airflow/dags.html
@@ -377,6 +377,7 @@
<input type="hidden" name="csrf_token" value="{{
csrf_token() }}">
<input type="hidden" name="dag_id" value="{{
dag.dag_id }}">
<input type="hidden" name="unpause" value="True">
+ <input type="hidden" name="conf" value="{}">
<button type="submit"
class="dropdown-form-btn">Trigger DAG</button>
</form>
</li>
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 7bb5b9854b..09355bec77 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -2189,7 +2189,8 @@ class Airflow(AirflowBaseView):
form = DateTimeForm(data={"execution_date": execution_date})
# Take over "bad" submitted fields for new form display
for k, v in form_fields.items():
- form_fields[k]["value"] = run_conf[k]
+ if k in run_conf:
+ form_fields[k]["value"] = run_conf[k]
return self.render_template(
"airflow/trigger.html",
form_fields=form_fields,