jscheffl commented on code in PR #39993:
URL: https://github.com/apache/airflow/pull/39993#discussion_r1623646268
##########
airflow/www/templates/airflow/trigger.html:
##########
@@ -86,8 +86,9 @@
{% endfor -%}
</select>
{% elif form_details.schema and "array" in form_details.schema.type %}
- {% if "items" in form_details.schema and form_details.schema.items %}
- <textarea class="form-control" name="element_{{ form_key }}"
id="element_{{ form_key }}" valuetype="advancedarray" rows="6"
+ {% if "items" in form_details.schema and form_details.schema["items"] %}
+ <textarea class="form-control" name="element_{{ form_key }}"
id="element_{{ form_key }}" rows="6"
+ {%- if "string" in form_details.schema["items"]["type"] %}
valuetype="array"{% else %} valuetype="advancedarray"{% endif -%}
Review Comment:
With the proposed approach you generate a redundancy to lines 112-119. How
about if you check the negative option in line 89 such that `"string" not in
form_details.schema["items"]["type"]` - then the advancedarray is only rendered
for all non-string editions.
##########
airflow/www/static/js/trigger.js:
##########
@@ -137,6 +137,14 @@ function initForm() {
});
field.on("blur", updateJSONconf);
objectFields.set(elements[i].name, field);
+ } else if (
+ elements[i].attributes.valuetype &&
+ elements[i].attributes.valuetype.value === "array"
+ ) {
+ if (elements[i].value) {
+ elements[i].value = JSON.parse(elements[i].value).join("\n");
Review Comment:
I do not fully understand, why do you parse the original value as JSON and
then put the elements bak into a simple list again?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]