Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve trigger UI for string array format validation #39993

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

techolga
Copy link
Contributor

@techolga techolga commented Jun 1, 2024

closes: #39972

The schema argument in a Param definition is used to detemine the
relevant UI element. When the type of a Param is array a simple
textarea is rendered. When additionally a schema for the items of
the array is provided, the UI element previously switched to a
CodeMirror box that expects pure JSON inputs. For strings a textarea
is presented now, to keep the same behaviour than without a format
definition.

Besides that the jinja template now accesses the items member of the schema correctly to avoid problems with empty items arrays.

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Jun 1, 2024
Copy link

boring-cyborg bot commented Jun 1, 2024

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@techolga techolga marked this pull request as draft June 1, 2024 21:26
@techolga techolga force-pushed the trigger-ui-array-format-validation branch from 946ac7a to 840cb98 Compare June 1, 2024 21:42
@techolga techolga changed the title Add valuetype to improve UI for string array format validation Improve trigger UI for string array format validation Jun 1, 2024
@techolga techolga marked this pull request as ready for review June 1, 2024 21:45
@techolga techolga force-pushed the trigger-ui-array-format-validation branch from 840cb98 to dad4f43 Compare June 1, 2024 21:48
@jscheffl jscheffl self-requested a review June 1, 2024 22:45
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

Some clarification questions.

Can you please also adjust the params docs to describe the type / field redering changes by this PR in docs/apache-airflow/core-concepts/params.rst ?

airflow/www/static/js/trigger.js Outdated Show resolved Hide resolved
airflow/www/templates/airflow/trigger.html Outdated Show resolved Hide resolved
@techolga techolga force-pushed the trigger-ui-array-format-validation branch 2 times, most recently from 4138fc3 to 4951194 Compare June 3, 2024 05:28
@techolga techolga requested a review from potiuk as a code owner June 3, 2024 17:20
The schema argument in a Param definition is used to detemine the
relevant UI element. When the type of a Param is `array` a simple
textarea is rendered. When additionally a schema for the items of
the array is provided, the UI element previously switched to a
CodeMirror box that expects pure JSON inputs. For strings a textarea
is presented now, to keep the same behaviour than without a format
definition.

Besides that the jinja template now accesses the `items` member of the
schema correctly to avoid problems with empty `items` arrays.
@techolga techolga force-pushed the trigger-ui-array-format-validation branch from 2f9ecc9 to b4b2930 Compare June 3, 2024 17:26
@techolga techolga requested a review from jscheffl June 3, 2024 17:29
@eladkal eladkal added this to the Airflow 2.9.2 milestone Jun 4, 2024
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Jun 4, 2024
@jscheffl jscheffl merged commit 914bccc into apache:main Jun 4, 2024
47 checks passed
Copy link

boring-cyborg bot commented Jun 4, 2024

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@techolga techolga deleted the trigger-ui-array-format-validation branch June 4, 2024 19:32
fdemiane pushed a commit to fdemiane/airflow that referenced this pull request Jun 6, 2024
* Improve trigger UI for string array format validation

The schema argument in a Param definition is used to detemine the
relevant UI element. When the type of a Param is `array` a simple
textarea is rendered. When additionally a schema for the items of
the array is provided, the UI element previously switched to a
CodeMirror box that expects pure JSON inputs. For strings a textarea
is presented now, to keep the same behaviour than without a format
definition.

Besides that the jinja template now accesses the `items` member of the
schema correctly to avoid problems with empty `items` arrays.

* Add details about the attribute `items` for the type `array`
syedahsn pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 7, 2024
* Improve trigger UI for string array format validation

The schema argument in a Param definition is used to detemine the
relevant UI element. When the type of a Param is `array` a simple
textarea is rendered. When additionally a schema for the items of
the array is provided, the UI element previously switched to a
CodeMirror box that expects pure JSON inputs. For strings a textarea
is presented now, to keep the same behaviour than without a format
definition.

Besides that the jinja template now accesses the `items` member of the
schema correctly to avoid problems with empty `items` arrays.

* Add details about the attribute `items` for the type `array`
utkarsharma2 pushed a commit that referenced this pull request Jul 2, 2024
* Improve trigger UI for string array format validation

The schema argument in a Param definition is used to detemine the
relevant UI element. When the type of a Param is `array` a simple
textarea is rendered. When additionally a schema for the items of
the array is provided, the UI element previously switched to a
CodeMirror box that expects pure JSON inputs. For strings a textarea
is presented now, to keep the same behaviour than without a format
definition.

Besides that the jinja template now accesses the `items` member of the
schema correctly to avoid problems with empty `items` arrays.

* Add details about the attribute `items` for the type `array`

(cherry picked from commit 914bccc)
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Jul 26, 2024
* Improve trigger UI for string array format validation

The schema argument in a Param definition is used to detemine the
relevant UI element. When the type of a Param is `array` a simple
textarea is rendered. When additionally a schema for the items of
the array is provided, the UI element previously switched to a
CodeMirror box that expects pure JSON inputs. For strings a textarea
is presented now, to keep the same behaviour than without a format
definition.

Besides that the jinja template now accesses the `items` member of the
schema correctly to avoid problems with empty `items` arrays.

* Add details about the attribute `items` for the type `array`
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.

Param schema array type does does not work with items element
4 participants