-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
lib: Add validation to DynamicListForm #19251
lib: Add validation to DynamicListForm #19251
Conversation
b25ddde
to
fb5912c
Compare
fb5912c
to
bf0fb9f
Compare
53dcbde
to
bf0fb9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! As someone who has no context about this change, the API is a bit hard to grasp. Please document the data type, usage, and example of the new properties in a comment at the top.
231c740
to
a7edca6
Compare
In the end I decided not to introduce some very abstract, general helper functions (as seen in previous version of the PR), because I realized they would be hard to understand and hard to mantain |
a7edca6
to
017b61c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The code looks okay, just the documentation could use some improvements. I added no-test, as this code isn't being used anywhere in cockpit -- so you can land it faster in the next round.
017b61c
to
5d572fe
Compare
5d572fe
to
8e33bf6
Compare
8e33bf6
to
4720bc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM now. I triggered the required test.
* [ | ||
* { name: "Name must not be empty }, // first row | ||
* { }, // second row | ||
* { name: "Name cannot containt number", email: "Email must contain '@'" } // third row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"contain"
validationFailed: validationFailed && validationFailed[idx], | ||
onValidationChange: value => { | ||
// Dynamic list consists of multiple rows. Therefore validationFailed object is presented as an array where each item represents a row | ||
// Each row/item then consists of key-value pairs, which represent a field name and it's validation error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"its validation error"
Split from cockpit-project/cockpit-podman#1354