diff --git a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/TransformationView.tsx b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/TransformationView.tsx index ee638c22a019..10c81cad1d8d 100644 --- a/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/TransformationView.tsx +++ b/airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/TransformationView.tsx @@ -1,6 +1,7 @@ import { Field, FieldArray } from "formik"; import React, { useMemo } from "react"; import { FormattedMessage } from "react-intl"; +import { useToggle } from "react-use"; import styled from "styled-components"; import { ContentCard, H4 } from "components"; @@ -55,6 +56,7 @@ const CustomTransformationsCard: React.FC<{ mode: ConnectionFormMode; }> = ({ operations, onSubmit, mode }) => { const defaultTransformation = useDefaultTransformation(); + const [editingTransformation, toggleEditingTransformation] = useToggle(false); const initialValues = useMemo( () => ({ @@ -73,11 +75,18 @@ const CustomTransformationsCard: React.FC<{ enableReinitialize: true, onSubmit, }} + submitDisabled={editingTransformation} mode={mode} > {(formProps) => ( - + )} diff --git a/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx b/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx index 0ff9e6545f5d..c8366c3d3dc9 100644 --- a/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx +++ b/airbyte-webapp/src/views/Connection/ConnectionForm/components/EditControls.tsx @@ -4,15 +4,16 @@ import styled from "styled-components"; import { Button, LoadingButton } from "components"; -type IProps = { +interface EditControlProps { isSubmitting: boolean; dirty: boolean; + submitDisabled?: boolean; resetForm: () => void; successMessage?: React.ReactNode; errorMessage?: React.ReactNode; editSchemeMode?: boolean; withLine?: boolean; -}; +} const Warning = styled.div` margin-bottom: 10px; @@ -49,9 +50,10 @@ const Line = styled.div` margin: 16px -27px 0 -24px; `; -const EditControls: React.FC = ({ +const EditControls: React.FC = ({ isSubmitting, dirty, + submitDisabled, resetForm, successMessage, errorMessage, @@ -79,18 +81,13 @@ const EditControls: React.FC = ({ {showStatusMessage()} - + {editSchemeMode ? ( diff --git a/airbyte-webapp/src/views/Connection/FormCard.tsx b/airbyte-webapp/src/views/Connection/FormCard.tsx index 2cab6d8f45d6..ec18e057c23f 100644 --- a/airbyte-webapp/src/views/Connection/FormCard.tsx +++ b/airbyte-webapp/src/views/Connection/FormCard.tsx @@ -20,6 +20,7 @@ interface FormCardProps extends CollapsibleCardProps { bottomSeparator?: boolean; form: FormikConfig; mode?: ConnectionFormMode; + submitDisabled?: boolean; } export function FormCard({ @@ -27,6 +28,7 @@ export function FormCard({ form, bottomSeparator = true, mode, + submitDisabled, ...props }: React.PropsWithChildren>) { const { formatMessage } = useIntl(); @@ -54,6 +56,7 @@ export function FormCard({ withLine={bottomSeparator} isSubmitting={isSubmitting} dirty={dirty} + submitDisabled={!isValid || submitDisabled} resetForm={() => { resetForm(); reset();