Skip to content

Conversation

@teallarson
Copy link
Contributor

@teallarson teallarson commented Aug 12, 2022

What

closes #15598

Screen Shot 2022-08-22 at 10 41 23 AM

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 required message if the validation error is OAuth-related.

How

The useServiceForm context now contains a specific object for errors related to hidden auth fields. The AuthButton component 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 required message, then the spec would need to be changed to include that auth is required.

Testing

  • Try setting up different Source/Destination connectors. You should be able to click the setup button and see validation errors
  • For Github, Salesforce, and Mailchimp you should see Authentication required
    • After successful authentication, you should see Authentication succeeded!. Currently, Salesforce and Mailchimp should work against frontend-dev using the workflow outlined in the "Testing OAuth Locally" Notion doc

Recommended reading order

  1. AuthButton.*
  2. serviceFormContext.tsx
  3. other
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Aug 12, 2022
@teallarson teallarson force-pushed the teal/service-form-error-messaging branch from 59d7c4c to 2aae26b Compare August 15, 2022 19:36
@teallarson teallarson changed the title WIP edit controls allow submit attempt for invalid form 🪟 Show Validation Errors on Service Form for Missing Fields Aug 22, 2022
@teallarson teallarson marked this pull request as ready for review August 22, 2022 14:57
@teallarson teallarson requested a review from a team as a code owner August 22, 2022 14:57
Comment on lines +21 to +26
Copy link
Contributor Author

@teallarson teallarson Aug 22, 2022

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)

@teallarson teallarson force-pushed the teal/service-form-error-messaging branch from 3416176 to 2bc0696 Compare August 22, 2022 15:07
Copy link
Contributor Author

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.

Copy link
Contributor

@timroes timroes left a 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.

@teallarson teallarson force-pushed the teal/service-form-error-messaging branch from 142450a to 3cc01b9 Compare August 25, 2022 14:54
@timroes timroes dismissed their stale review August 25, 2022 15:45

Review has been addressed, dismissing to not block this until I can re-review.

@teallarson teallarson force-pushed the teal/service-form-error-messaging branch from 98fefda to c85f1b2 Compare August 25, 2022 15:51
@teallarson teallarson force-pushed the teal/service-form-error-messaging branch from 1e05535 to ec8b752 Compare August 29, 2022 15:05
@teallarson teallarson merged commit f944266 into master Aug 29, 2022
@teallarson teallarson deleted the teal/service-form-error-messaging branch August 29, 2022 16:13
rodireich pushed a commit that referenced this pull request Aug 29, 2022
* 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
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend Related to the Airbyte webapp area/platform issues related to the platform

4 participants