diff --git a/airbyte-webapp/src/components/connectorBuilder/Builder/GlobalConfigView.tsx b/airbyte-webapp/src/components/connectorBuilder/Builder/GlobalConfigView.tsx
index 433d2d2e5296..bc8e29a532a5 100644
--- a/airbyte-webapp/src/components/connectorBuilder/Builder/GlobalConfigView.tsx
+++ b/airbyte-webapp/src/components/connectorBuilder/Builder/GlobalConfigView.tsx
@@ -1,5 +1,6 @@
import { useIntl } from "react-intl";
+import { AuthenticationSection } from "./AuthenticationSection";
import { BuilderCard } from "./BuilderCard";
import { BuilderConfigView } from "./BuilderConfigView";
import { BuilderField } from "./BuilderField";
@@ -16,6 +17,7 @@ export const GlobalConfigView: React.FC = () => {
+
);
};
diff --git a/airbyte-webapp/src/components/connectorBuilder/Builder/InputsView.tsx b/airbyte-webapp/src/components/connectorBuilder/Builder/InputsView.tsx
index 0f6a46449748..a934422b60f6 100644
--- a/airbyte-webapp/src/components/connectorBuilder/Builder/InputsView.tsx
+++ b/airbyte-webapp/src/components/connectorBuilder/Builder/InputsView.tsx
@@ -7,7 +7,6 @@ import { FormattedMessage, useIntl } from "react-intl";
import { useEffectOnce } from "react-use";
import * as yup from "yup";
-import Label from "components/Label";
import { Button } from "components/ui/Button";
import { Card } from "components/ui/Card";
import { InfoBox } from "components/ui/InfoBox";
@@ -16,7 +15,7 @@ import { Text } from "components/ui/Text";
import { FormikPatch } from "core/form/FormikPatch";
-import { BuilderFormInput } from "../types";
+import { BuilderFormInput, BuilderFormValues, getInferredInputs } from "../types";
import { BuilderConfigView } from "./BuilderConfigView";
import { BuilderField } from "./BuilderField";
import styles from "./InputsView.module.scss";
@@ -30,6 +29,7 @@ interface InputInEditing {
isNew?: boolean;
showDefaultValueField: boolean;
type: typeof supportedTypes[number];
+ isInferredInputOverride: boolean;
}
function sluggify(str: string) {
@@ -44,10 +44,14 @@ function newInputInEditing(): InputInEditing {
isNew: true,
showDefaultValueField: false,
type: "string",
+ isInferredInputOverride: false,
};
}
-function formInputToInputInEditing({ key, definition, required }: BuilderFormInput): InputInEditing {
+function formInputToInputInEditing(
+ { key, definition, required }: BuilderFormInput,
+ isInferredInputOverride: boolean
+): InputInEditing {
const supportedType = supportedTypes.find((type) => type === definition.type) || "unknown";
return {
key,
@@ -56,6 +60,7 @@ function formInputToInputInEditing({ key, definition, required }: BuilderFormInp
isNew: false,
showDefaultValueField: Boolean(definition.default),
type: supportedType !== "unknown" && definition.enum ? "enum" : supportedType,
+ isInferredInputOverride,
};
}
@@ -79,9 +84,14 @@ function inputInEditingToFormInput({
export const InputsView: React.FC = () => {
const { formatMessage } = useIntl();
+ const { values, setFieldValue } = useFormikContext
();
const [inputs, , helpers] = useField("inputs");
const [inputInEditing, setInputInEditing] = useState(undefined);
- const usedKeys = useMemo(() => inputs.value.map((input) => input.key), [inputs.value]);
+ const inferredInputs = useMemo(() => getInferredInputs(values), [values]);
+ const usedKeys = useMemo(
+ () => [...inputs.value, ...inferredInputs].map((input) => input.key),
+ [inputs.value, inferredInputs]
+ );
const inputInEditValidation = useMemo(
() =>
yup.object().shape({
@@ -99,29 +109,20 @@ export const InputsView: React.FC = () => {
}),
[inputInEditing?.isNew, inputInEditing?.key, usedKeys]
);
+
return (
- {inputs.value.length > 0 && (
+ {(inputs.value.length > 0 || inferredInputs.length > 0) && (
+ {inferredInputs.map((input) => (
+
+ ))}
{inputs.value.map((input) => (
- -
-
-
-
+
))}
@@ -142,12 +143,16 @@ export const InputsView: React.FC = () => {
initialValues={inputInEditing}
validationSchema={inputInEditValidation}
onSubmit={(values: InputInEditing) => {
- const newInput = inputInEditingToFormInput(values);
- helpers.setValue(
- inputInEditing.isNew
- ? [...inputs.value, newInput]
- : inputs.value.map((input) => (input.key === inputInEditing.key ? newInput : input))
- );
+ if (values.isInferredInputOverride) {
+ setFieldValue(`inferredInputOverrides.${values.key}`, values.definition);
+ } else {
+ const newInput = inputInEditingToFormInput(values);
+ helpers.setValue(
+ inputInEditing.isNew
+ ? [...inputs.value, newInput]
+ : inputs.value.map((input) => (input.key === inputInEditing.key ? newInput : input))
+ );
+ }
setInputInEditing(undefined);
}}
>
@@ -179,7 +184,9 @@ const InputModal = ({
onDelete: () => void;
onClose: () => void;
}) => {
+ const isInferredInputOverride = inputInEditing.isInferredInputOverride;
const { isValid, values, setFieldValue, setTouched } = useFormikContext();
+
const { formatMessage } = useIntl();
useEffectOnce(() => {
// key input is always touched so errors are shown right away as it will be auto-set by the user changing the title
@@ -202,7 +209,9 @@ const InputModal = ({
path="definition.title"
type="string"
onChange={(newValue) => {
- setFieldValue("key", sluggify(newValue || ""), true);
+ if (!isInferredInputOverride) {
+ setFieldValue("key", sluggify(newValue || ""), true);
+ }
}}
label={formatMessage({ id: "connectorBuilder.inputModal.inputName" })}
tooltip={formatMessage({ id: "connectorBuilder.inputModal.inputNameTooltip" })}
@@ -226,7 +235,7 @@ const InputModal = ({
label={formatMessage({ id: "connectorBuilder.inputModal.description" })}
tooltip={formatMessage({ id: "connectorBuilder.inputModal.descriptionTooltip" })}
/>
- {values.type !== "unknown" ? (
+ {values.type !== "unknown" && !isInferredInputOverride ? (
<>
) : (
-
+ {isInferredInputOverride ? (
+
+ ) : (
+
+ )}
)}
- {!inputInEditing.isNew && (
+ {!inputInEditing.isNew && !inputInEditing.isInferredInputOverride && (