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

🪟 🐛 Fix Setup Source Button on OAuth Sources #14413

Merged
merged 4 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const FormRoot: React.FC<FormRootProps> = ({
isLoadSchema={isLoadingSchema}
fetchingConnectorError={fetchingConnectorError}
hasSuccess={hasSuccess}
isValid={isValid}
/>
)}
</FormContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface CreateControlProps {

isTestConnectionInProgress: boolean;
onCancelTesting?: () => void;
isValid: boolean;
}

const ButtonContainer = styled.div`
Expand All @@ -41,7 +40,6 @@ const CreateControls: React.FC<CreateControlProps> = ({
fetchingConnectorError,
isLoadSchema,
onCancelTesting,
isValid,
}) => {
if (isSubmitting) {
return <TestingConnectionSpinner isCancellable={isTestConnectionInProgress} onCancelTesting={onCancelTesting} />;
Expand All @@ -55,7 +53,7 @@ const CreateControls: React.FC<CreateControlProps> = ({
<ButtonContainer>
{errorMessage && !fetchingConnectorError && <TestingConnectionError errorMessage={errorMessage} />}
{fetchingConnectorError && <FetchingConnectorError />}
<SubmitButton type="submit" disabled={isLoadSchema || !isValid}>
<SubmitButton type="submit" disabled={isLoadSchema}>
<FormattedMessage id={`onboarding.${formType}SetUp.buttonText`} />
</SubmitButton>
</ButtonContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import pick from "lodash/pick";
import { ConnectorDefinitionSpecification } from "core/domain/connector";
import { useRunOauthFlow } from "hooks/services/useConnectorAuth";

import { isSourceDefinitionSpecification } from "../../../../../../core/domain/connector/source";
import { useServiceForm } from "../../../serviceFormContext";
import { ServiceFormValues } from "../../../types";
import { makeConnectionConfigurationPath, serverProvidedOauthPaths } from "../../../utils";
Expand All @@ -24,7 +23,7 @@ function useFormikOauthAdapter(connector: ConnectorDefinitionSpecification): {
const onDone = (completeOauthResponse: Record<string, unknown>) => {
let newValues: ServiceFormValues;

if (connector.advancedAuth && !isSourceDefinitionSpecification(connector)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just trying to understand the change: Now this should both apply to source and destination. Do we know the reason why this was added in the first place?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately we don't. This was added as part of the Generated Query client, and changed the functionality that time from getting into this path for all advancedAuth connectors as now again, to only apply for source. I suspect this was simply an error (or maybe something that remained accidentally from satisfying new TypeScript types).

if (connector.advancedAuth) {
const oauthPaths = serverProvidedOauthPaths(connector);

newValues = Object.entries(oauthPaths).reduce(
Expand All @@ -34,7 +33,7 @@ function useFormikOauthAdapter(connector: ConnectorDefinitionSpecification): {
);
} else {
newValues = merge(values, {
connectionConfiguration: { credentials: completeOauthResponse },
connectionConfiguration: completeOauthResponse,
});
}

Expand Down