This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun 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 58aab1118a Fix dropdown default and adjust tutorial to use 42 as
default for proof (#31400)
58aab1118a is described below
commit 58aab1118a95ef63ba00784760fd13730dd46501
Author: Jens Scheffler <[email protected]>
AuthorDate: Sun May 21 19:15:05 2023 +0200
Fix dropdown default and adjust tutorial to use 42 as default for proof
(#31400)
---
airflow/example_dags/example_params_ui_tutorial.py | 4 ++--
airflow/www/templates/airflow/trigger.html | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/airflow/example_dags/example_params_ui_tutorial.py
b/airflow/example_dags/example_params_ui_tutorial.py
index 485817f137..3d2ec97c99 100644
--- a/airflow/example_dags/example_params_ui_tutorial.py
+++ b/airflow/example_dags/example_params_ui_tutorial.py
@@ -65,11 +65,11 @@ with DAG(
),
# If you want to have a selection list box then you can use the enum
feature of JSON schema
"pick_one": Param(
- "value 1",
+ "value 42",
type="string",
title="Select one Value",
description="You can use JSON schema enum's to generate drop down
selection boxes.",
- enum=[f"value {i}" for i in range(1, 42)],
+ enum=[f"value {i}" for i in range(16, 64)],
),
# Boolean as proper parameter with description
"bool": Param(
diff --git a/airflow/www/templates/airflow/trigger.html
b/airflow/www/templates/airflow/trigger.html
index f98e31b0c9..a7969f7cbb 100644
--- a/airflow/www/templates/airflow/trigger.html
+++ b/airflow/www/templates/airflow/trigger.html
@@ -71,10 +71,10 @@
</div>
{% elif "enum" in form_details.schema and form_details.schema.enum %}
<select class="my_select2 form-control" name="element_{{ form_key }}"
id="element_{{ form_key }}" data-placeholder="Select Value"
- value="{% if form_details.value %}{{ form_details.value }}{% endif %}"
onchange="updateJSONconf();"
+ onchange="updateJSONconf();"
{%- if not "null" in form_details.schema.type %} required=""{% endif
%}>
{% for option in form_details.schema.enum -%}
- <option>{{ option }}</option>
+ <option{% if form_details.value == option %} selected="true"{% endif
%}>{{ option }}</option>
{% endfor -%}
</select>
{% elif form_details.schema and "array" in form_details.schema.type %}