Skip to content

Fix number param html type in trigger template#31980

Merged
hussein-awala merged 2 commits into
apache:mainfrom
hussein-awala:fix/ui_number_params
Jun 19, 2023
Merged

Fix number param html type in trigger template#31980
hussein-awala merged 2 commits into
apache:mainfrom
hussein-awala:fix/ui_number_params

Conversation

@hussein-awala

Copy link
Copy Markdown
Member

related: #31930
related: #31946

It seems that when I changed the valuetype to decimal, the value was passed to the API a string which raise a validation exception in the dag run. Changing just the type to decimal is sufficient to fix the initial issue, for ex:

DAG(
    dag_id="params",
    schedule_interval=None,
    start_date=days_ago(2),
    params={
        "param_1": Param(default=None, type=["number", "null"]),
        "param_2": Param(default='x', type='string')
    },
)

image

image


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

…hange only type value

Signed-off-by: Hussein Awala <hussein@awala.fr>
@boring-cyborg boring-cyborg Bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Jun 17, 2023
@hussein-awala hussein-awala requested a review from potiuk June 17, 2023 19:48
Comment thread airflow/www/templates/airflow/trigger.html Outdated
<select class="my_select2 form-control" name="element_{{ form_key }}" id="element_{{ form_key }}" data-placeholder="Select Value"
onchange="updateJSONconf();"
{%- if "integer" in form_details.schema.type %} valuetype="number" {% elif "number" in form_details.schema.type %} valuetype="decimal" {%- endif %}
{%- if "integer" in form_details.schema.type or "number" in form_details.schema.type %} valuetype="number"{% endif %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just to make sure, this PR reverts this line from #31946 and the aggregated change is only line 120, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because we need just to change type attribute

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@hussein-awala hussein-awala merged commit 2327718 into apache:main Jun 19, 2023
@ephraimbuddy ephraimbuddy added this to the Airlfow 2.6.3 milestone Jul 6, 2023
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Jul 6, 2023
ephraimbuddy pushed a commit that referenced this pull request Jul 6, 2023
* Keep valuetype="number" for both param number and integer types and change only type value

Signed-off-by: Hussein Awala <hussein@awala.fr>

* Update airflow/www/templates/airflow/trigger.html

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>

---------

Signed-off-by: Hussein Awala <hussein@awala.fr>
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
(cherry picked from commit 2327718)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants