diff --git a/airbyte-webapp/src/packages/cloud/components/experiments/SignupSourceDropdown/SignupSourceDropdown.tsx b/airbyte-webapp/src/packages/cloud/components/experiments/SignupSourceDropdown/SignupSourceDropdown.tsx index 90c936a99c357..ad366f986303d 100644 --- a/airbyte-webapp/src/packages/cloud/components/experiments/SignupSourceDropdown/SignupSourceDropdown.tsx +++ b/airbyte-webapp/src/packages/cloud/components/experiments/SignupSourceDropdown/SignupSourceDropdown.tsx @@ -20,10 +20,10 @@ import { Text } from "components/ui/Text"; import { ReleaseStage } from "core/request/AirbyteClient"; import { useModalService } from "hooks/services/Modal"; +import styles from "views/Connector/ConnectorForm/components/Controls/ConnectorServiceTypeControl/ConnectorServiceTypeControl.module.scss"; +import { useAnalyticsTrackFunctions } from "views/Connector/ConnectorForm/components/Controls/ConnectorServiceTypeControl/useAnalyticsTrackFunctions"; +import { WarningMessage } from "views/Connector/ConnectorForm/components/WarningMessage"; import RequestConnectorModal from "views/Connector/RequestConnectorModal"; -import styles from "views/Connector/ServiceForm/components/Controls/ConnectorServiceTypeControl/ConnectorServiceTypeControl.module.scss"; -import { useAnalyticsTrackFunctions } from "views/Connector/ServiceForm/components/Controls/ConnectorServiceTypeControl/useAnalyticsTrackFunctions"; -import { WarningMessage } from "views/Connector/ServiceForm/components/WarningMessage"; import { useGetSourceDefinitions } from "./useGetSourceDefinitions"; import { getSortedDropdownData } from "./utils"; diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/ConnectorForm.test.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/ConnectorForm.test.tsx index 9a06dba5d6a53..f7e02885c854f 100644 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/ConnectorForm.test.tsx +++ b/airbyte-webapp/src/views/Connector/ConnectorForm/ConnectorForm.test.tsx @@ -377,7 +377,7 @@ describe("Service Form", () => { }); describe("conditionally render form submit button", () => { - const renderServiceForm = (props: ConnectorFormProps) => + const renderConnectorForm = (props: ConnectorFormProps) => render(); // eslint-disable-next-line @typescript-eslint/no-empty-function const onSubmitClb = () => {}; @@ -388,7 +388,7 @@ describe("Service Form", () => { }; it("should render if connector is selected", async () => { - const { getByText } = await renderServiceForm({ + const { getByText } = await renderConnectorForm({ selectedConnectorDefinitionSpecification: // @ts-expect-error Partial objects for testing connectorDefSpec as DestinationDefinitionSpecificationRead, @@ -399,7 +399,7 @@ describe("Service Form", () => { }); it("should not render if connector is not selected", async () => { - const { container } = await renderServiceForm({ + const { container } = await renderConnectorForm({ selectedConnectorDefinitionSpecification: undefined, formType: "destination", onSubmit: onSubmitClb, @@ -411,7 +411,7 @@ describe("Service Form", () => { }); it("should render if connector is selected", async () => { - const { getByText } = await renderServiceForm({ + const { getByText } = await renderConnectorForm({ selectedConnectorDefinitionSpecification: // @ts-expect-error Partial objects for testing connectorDefSpec as DestinationDefinitionSpecificationRead, @@ -424,7 +424,7 @@ describe("Service Form", () => { }); it("should render if connector is not selected", async () => { - const { container } = await renderServiceForm({ + const { container } = await renderConnectorForm({ selectedConnectorDefinitionSpecification: undefined, formType: "destination", onSubmit: onSubmitClb, diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/FormRoot.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/FormRoot.tsx index a66b4d5fd872d..7666021c7493b 100644 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/FormRoot.tsx +++ b/airbyte-webapp/src/views/Connector/ConnectorForm/FormRoot.tsx @@ -38,7 +38,7 @@ export const FormRoot: React.FC = ({ selectedConnector, }) => { const { dirty, isSubmitting, isValid } = useFormikContext(); - const { resetServiceForm, isLoadingSchema, selectedService, isEditMode, formType } = useConnectorForm(); + const { resetConnectorForm, isLoadingSchema, selectedService, isEditMode, formType } = useConnectorForm(); return (
@@ -63,7 +63,7 @@ export const FormRoot: React.FC = ({ isValid={isValid} dirty={dirty} onCancelClick={() => { - resetServiceForm(); + resetConnectorForm(); }} successMessage={successMessage} /> diff --git a/airbyte-webapp/src/views/Connector/ConnectorForm/connectorFormContext.tsx b/airbyte-webapp/src/views/Connector/ConnectorForm/connectorFormContext.tsx index 13a43a4a6341e..e45171aba555a 100644 --- a/airbyte-webapp/src/views/Connector/ConnectorForm/connectorFormContext.tsx +++ b/airbyte-webapp/src/views/Connector/ConnectorForm/connectorFormContext.tsx @@ -15,7 +15,7 @@ interface ConnectorFormContext { unfinishedFlows: Record; addUnfinishedFlow: (key: string, info?: Record) => void; removeUnfinishedFlow: (key: string) => void; - resetServiceForm: () => void; + resetConnectorForm: () => void; selectedService?: ConnectorDefinition; selectedConnector?: ConnectorDefinitionSpecification; isLoadingSchema?: boolean; @@ -26,11 +26,11 @@ interface ConnectorFormContext { const connectorFormContext = React.createContext(null); export const useConnectorForm = (): ConnectorFormContext => { - const serviceFormHelpers = useContext(connectorFormContext); - if (!serviceFormHelpers) { - throw new Error("useServiceForm should be used within ServiceFormContextProvider"); + const connectorFormHelpers = useContext(connectorFormContext); + if (!connectorFormHelpers) { + throw new Error("useConnectorForm should be used within ConnectorFormContextProvider"); } - return serviceFormHelpers; + return connectorFormHelpers; }; interface ConnectorFormContextProviderProps { @@ -84,7 +84,7 @@ export const ConnectorFormContextProvider: React.FC key !== path)) ), - resetServiceForm: () => { + resetConnectorForm: () => { resetForm(); resetUiWidgetsInfo(); },