Skip to content
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

Make skip of trigger form in UI if no params are defined configurable #33351

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,15 @@ webserver:
type: string
example: "sha256"
default: "md5"
skip_trigger_form_if_no_params:
jscheffl marked this conversation as resolved.
Show resolved Hide resolved
description: |
Behavior of the trigger DAG run button for DAGs without params. True to skip and trigger
without displaying a form to add a dag_run.conf, False to always display the form.
The form is displayed always if parameters are defined.
version_added: 2.7.0
type: boolean
example: ~
default: "True"
email:
description: |
Configuration email backend and whether to
Expand Down
3 changes: 2 additions & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,7 @@ def trigger(self, dag_id: str, session: Session = NEW_SESSION):
form_fields[k]["schema"]["custom_html_form"]
)
ui_fields_defined = any("const" not in f["schema"] for f in form_fields.values())
show_form_if_no_params = not conf.getboolean("webserver", "skip_trigger_form_if_no_params")
jscheffl marked this conversation as resolved.
Show resolved Hide resolved

if not dag_orm:
flash(f"Cannot find dag {dag_id}")
Expand All @@ -2057,7 +2058,7 @@ def trigger(self, dag_id: str, session: Session = NEW_SESSION):
if isinstance(run_conf, dict) and any(run_conf)
}

if request.method == "GET" and ui_fields_defined:
if request.method == "GET" and (ui_fields_defined or show_form_if_no_params):
jscheffl marked this conversation as resolved.
Show resolved Hide resolved
# Populate conf textarea with conf requests parameter, or dag.params
default_conf = ""

Expand Down