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

oAuth input parameters UI #7325

Merged
merged 5 commits into from
Nov 12, 2021
Merged

oAuth input parameters UI #7325

merged 5 commits into from
Nov 12, 2021

Conversation

avida
Copy link
Contributor

@avida avida commented Oct 25, 2021

What

UI part for #6971
All parameters list on oauthFlowInputFields are validated before sending get_consent_url reque
Here is how validation looks like:

Peek 2021-10-25 12-04

How

Describe the solution

Recommended reading order

  1. x.java
  2. y.python

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions
  • Connector added to connector index like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.

@avida avida requested review from jamakase and sherifnada October 25, 2021 10:22
@github-actions github-actions bot added area/frontend area/platform issues related to the platform labels Oct 25, 2021
@@ -105,18 +109,54 @@ export function useRunOauthFlow(
done?: boolean;
run: () => void;
} {
const { values, setValues } = useFormikContext();
const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Validation shouldn't be part of runOauthFlow explicitly. If we are going to add validation here - this method should be refactored to be more explicit on where we set errors and where we actually run flow.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think to get rid of confusion, this method shouldn't have access to formik and instead accept required props explicitly. We could add 1 more wrapper that will be adapter between form state and logic.

Copy link
Contributor

@jamakase jamakase left a comment

Choose a reason for hiding this comment

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

Awesome work @avida, but I have to reject such a PR as it requires significant changes for now and doesn't cover all UI cases.

First of all, useConnectorAuth is a service that is responsible only for auth aspect. Not for setting validation errors and etc. This part should be handled as separate flow if we are going to set up any auth errors.

Secondly, it doesn't cover all UI cases - check slack discussion where I provided detailed info, why it won't work.

  • What happens if user decides to update one of dependent fields and oauth was not run again?
  • What if user passes auth for one case but then change some of the fields?
  • What if user tried to submit request, got errors in some fields and then tried to pass auth? It should be obvious which fields are required for auth and which not.
  • What if form is long enough - some error should be displayed within oauthFlow ( above or below the button ) that some fields are required, so user will know why his flow is not starting.

What is more, I and @jrhizor confirmed that we will go next path:

We could build more of a wizard view based on the dependencies (would likely have more overlap with the future approach) purely on the frontend side

As it is easier for future refactoring.

Though if this PR is fixed properly, where we could easily adjust for future needs - I would be glad to accept it as temporary fix.

@avida avida temporarily deployed to more-secrets October 25, 2021 11:48 Inactive
@avida avida temporarily deployed to more-secrets October 25, 2021 12:02 Inactive
@avida
Copy link
Contributor Author

avida commented Oct 25, 2021

@jamakase Thanks!

Though if this PR is fixed properly, where we could easily adjust for future needs - I would be glad to accept it as temporary fix

It was supposed to be a temporary fix for e2e oAuth testing, I was not designing full UI experience. Ive addressed all the comments except of refactoring part (as it would be redo anyway and take a lot of time for me), please review it

@avida avida force-pushed the drezchykov/oauth-input-ui branch from 0b925cc to c0a85f7 Compare October 25, 2021 12:35
@avida avida temporarily deployed to more-secrets October 25, 2021 12:37 Inactive
@avida avida force-pushed the drezchykov/oauth-input-ui branch from c0a85f7 to 4b9de4b Compare October 25, 2021 12:40
@avida avida temporarily deployed to more-secrets October 25, 2021 12:41 Inactive
@avida avida requested a review from jamakase October 25, 2021 15:28
Copy link
Contributor

@jamakase jamakase left a comment

Choose a reason for hiding this comment

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

UI still doesn't cover other cases that actually should be covered and function still handles too much logic and should be split.

@@ -1,6 +1,8 @@
import { useFormikContext } from "formik";
import { useCallback, useEffect, useMemo, useRef } from "react";
import { useAsyncFn } from "react-use";
import { flatten } from "flat";
import { pick } from "lodash";
Copy link
Contributor

Choose a reason for hiding this comment

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

First of all, we do not have lodash in our dependencies list. What is more, we do not want to import all lodash lib here and aim to import only what we are using.

You will need to add lodash.pick as we use other libraries.

@jamakase jamakase temporarily deployed to more-secrets October 29, 2021 16:46 Inactive
* Oauth UI codestyle fixes
@jamakase jamakase temporarily deployed to more-secrets November 4, 2021 20:25 Inactive
@jamakase jamakase merged commit 0c41542 into master Nov 12, 2021
@jamakase jamakase deleted the drezchykov/oauth-input-ui branch November 12, 2021 12:31
avida pushed a commit that referenced this pull request Nov 15, 2021
@avida avida mentioned this pull request Nov 15, 2021
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
* oAuth input parameters UI

* fix review comments part 1

* fix review comments part 2

* Oauth UI style fixes (airbytehq#7574)

* Oauth UI codestyle fixes

Co-authored-by: Artem Astapenko <jamakase54@gmail.com>
Co-authored-by: Artem Astapenko <3767150+Jamakase@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants