Skip to content

Commit

Permalink
Fix update issues for object and advanced-arrays fields when empty de…
Browse files Browse the repository at this point in the history
…fault (apache#45313)
  • Loading branch information
jscheffl authored Dec 31, 2024
1 parent 24caa2b commit 6eab1f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions airflow/www/static/js/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ function updateJSONconf() {
}
}
params[keyName] = values.length === 0 ? null : values;
} else if (elements[i].value.length === 0) {
params[keyName] = null;
} else if (
elements[i].attributes.valuetype &&
(elements[i].attributes.valuetype.value === "object" ||
Expand All @@ -81,6 +79,8 @@ function updateJSONconf() {
// ignore JSON parsing errors
// we don't want to bother users during entry, error will be displayed before submit
}
} else if (elements[i].value.length === 0) {
params[keyName] = null;
} else if (Number.isNaN(elements[i].value)) {
params[keyName] = elements[i].value;
} else if (
Expand Down
4 changes: 3 additions & 1 deletion airflow/www/templates/airflow/trigger.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
{% elif form_details.schema and "object" in form_details.schema.type %}
<textarea class="form-control" name="element_{{ form_key }}" id="element_{{ form_key }}" valuetype="object" rows="6"
{%- if not "null" in form_details.schema.type %} required=""{% endif -%}>
{{- form_details.value | tojson() -}}
{%- if form_details.value %}
{{- form_details.value | tojson() -}}
{% endif -%}
</textarea>
{% elif form_details.schema and ("integer" in form_details.schema.type or "number" in form_details.schema.type) %}
<input class="form-control" name="element_{{ form_key }}" id="element_{{ form_key }}"
Expand Down

0 comments on commit 6eab1f2

Please sign in to comment.