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

🪟 🔧 Move the serviceType prop out from Formik form (<ServiceForm/> refactoring part 2) #18168

Merged
merged 38 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
cf2b5b5
add ConnectorFormValues type
dizel852 Oct 19, 2022
92ce4bc
update useTestConnector
dizel852 Oct 19, 2022
2a190d6
update testConnector
dizel852 Oct 19, 2022
8897903
update serviceFormContext
dizel852 Oct 19, 2022
176cef3
useTestConnector - fix import
dizel852 Oct 19, 2022
c4ee73c
remove serviceType from ServiceForm
dizel852 Oct 19, 2022
59bb27d
handle setting the default connector name in ConnectorCard
dizel852 Oct 19, 2022
96439f6
move doc panel handling to ConnectorCard
dizel852 Oct 19, 2022
f1df51f
refactored ConnectorCard
dizel852 Oct 19, 2022
b7d55cf
update the usage of ConnectorCard
dizel852 Oct 19, 2022
2d4fd37
update the ServiceForm tests
dizel852 Oct 19, 2022
3d6fe3d
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Oct 19, 2022
f2a9e92
get rid of the term "service" from ConnectorCard and ConnectorService…
dizel852 Oct 26, 2022
4588f4c
rename ConnectorServiceTypeControl to ConnectorDefinitionTypeControl
dizel852 Oct 26, 2022
1da56c3
Rename "ServiceForm" to "ConnectorForm"
dizel852 Oct 26, 2022
53ce62c
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Oct 27, 2022
e328916
Rename "ServiceForm" to "ConnectorForm" tests
dizel852 Oct 27, 2022
8dc42ac
add issue link
dizel852 Oct 27, 2022
c931344
rename "ConnectorFormValues" to "ConnectorCardValues"
dizel852 Oct 27, 2022
97f9ba7
rename folder "ServiceForm" to "ConnectorForm"
dizel852 Oct 27, 2022
e5b4149
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Oct 27, 2022
da7ac94
rename "serviceFormContext" and it's usages to "connectorFormContext"
dizel852 Oct 27, 2022
8b8647a
rename type "ServiceFormValues" to "ConnectorFormValues"
dizel852 Oct 27, 2022
7a5773d
update connectorFormContext: rename "selectedConnector" to "selectedC…
dizel852 Oct 27, 2022
f70e1de
rename "selectedConnector" and "selectedService" to "selectedConnecto…
dizel852 Oct 27, 2022
73d87ae
leave comments to distinguish blocks of code
dizel852 Oct 27, 2022
0e7c761
reorder props
dizel852 Oct 27, 2022
89e0431
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Oct 28, 2022
3dc4247
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Oct 31, 2022
18f5b37
remove serviceType from useBuildForm startValues
dizel852 Oct 31, 2022
80a3b9d
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 1, 2022
19583a5
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 2, 2022
1c6c803
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 2, 2022
df70625
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 3, 2022
a78c2de
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 7, 2022
11156a9
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 7, 2022
e5dc205
Merge branch 'master' into vlad/18051-remove-servicetype-from-formik-…
dizel852 Nov 7, 2022
88dcb96
fixed broken import after merge
dizel852 Nov 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
4 changes: 2 additions & 2 deletions airbyte-webapp/src/components/GroupControls/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ComponentStory, ComponentMeta } from "@storybook/react";
import { Card } from "components/ui/Card";

import { FormBlock, FormConditionItem } from "core/form/types";
import { GroupLabel } from "views/Connector/ServiceForm/components/Sections/GroupLabel";
import { SectionContainer } from "views/Connector/ServiceForm/components/Sections/SectionContainer";
import { GroupLabel } from "views/Connector/ConnectorForm/components/Sections/GroupLabel";
import { SectionContainer } from "views/Connector/ConnectorForm/components/Sections/SectionContainer";

import GroupControls from "./GroupControls";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { LogsRequestError } from "core/request/LogsRequestError";
import { useGetDestinationDefinitionSpecificationAsync } from "services/connector/DestinationDefinitionSpecificationService";
import { generateMessageFromError, FormError } from "utils/errorStatusMessage";
import { ConnectorCard } from "views/Connector/ConnectorCard";
import { FrequentlyUsedDestinations, StartWithDestination } from "views/Connector/ServiceForm";
import { ConnectorCardValues, FrequentlyUsedDestinations, StartWithDestination } from "views/Connector/ConnectorForm";

import styles from "./DestinationForm.module.scss";

Expand Down Expand Up @@ -54,7 +54,7 @@ export const DestinationForm: React.FC<DestinationFormProps> = ({
setDestinationDefinitionId(destinationDefinitionId);
};

const onSubmitForm = async (values: { name: string; serviceType: string }) => {
const onSubmitForm = async (values: ConnectorCardValues) => {
onSubmit({
...values,
destinationDefinitionId: destinationDefinitionSpecification?.destinationDefinitionId,
Expand All @@ -75,19 +75,18 @@ export const DestinationForm: React.FC<DestinationFormProps> = ({
return (
<>
<ConnectorCard
onServiceSelect={onDropDownSelect}
fetchingConnectorError={destinationDefinitionError instanceof Error ? destinationDefinitionError : null}
onSubmit={onSubmitForm}
formType="destination"
additionalSelectorComponent={frequentlyUsedDestinationsComponent}
availableServices={destinationDefinitions}
selectedConnectorDefinitionSpecification={destinationDefinitionSpecification}
title={<FormattedMessage id="onboarding.destinationSetUp" />}
isLoading={isLoading}
hasSuccess={hasSuccess}
errorMessage={errorMessage}
isLoading={isLoading}
formValues={destinationDefinitionId ? { serviceType: destinationDefinitionId } : undefined}
title={<FormattedMessage id="onboarding.destinationSetUp" />}
fetchingConnectorError={destinationDefinitionError instanceof Error ? destinationDefinitionError : null}
availableConnectorDefinitions={destinationDefinitions}
onConnectorDefinitionSelect={onDropDownSelect}
selectedConnectorDefinitionSpecification={destinationDefinitionSpecification}
onSubmit={onSubmitForm}
jobInfo={LogsRequestError.extractJobInfo(error)}
additionalSelectorComponent={frequentlyUsedDestinationsComponent}
/>
{startWithDestinationComponent}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { FormattedMessage } from "react-intl";

import { DeleteBlock } from "components/common/DeleteBlock";

import { ConnectionConfiguration } from "core/domain/connection";
import { Connector } from "core/domain/connector";
import { DestinationRead, WebBackendConnectionListItem } from "core/request/AirbyteClient";
import { useTrackPage, PageTrackingCodes } from "hooks/services/Analytics";
import { useFormChangeTrackerService, useUniqueFormId } from "hooks/services/FormChangeTracker";
import { useDeleteDestination, useUpdateDestination } from "hooks/services/useDestinationHook";
import { useDestinationDefinition } from "services/connector/DestinationDefinitionService";
import { useGetDestinationDefinitionSpecification } from "services/connector/DestinationDefinitionSpecificationService";
import { ConnectorCard } from "views/Connector/ConnectorCard";
import { ConnectorCardValues } from "views/Connector/ConnectorForm";

import styles from "./DestinationSettings.module.scss";

Expand All @@ -33,11 +32,7 @@ const DestinationsSettings: React.FC<DestinationsSettingsProps> = ({

useTrackPage(PageTrackingCodes.DESTINATION_ITEM_SETTINGS);

const onSubmitForm = async (values: {
name: string;
serviceType: string;
connectionConfiguration?: ConnectionConfiguration;
}) => {
const onSubmitForm = async (values: ConnectorCardValues) => {
await updateDestination({
values,
destinationId: currentDestination.destinationId,
Expand All @@ -55,18 +50,14 @@ const DestinationsSettings: React.FC<DestinationsSettingsProps> = ({
return (
<div className={styles.content}>
<ConnectorCard
formId={formId}
isEditMode
onSubmit={onSubmitForm}
formType="destination"
availableServices={[destinationDefinition]}
formValues={{
...currentDestination,
serviceType: Connector.id(destinationDefinition),
}}
connector={currentDestination}
selectedConnectorDefinitionSpecification={destinationSpecification}
title={<FormattedMessage id="destination.destinationSettings" />}
isEditMode
formId={formId}
availableConnectorDefinitions={[destinationDefinition]}
selectedConnectorDefinitionSpecification={destinationSpecification}
connector={currentDestination}
onSubmit={onSubmitForm}
/>
<DeleteBlock type="destination" onDelete={onDelete} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useGetDestinationDefinitionSpecificationAsync } from "services/connecto
import { generateMessageFromError, FormError } from "utils/errorStatusMessage";
import { ConnectorCard } from "views/Connector/ConnectorCard";
import { useDocumentationPanelContext } from "views/Connector/ConnectorDocumentationLayout/DocumentationPanelContext";
import { ConnectorCardValues } from "views/Connector/ConnectorForm";

interface Props {
onNextStep: () => void;
Expand Down Expand Up @@ -67,7 +68,7 @@ const DestinationStep: React.FC<Props> = ({ onNextStep, onSuccess }) => {
setError(null);
setDestinationDefinitionId(destinationDefinitionId);
};
const onSubmitForm = async (values: { name: string; serviceType: string }) => {
const onSubmitForm = async (values: ConnectorCardValues) => {
await onSubmitDestinationStep({
...values,
destinationDefinitionId: destinationDefinitionSpecification?.destinationDefinitionId,
Expand All @@ -80,14 +81,13 @@ const DestinationStep: React.FC<Props> = ({ onNextStep, onSuccess }) => {
<ConnectorCard
full
formType="destination"
onServiceSelect={onDropDownSelect}
onSubmit={onSubmitForm}
isLoading={isLoading}
hasSuccess={successRequest}
availableServices={destinationDefinitions}
errorMessage={errorMessage}
availableConnectorDefinitions={destinationDefinitions}
onConnectorDefinitionSelect={onDropDownSelect}
selectedConnectorDefinitionSpecification={destinationDefinitionSpecification}
isLoading={isLoading}
formValues={destinationDefinitionId ? { serviceType: destinationDefinitionId } : undefined}
onSubmit={onSubmitForm}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useGetSourceDefinitionSpecificationAsync } from "services/connector/Sou
import { generateMessageFromError, FormError } from "utils/errorStatusMessage";
import { ConnectorCard } from "views/Connector/ConnectorCard";
import { useDocumentationPanelContext } from "views/Connector/ConnectorDocumentationLayout/DocumentationPanelContext";
import { ConnectorCardValues } from "views/Connector/ConnectorForm";

interface SourcesStepProps {
onSuccess: () => void;
Expand Down Expand Up @@ -71,7 +72,7 @@ const SourceStep: React.FC<SourcesStepProps> = ({ onNextStep, onSuccess }) => {
setSourceDefinitionId(sourceId);
};

const onSubmitForm = async (values: { name: string; serviceType: string }) =>
const onSubmitForm = async (values: ConnectorCardValues) =>
onSubmitSourceStep({
...values,
});
Expand All @@ -81,16 +82,15 @@ const SourceStep: React.FC<SourcesStepProps> = ({ onNextStep, onSuccess }) => {
return (
<ConnectorCard
full
jobInfo={LogsRequestError.extractJobInfo(error)}
onServiceSelect={onServiceSelect}
onSubmit={onSubmitForm}
formType="source"
availableServices={sourceDefinitions}
isLoading={isLoading}
hasSuccess={successRequest}
errorMessage={errorMessage}
availableConnectorDefinitions={sourceDefinitions}
onConnectorDefinitionSelect={onServiceSelect}
selectedConnectorDefinitionSpecification={sourceDefinitionSpecification}
isLoading={isLoading}
formValues={sourceDefinitionId ? { serviceType: sourceDefinitionId } : undefined}
onSubmit={onSubmitForm}
jobInfo={LogsRequestError.extractJobInfo(error)}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SourceDefinitionReadWithLatestTag } from "services/connector/SourceDefi
import { useGetSourceDefinitionSpecificationAsync } from "services/connector/SourceDefinitionSpecificationService";
import { generateMessageFromError, FormError } from "utils/errorStatusMessage";
import { ConnectorCard } from "views/Connector/ConnectorCard";
import { ServiceFormValues } from "views/Connector/ServiceForm/types";
import { ConnectorCardValues } from "views/Connector/ConnectorForm/types";

interface SourceFormProps {
onSubmit: (values: {
Expand Down Expand Up @@ -47,7 +47,7 @@ export const SourceForm: React.FC<SourceFormProps> = ({ onSubmit, sourceDefiniti
setSourceDefinitionId(sourceDefinitionId);
};

const onSubmitForm = (values: ServiceFormValues) => {
const onSubmitForm = (values: ConnectorCardValues) => {
onSubmit({
...values,
sourceDefinitionId: sourceDefinitionSpecification?.sourceDefinitionId,
Expand All @@ -58,17 +58,16 @@ export const SourceForm: React.FC<SourceFormProps> = ({ onSubmit, sourceDefiniti

return (
<ConnectorCard
onServiceSelect={onDropDownSelect}
onSubmit={onSubmitForm}
formType="source"
availableServices={sourceDefinitions}
selectedConnectorDefinitionSpecification={sourceDefinitionSpecification}
title={<FormattedMessage id="onboarding.sourceSetUp" />}
isLoading={isLoading}
hasSuccess={hasSuccess}
fetchingConnectorError={sourceDefinitionError instanceof Error ? sourceDefinitionError : null}
errorMessage={errorMessage}
isLoading={isLoading}
formValues={sourceDefinitionId ? { serviceType: sourceDefinitionId, name: "" } : undefined}
title={<FormattedMessage id="onboarding.sourceSetUp" />}
fetchingConnectorError={sourceDefinitionError instanceof Error ? sourceDefinitionError : null}
availableConnectorDefinitions={sourceDefinitions}
onConnectorDefinitionSelect={onDropDownSelect}
selectedConnectorDefinitionSpecification={sourceDefinitionSpecification}
onSubmit={onSubmitForm}
jobInfo={LogsRequestError.extractJobInfo(error)}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,14 @@ const SourceSettings: React.FC<SourceSettingsProps> = ({ currentSource, connecti
return (
<div className={styles.content}>
<ConnectorCard
formId={formId}
formType="source"
title={<FormattedMessage id="sources.sourceSettings" />}
isEditMode
onSubmit={onSubmit}
formType="source"
connector={currentSource}
availableServices={[sourceDefinition]}
formValues={{
...currentSource,
serviceType: currentSource.sourceDefinitionId,
}}
formId={formId}
availableConnectorDefinitions={[sourceDefinition]}
selectedConnectorDefinitionSpecification={sourceDefinitionSpecification}
connector={currentSource}
onSubmit={onSubmit}
/>
<DeleteBlock type="source" onDelete={onDelete} />
</div>
Expand Down
Loading