Skip to content

Commit

Permalink
Bugfix Triggering DAG with parameters is mandatory when show_trigger_…
Browse files Browse the repository at this point in the history
…form_if_no_params is enabled (apache#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
  • Loading branch information
jscheffl authored Jan 29, 2024
1 parent e853849 commit 1197f2f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions airflow/www/templates/airflow/dag.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ <h4 class="pull-right js-dataset-triggered" style="user-select: none;-moz-user-s
<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) }}">
Expand Down
1 change: 1 addition & 0 deletions airflow/www/templates/airflow/dags.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ <h2>{{ page_title }}</h2>
<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>
Expand Down
3 changes: 2 additions & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,8 @@ def trigger(self, dag_id: str, session: Session = NEW_SESSION):
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,
Expand Down

0 comments on commit 1197f2f

Please sign in to comment.