Skip to content

🪟 🐛 Fix broken UI build on master #19078

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

Merged
merged 3 commits into from
Nov 7, 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 @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ describe("Service Form", () => {
});

describe("conditionally render form submit button", () => {
const renderServiceForm = (props: ConnectorFormProps) =>
const renderConnectorForm = (props: ConnectorFormProps) =>
render(<ConnectorForm {...props} formValues={{ name: "test-name" }} />);
// eslint-disable-next-line @typescript-eslint/no-empty-function
const onSubmitClb = () => {};
Expand All @@ -388,7 +388,7 @@ describe("Service Form", () => {
};

it("should render <CreateControls /> if connector is selected", async () => {
const { getByText } = await renderServiceForm({
const { getByText } = await renderConnectorForm({
selectedConnectorDefinitionSpecification:
// @ts-expect-error Partial objects for testing
connectorDefSpec as DestinationDefinitionSpecificationRead,
Expand All @@ -399,7 +399,7 @@ describe("Service Form", () => {
});

it("should not render <CreateControls /> if connector is not selected", async () => {
const { container } = await renderServiceForm({
const { container } = await renderConnectorForm({
selectedConnectorDefinitionSpecification: undefined,
formType: "destination",
onSubmit: onSubmitClb,
Expand All @@ -411,7 +411,7 @@ describe("Service Form", () => {
});

it("should render <EditControls /> if connector is selected", async () => {
const { getByText } = await renderServiceForm({
const { getByText } = await renderConnectorForm({
selectedConnectorDefinitionSpecification:
// @ts-expect-error Partial objects for testing
connectorDefSpec as DestinationDefinitionSpecificationRead,
Expand All @@ -424,7 +424,7 @@ describe("Service Form", () => {
});

it("should render <EditControls /> if connector is not selected", async () => {
const { container } = await renderServiceForm({
const { container } = await renderConnectorForm({
selectedConnectorDefinitionSpecification: undefined,
formType: "destination",
onSubmit: onSubmitClb,
Expand Down
4 changes: 2 additions & 2 deletions airbyte-webapp/src/views/Connector/ConnectorForm/FormRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const FormRoot: React.FC<FormRootProps> = ({
selectedConnector,
}) => {
const { dirty, isSubmitting, isValid } = useFormikContext<ConnectorFormValues>();
const { resetServiceForm, isLoadingSchema, selectedService, isEditMode, formType } = useConnectorForm();
const { resetConnectorForm, isLoadingSchema, selectedService, isEditMode, formType } = useConnectorForm();

return (
<Form>
Expand All @@ -63,7 +63,7 @@ export const FormRoot: React.FC<FormRootProps> = ({
isValid={isValid}
dirty={dirty}
onCancelClick={() => {
resetServiceForm();
resetConnectorForm();
}}
successMessage={successMessage}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ConnectorFormContext {
unfinishedFlows: Record<string, { startValue: string; id: number | string }>;
addUnfinishedFlow: (key: string, info?: Record<string, unknown>) => void;
removeUnfinishedFlow: (key: string) => void;
resetServiceForm: () => void;
resetConnectorForm: () => void;
selectedService?: ConnectorDefinition;
selectedConnector?: ConnectorDefinitionSpecification;
isLoadingSchema?: boolean;
Expand All @@ -26,11 +26,11 @@ interface ConnectorFormContext {
const connectorFormContext = React.createContext<ConnectorFormContext | null>(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 {
Expand Down Expand Up @@ -84,7 +84,7 @@ export const ConnectorFormContextProvider: React.FC<React.PropsWithChildren<Conn
"_common.unfinishedFlows",
Object.fromEntries(Object.entries(unfinishedFlows).filter(([key]) => key !== path))
),
resetServiceForm: () => {
resetConnectorForm: () => {
resetForm();
resetUiWidgetsInfo();
},
Expand Down