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

Connection Form Refactor - Part Two #16748

Merged
merged 155 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from 144 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
10b4ff1
Work started
krishnaglick Aug 17, 2022
2f0e83f
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 18, 2022
183087a
Minor cleanup
krishnaglick Aug 18, 2022
b3bc5ff
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 18, 2022
85fe161
Some cleanup
krishnaglick Aug 18, 2022
0e063b1
Lots moved into context
krishnaglick Aug 18, 2022
d7ad611
WIP, stepping in the right direction
krishnaglick Aug 18, 2022
468d840
WIP testing
krishnaglick Aug 18, 2022
8834c04
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 23, 2022
b99d1b3
Post-merge fix
krishnaglick Aug 23, 2022
25f28ba
Observables!
krishnaglick Aug 23, 2022
8272377
WIP tests
krishnaglick Aug 24, 2022
e85d301
Tests!
krishnaglick Aug 24, 2022
bf6a647
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 24, 2022
33caf95
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Aug 25, 2022
68a6ad8
CI test
krishnaglick Aug 25, 2022
9bf2c73
CI?
krishnaglick Aug 25, 2022
8af1a41
perhaps
krishnaglick Aug 25, 2022
4ed21ec
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 26, 2022
eb24031
Only show name field during create
krishnaglick Aug 26, 2022
1d4b3a7
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Aug 26, 2022
e41a42f
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 29, 2022
dfcd4cc
Fix Build
krishnaglick Aug 29, 2022
eb54ec2
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Aug 29, 2022
34434d2
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Aug 30, 2022
be4001b
Fix build
krishnaglick Aug 30, 2022
9d95504
Fixing a bug
krishnaglick Aug 31, 2022
b53abb8
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Aug 31, 2022
50bbb3f
Fix failing test
krishnaglick Aug 31, 2022
65584ca
Fixes e2e
krishnaglick Aug 31, 2022
3da331e
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 1, 2022
e841140
Type consolidation
krishnaglick Sep 1, 2022
92b7c0c
useCallback, improvements to connection create onAfter, and removing …
krishnaglick Sep 1, 2022
8c5558b
cleanup
krishnaglick Sep 1, 2022
d390833
Removing an unused prop
krishnaglick Sep 1, 2022
3d094fb
errorStatusMessage and mapFormPropsToOperation tests
krishnaglick Sep 2, 2022
3ec2cf2
useUniqueFormId and useInitialValues tests
krishnaglick Sep 2, 2022
0452458
Cleanup, onFrequencySelect is moved to its use location, better test …
krishnaglick Sep 2, 2022
df444fe
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 2, 2022
aec7b10
Better formSubmit handling for new connection
krishnaglick Sep 2, 2022
6aabc3b
Commenting and some cleanup
krishnaglick Sep 2, 2022
8af9bd2
Comments!
krishnaglick Sep 2, 2022
c9ca5b5
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 2, 2022
f809c68
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 6, 2022
61251a0
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 7, 2022
208cf78
Fixing errors from the merge
krishnaglick Sep 7, 2022
c7f9afa
mock data cleanup
krishnaglick Sep 7, 2022
cc91839
Better TODO
krishnaglick Sep 7, 2022
e89f762
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 7, 2022
96b12a5
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 8, 2022
3395828
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 8, 2022
4c17657
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 12, 2022
498743a
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 13, 2022
ed26655
Merge branch 'master' into kc/connection-form-refactor
krishnaglick Sep 13, 2022
955848c
onFrequencySelect is now always called
krishnaglick Sep 13, 2022
a0beff7
Edmundo CR
krishnaglick Sep 13, 2022
e823d60
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 13, 2022
e2dc6e1
Merge branch 'master' into kc/connection-form-refactor
lmossman Sep 13, 2022
7f4916a
Remove whitespace
krishnaglick Sep 14, 2022
19f051c
Move connection into state so it gets updated
krishnaglick Sep 14, 2022
cc5b939
Consolidate on connection object
krishnaglick Sep 14, 2022
e0a2811
Remove ModalCancel throw + form clearing in create submit function
krishnaglick Sep 14, 2022
30d81f5
Some cleanup
krishnaglick Sep 14, 2022
aa56b25
Fixing error
krishnaglick Sep 14, 2022
cecb46d
Fixing build error
krishnaglick Sep 15, 2022
3f948d8
Rename file
krishnaglick Sep 15, 2022
cec5034
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 15, 2022
5ac6baa
Bridging changes to bring things inline
krishnaglick Sep 15, 2022
4961461
Merge branch 'kc/connection-form-refactor' into kc/connection-form-re…
krishnaglick Sep 15, 2022
184732f
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 16, 2022
50df6de
Builds and tests run
krishnaglick Sep 16, 2022
c9aeb58
Merge branch 'kc/connection-form-refactor' into kc/connection-form-re…
krishnaglick Sep 16, 2022
c375056
replication view almost works as expected
krishnaglick Sep 16, 2022
a45d98a
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 16, 2022
c2c9f96
Merge branch 'kc/connection-form-refactor' into kc/connection-form-re…
krishnaglick Sep 16, 2022
c9c7fec
About to embark on another huge change! Committing here before I brea…
krishnaglick Sep 22, 2022
dfcee9d
slowly, unity
krishnaglick Sep 22, 2022
31d0ccf
Code appears to be working
krishnaglick Sep 22, 2022
793edd0
Merge remote-tracking branch 'origin' into kc/connection-form-refacto…
krishnaglick Sep 23, 2022
20ecdd1
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 23, 2022
e648c16
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 26, 2022
9862aed
Some minor cleanup
krishnaglick Sep 26, 2022
b93ad8e
Form dirty change tracking
krishnaglick Sep 26, 2022
858609a
WIP styling moving and fixing
krishnaglick Sep 26, 2022
efcfcc2
skip refresh on update if status !== active
teallarson Sep 26, 2022
bcc2bdf
Fixing styles
krishnaglick Sep 27, 2022
3d0c43e
Merge branch 'kc/connection-form-refactor-part-two' of github.com:air…
krishnaglick Sep 27, 2022
1f5c04e
Minor
krishnaglick Sep 27, 2022
6fd2098
More cleanup and improvements
krishnaglick Sep 27, 2022
664a14a
Rename CreateConnectionContent -> CreateConnection
krishnaglick Sep 27, 2022
bcfc57b
refreshSchema moved into the connection form service
krishnaglick Sep 27, 2022
33ce0cc
Re-add TODO
krishnaglick Sep 27, 2022
c9baa9a
schemaErrorStatus => schemaError
krishnaglick Sep 27, 2022
cdcb20d
CreateConnectionName -> CreateConnectionNameField
krishnaglick Sep 27, 2022
4203136
Logic for readonly vs edit
krishnaglick Sep 27, 2022
7ac8eb1
Added TODO, fixed a re-initialize issue
krishnaglick Sep 27, 2022
a0a9ff5
Remove unused ConnectionForm component
krishnaglick Sep 27, 2022
f84e214
Improved refresh schema logic
krishnaglick Sep 27, 2022
f05a936
undoing some of the cancel work as it felt like the wrong place to do it
krishnaglick Sep 27, 2022
5b269fb
No longer need to know if the status is updating, that info is availa…
krishnaglick Sep 27, 2022
5c5c3b7
Move close modal & confirmation modal logic to where it's used
krishnaglick Sep 27, 2022
4578ddd
Remove unnecessary useUnmount
krishnaglick Sep 27, 2022
6997f45
Cleanup and removal of unused
krishnaglick Sep 27, 2022
6839074
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 27, 2022
93aaf68
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 28, 2022
5896e66
Somehow missed removing this
krishnaglick Sep 28, 2022
89b6e45
Fixing failing test
krishnaglick Sep 28, 2022
599128d
Added missing initialvalues logic. Added connection form service tests.
krishnaglick Sep 28, 2022
4b02323
Connection Edit tests!
krishnaglick Sep 28, 2022
5b95466
connection replication test pt 1
krishnaglick Sep 29, 2022
621c186
Moving files to make master merge easier
krishnaglick Sep 30, 2022
8a8a084
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Sep 30, 2022
bc31bde
Remove snapshot
krishnaglick Sep 30, 2022
2764a78
non-default export
krishnaglick Sep 30, 2022
a0277af
Remove unused
krishnaglick Sep 30, 2022
d696b0c
Minor improvements
krishnaglick Sep 30, 2022
023b502
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Sep 30, 2022
c2e36eb
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Oct 3, 2022
ab504ca
Edmundo CR.
krishnaglick Oct 3, 2022
4aaa6e3
name now optional for connection editing
krishnaglick Oct 3, 2022
9e70086
Schema refresh errors handled on connection replication view
krishnaglick Oct 3, 2022
aaaeaae
schema refreshing logic, confirm catalog dialog abstraction
krishnaglick Oct 3, 2022
38bb9b6
CreateConnection -> CreateConnectionForm
krishnaglick Oct 3, 2022
f3c3281
form config test cleanup
krishnaglick Oct 3, 2022
6dcbbae
connection replication tab tests
krishnaglick Oct 3, 2022
27f790f
Create Connection Form Tests
krishnaglick Oct 3, 2022
e791029
Better jest mocking!
krishnaglick Oct 3, 2022
4dc6be4
Fixing issue setting schedule type to manual
krishnaglick Oct 4, 2022
4e3b9f7
Tests fixed, and test-utils is better!
krishnaglick Oct 4, 2022
22397e6
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Oct 4, 2022
f80e8e6
Changing back to Once
krishnaglick Oct 4, 2022
ddc1573
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Oct 4, 2022
ca576d4
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Oct 5, 2022
0b33c07
Fixing build from master merge
krishnaglick Oct 5, 2022
f9432bd
Updating snapshots. If these change a lot it may be worth altering th…
krishnaglick Oct 5, 2022
ea58502
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Oct 5, 2022
ca2d9e4
Edmundo & Lake Code Review Comments
krishnaglick Oct 6, 2022
9510f76
Tim CR
krishnaglick Oct 6, 2022
330a151
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Oct 6, 2022
82905e7
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Oct 6, 2022
d1442ba
Fixing a styling issue
krishnaglick Oct 6, 2022
fb8fb88
?? is less clever than I thought
krishnaglick Oct 6, 2022
e95bb38
Form change tracking has been improved to not leave dirty forms aroun…
krishnaglick Oct 6, 2022
562af75
Merge branch 'master' of github.com:airbytehq/airbyte into kc/connect…
krishnaglick Oct 6, 2022
4abbec4
Update airbyte-webapp/src/hooks/services/ConnectionForm/ConnectionFor…
krishnaglick Oct 7, 2022
55e0372
Update airbyte-webapp/src/hooks/services/ConnectionEdit/ConnectionEdi…
krishnaglick Oct 7, 2022
a0c5d9f
Update airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPa…
krishnaglick Oct 7, 2022
07a46df
DRY out tests
krishnaglick Oct 7, 2022
ce49bdf
remove unknowns and fix mocked hook to be patch-style (#17698)
lmossman Oct 7, 2022
9812234
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Oct 7, 2022
5c89063
Self-CR
krishnaglick Oct 7, 2022
c7e760e
idk why this was an issue but whatever
krishnaglick Oct 7, 2022
7d8685f
Merge branch 'master' into kc/connection-form-refactor-part-two
krishnaglick Oct 7, 2022
e25f953
Update airbyte-webapp/src/hooks/services/ConnectionForm/ConnectionFor…
krishnaglick Oct 7, 2022
6443920
Update airbyte-webapp/src/hooks/services/ConnectionEdit/ConnectionEdi…
krishnaglick Oct 7, 2022
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 @@ -3,7 +3,7 @@ import { FormattedMessage } from "react-intl";

import { Modal, ModalProps } from "components/ui/Modal";

import { ConnectionFormMode } from "views/Connection/ConnectionForm/ConnectionForm";
import { ConnectionFormMode } from "hooks/services/ConnectionForm/ConnectionFormService";

import styles from "./ArrayOfObjectsEditor.module.scss";
import { EditorHeader } from "./components/EditorHeader";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from "styled-components";

import { Button } from "components/ui/Button";

import { ConnectionFormMode } from "views/Connection/ConnectionForm/ConnectionForm";
import { ConnectionFormMode } from "hooks/services/ConnectionForm/ConnectionFormService";

const Content = styled.div`
display: flex;
Expand Down

This file was deleted.

112 changes: 0 additions & 112 deletions airbyte-webapp/src/components/CreateConnection/CreateConnection.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use "../../scss/variables";

.connectionFormContainer {
width: 100%;
padding: 0 variables.$spacing-xl;

> form {
display: flex;
flex-direction: column;
gap: variables.$spacing-md;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { act, render, RenderResult } from "@testing-library/react";
import mockConnection from "test-utils/mock-data/mockConnection.json";
import mockDest from "test-utils/mock-data/mockDestinationDefinition.json";
import { TestWrapper } from "test-utils/testutils";

import { AirbyteCatalog } from "core/request/AirbyteClient";
import * as sourceHook from "hooks/services/useSourceHook";

import { CreateConnectionForm } from "./CreateConnectionForm";

jest.mock("services/connector/DestinationDefinitionSpecificationService", () => ({
useGetDestinationDefinitionSpecification: () => mockDest,
}));

jest.mock("services/workspaces/WorkspacesService", () => ({
useCurrentWorkspace: () => ({}),
useCurrentWorkspaceId: () => "workspace-id",
}));

describe("CreateConnectionForm", () => {
const Wrapper: React.FC = ({ children }) => <TestWrapper>{children}</TestWrapper>;

const baseUseDiscoverSchema = {
schemaErrorStatus: null,
isLoading: false,
schema: mockConnection.syncCatalog as AirbyteCatalog,
catalogId: "",
onDiscoverSchema: () => Promise.resolve(),
};

it("should render", async () => {
let renderResult: RenderResult;
jest.spyOn(sourceHook, "useDiscoverSchema").mockImplementationOnce(() => baseUseDiscoverSchema);
await act(async () => {
renderResult = render(
<Wrapper>
<CreateConnectionForm source={mockConnection.source} destination={mockConnection.destination} />
</Wrapper>
);
});
expect(renderResult!.container).toMatchSnapshot();
expect(renderResult!.queryByText("Please wait a little bit more…")).toBeFalsy();
});

it("should render when loading", async () => {
let renderResult: RenderResult;
jest
.spyOn(sourceHook, "useDiscoverSchema")
.mockImplementationOnce(() => ({ ...baseUseDiscoverSchema, isLoading: true }));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the best way to handle needing to change the implementation that I've found.

await act(async () => {
renderResult = render(
<Wrapper>
<CreateConnectionForm source={mockConnection.source} destination={mockConnection.destination} />
</Wrapper>
);
});
expect(renderResult!.container).toMatchSnapshot();
});

it("should render with an error", async () => {
let renderResult: RenderResult;
jest.spyOn(sourceHook, "useDiscoverSchema").mockImplementationOnce(() => ({
...baseUseDiscoverSchema,
schemaErrorStatus: new Error("Test Error") as sourceHook.SchemaError,
}));
await act(async () => {
renderResult = render(
<Wrapper>
<CreateConnectionForm source={mockConnection.source} destination={mockConnection.destination} />
</Wrapper>
);
});
expect(renderResult!.container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import { Form, Formik, FormikHelpers } from "formik";
import React, { Suspense, useCallback, useState } from "react";
import { useNavigate } from "react-router-dom";

import LoadingSchema from "components/LoadingSchema";

import { DestinationRead, SourceRead } from "core/request/AirbyteClient";
import {
ConnectionFormServiceProvider,
tidyConnectionFormValues,
useConnectionFormService,
} from "hooks/services/ConnectionForm/ConnectionFormService";
import { useFormChangeTrackerService } from "hooks/services/FormChangeTracker";
import { useCreateConnection } from "hooks/services/useConnectionHook";
import { SchemaError as SchemaErrorType, useDiscoverSchema } from "hooks/services/useSourceHook";
import { useCurrentWorkspaceId } from "services/workspaces/WorkspacesService";
import CreateControls from "views/Connection/ConnectionForm/components/CreateControls";
import { OperationsSection } from "views/Connection/ConnectionForm/components/OperationsSection";
import { ConnectionFormFields } from "views/Connection/ConnectionForm/ConnectionFormFields";
import { connectionValidationSchema, FormikConnectionFormValues } from "views/Connection/ConnectionForm/formConfig";

import styles from "./CreateConnectionForm.module.scss";
import { CreateConnectionNameField } from "./CreateConnectionNameField";
import { SchemaError } from "./SchemaError";

interface CreateConnectionProps {
source: SourceRead;
destination: DestinationRead;
afterSubmitConnection?: () => void;
}

interface CreateConnectionPropsInner extends Pick<CreateConnectionProps, "afterSubmitConnection"> {
schemaError: SchemaErrorType;
}

const CreateConnectionFormInner: React.FC<CreateConnectionPropsInner> = ({ schemaError, afterSubmitConnection }) => {
const navigate = useNavigate();

const { mutateAsync: createConnection } = useCreateConnection();

const { clearFormChange } = useFormChangeTrackerService();

const workspaceId = useCurrentWorkspaceId();

const { connection, initialValues, mode, formId, getErrorMessage, setSubmitError } = useConnectionFormService();
const [editingTransformation, setEditingTransformation] = useState(false);

const onFormSubmit = useCallback(
async (formValues: FormikConnectionFormValues, formikHelpers: FormikHelpers<FormikConnectionFormValues>) => {
const values = tidyConnectionFormValues(formValues, workspaceId, mode);

try {
const createdConnection = await createConnection({
values,
source: connection.source,
destination: connection.destination,
sourceDefinition: {
sourceDefinitionId: connection.source?.sourceDefinitionId ?? "",
},
destinationDefinition: {
name: connection.destination?.name ?? "",
destinationDefinitionId: connection.destination?.destinationDefinitionId ?? "",
},
sourceCatalogId: connection.catalogId,
});

formikHelpers.resetForm();
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, why was this call added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is carried over from previous iterations of the create connection's submit function. It might not be necessary but I've never removed it to check.

// We need to clear the form changes otherwise the dirty form intercept service will prevent navigation
clearFormChange(formId);

if (afterSubmitConnection) {
afterSubmitConnection();
} else {
navigate(`../../connections/${createdConnection.connectionId}`);
}
} catch (e) {
setSubmitError(e);
}
},
[
workspaceId,
mode,
createConnection,
connection.source,
connection.destination,
connection.catalogId,
clearFormChange,
formId,
afterSubmitConnection,
navigate,
setSubmitError,
]
);

if (schemaError) {
return <SchemaError schemaError={schemaError} />;
}

return (
<Suspense fallback={<LoadingSchema />}>
<div className={styles.connectionFormContainer}>
<Formik
initialValues={initialValues}
validationSchema={connectionValidationSchema(mode)}
onSubmit={onFormSubmit}
>
{({ values, isSubmitting, isValid, dirty }) => (
<Form>
<CreateConnectionNameField />
<ConnectionFormFields values={values} isSubmitting={isSubmitting} dirty={dirty} />
<OperationsSection
onStartEditTransformation={() => setEditingTransformation(true)}
onEndEditTransformation={() => setEditingTransformation(false)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed toggle.

Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prone to errors in this use case

/>
<CreateControls
isSubmitting={isSubmitting}
isValid={isValid && !editingTransformation}
errorMessage={getErrorMessage(isValid, dirty)}
/>
</Form>
)}
</Formik>
</div>
</Suspense>
);
};

export const CreateConnectionForm: React.FC<CreateConnectionProps> = ({
source,
destination,
afterSubmitConnection,
}) => {
const { schema, isLoading, schemaErrorStatus, catalogId, onDiscoverSchema } = useDiscoverSchema(
source.sourceId,
true
);

const partialConnection = {
syncCatalog: schema,
destination,
source,
catalogId,
};

return (
<ConnectionFormServiceProvider
connection={partialConnection}
mode="create"
refreshSchema={onDiscoverSchema}
schemaError={schemaErrorStatus}
>
{isLoading ? (
<LoadingSchema />
) : (
<CreateConnectionFormInner afterSubmitConnection={afterSubmitConnection} schemaError={schemaErrorStatus} />
)}
</ConnectionFormServiceProvider>
);
};
Loading