- Notifications
You must be signed in to change notification settings - Fork 4.9k
🪟 Show Validation Errors on Service Form for Missing Fields #15625
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
Conversation
59d7c4c to 2aae26b 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.
Some funky workarounds to be able to use mockImplementationOnce with TS, but I wanted to change the mocked return values for each test and I think this is the cleanest way to do it (based on this and similar threads)
3416176 to 2bc0696 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.
Added the base objects to keep repeated code out of these mock implementations so it was easier to tell which property was changing with each implementation.
2bc0696 to 6f99d3a Compare airbyte-webapp/src/views/Connector/ServiceForm/components/Sections/auth/AuthButton.tsx Outdated Show resolved Hide resolved
airbyte-webapp/src/views/Connector/ServiceForm/components/Sections/auth/AuthButton.module.scss Outdated Show resolved Hide resolved
airbyte-webapp/src/views/Connector/ServiceForm/serviceFormContext.tsx Outdated Show resolved Hide resolved
timroes left a comment
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.
Left some code style comments and SCSS suggestions. Have not yet tested locally.
142450a to 3cc01b9 Compare airbyte-webapp/src/views/Connector/ServiceForm/serviceFormContext.tsx Outdated Show resolved Hide resolved
Review has been addressed, dismissing to not block this until I can re-review.
98fefda to c85f1b2 Compare 1e05535 to ec8b752 Compare * edit controls allow submit attempt for invalid form * remove unneeded calculations * add authentication required error message after submit attempt * use context instead * begin adding tests * auth button component tests * return map of field errors, not a boolean * cleanup * use scss variable * dry up repeated mock values * relative import for mock * fix casing * includes vs indexOf * changes from review * autofix space in comment
…q#15625) * edit controls allow submit attempt for invalid form * remove unneeded calculations * add authentication required error message after submit attempt * use context instead * begin adding tests * auth button component tests * return map of field errors, not a boolean * cleanup * use scss variable * dry up repeated mock values * relative import for mock * fix casing * includes vs indexOf * changes from review * autofix space in comment
What
closes #15598
This PR allows users to attempt to submit an incomplete form for setting up a connector. This allows validation errors to be surfaced which improves overall user experience (if I can't submit a form, but I don't know why, that's frustrating!).
This also adds an
Authentication requiredmessage if the validation error is OAuth-related.How
The
useServiceFormcontext now contains a specific object for errors related to hidden auth fields. TheAuthButtoncomponent grabs those and checks to see if it's due to an empty field.NOTE: This will (and can) only show an error message for Connectors that mark authentication as required in their spec. A few of these are: Mailchimp, Salesforce, and Github.
However, other Connectors such as HubSpot, Google Ads, Google Sheets, Facebook Ads, and more allow a user to test the connector without completing oauth (the check fails if there's no credentials, but that is different than the field having an error).
This is due to how the connector spec is written. If we want to surface the
Authentication requiredmessage, then the spec would need to be changed to include that auth is required.Testing
Authentication requiredAuthentication succeeded!. Currently, Salesforce and Mailchimp should work againstfrontend-devusing the workflow outlined in the "Testing OAuth Locally" Notion docRecommended reading order
AuthButton.*serviceFormContext.tsx