Skip to content

Commit

Permalink
Fix dropdown default and adjust tutorial to use 42 as default for pro…
Browse files Browse the repository at this point in the history
…of (#31400)

(cherry picked from commit 58aab11)
  • Loading branch information
jscheffl authored and eladkal committed Jun 9, 2023
1 parent e28c88f commit f529d15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions airflow/example_dags/example_params_ui_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
),
# 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(
Expand Down
4 changes: 2 additions & 2 deletions airflow/www/templates/airflow/trigger.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down

0 comments on commit f529d15

Please sign in to comment.