-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix/393 Match api email validation #402
Conversation
@GermanSaracca There is still a difference between the form validation and the API validation - from my testing, I think the API validation is requiring that the email address be from a list of top level domains, for example: https://data.iana.org/TLD/tlds-alpha-by-domain.txt. When I try an address that is not in the TLD list, I get an error: I did some searches and couldn't find a javascript library that does something similar, so I'm not sure the best way to handle this, what do you think? |
Hi @ekraffmiller , your findings are totally correct, there is no Javascript library that does the same validations as the Apache library ( at least not a maintained one ). |
Yes, I think so too, it would be very cumbersome to maintain a list in our code. The new alert messages work very well to inform the user 👍 |
@GermanSaracca There are some warnings due to the new lint tests...I know we don't need to fix them all, but maybe this PR could fix the ones related to Create Dataset?
|
I completely agree, I will fix those eslint warnings, thanks @ekraffmiller |
@ekraffmiller Eslint warnings were addressed 👍🏼 , thanks! |
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.
LGTM!
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.
LGTM
What this PR does / why we need it:
Fixes a mismatch between the email validation of the SPA Dataset creation form and the email validation of the dataverse api.
Also improves the UX to display the alert error banner only when creations fail, with messages specific to both the client-javascript api wrapper and the dataverse api itself (from the latter extracting only the field-related part of the error and not the part of the error related to Java invalid value exceptions).
Which issue(s) this PR closes:
Closes #393
Special notes for your reviewer:
Suggestions on how to test this:
Enter an invalid email ([email protected]) and check that the error message is displayed below the field.
It is a bit difficult to test the error messages in the banners as the validations are being fulfilled from the form before it is submitted.
One option could be to test locally, modifying the code so that no fields are required within the form and submitting the form, in
useDefineRules.tsx
set the required property tofalse
.Does this PR introduce a user interface change? If mockups are available, please link/include them here:
The same error banner is maintained, only now when the user submits the form, if there is an error and this banner appears, it is automatically focused with an specific message about the error.
Error thrown from the dataverse api 👇

Error thrown from the client-javascript api wrapper 👇

How the error banner is focused 👇
In this example the client-side validations were removed just to show the focus case.
alert-error-behaviour.webm
Is there a release notes update needed for this change?:
No.
Additional documentation:
No.