From d7daead7e28d1e9473ed65af9cf64d00e238e5e6 Mon Sep 17 00:00:00 2001 From: himanshudube97 Date: Thu, 31 Oct 2024 18:37:52 +0530 Subject: [PATCH 1/3] changes to mongoconnector done --- src/components/ConfigInput/ConfigInput.tsx | 34 ++++++++++++++++++++++ src/helpers/ConnectorConfigInput.tsx | 6 ++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/components/ConfigInput/ConfigInput.tsx b/src/components/ConfigInput/ConfigInput.tsx index f082bba9..db9f0df9 100644 --- a/src/components/ConfigInput/ConfigInput.tsx +++ b/src/components/ConfigInput/ConfigInput.tsx @@ -76,6 +76,7 @@ export const ConfigInput = ({ specs, control, setFormValue, entity }: ConfigInpu {connectorSpecs ?.sort((input1, input2) => input1.order - input2.order) .map((spec: EntitySpec) => { + console.log(spec, 'PEC'); return spec?.type === 'string' ? ( spec?.airbyte_secret ? ( @@ -121,6 +122,39 @@ export const ConfigInput = ({ specs, control, setFormValue, entity }: ConfigInpu /> + ) : spec?.enum && spec?.enum.length > 0 ? ( + <> + + ( + { + handleObjectFieldOnChange(data, spec.field, field); + }} + renderInput={(params) => ( + + )} + /> + )} + /> + + + ) : ( 1) { value['oneOf']?.forEach((ele: any) => { if (commonField.length > 0) { - commonField = Object.keys(ele?.properties).filter((value: any) => - commonField.includes(value) - ); + commonField = Object.keys(ele?.properties) + .filter((key: any) => 'const' in ele?.properties[key]) + .filter((value: any) => commonField.includes(value)); } else { commonField = Object.keys(ele?.properties); } From 8de06abdde1296dc86f3ec9857499f1894d79f35 Mon Sep 17 00:00:00 2001 From: himanshudube97 Date: Thu, 31 Oct 2024 18:52:58 +0530 Subject: [PATCH 2/3] comments added --- src/components/ConfigInput/ConfigInput.tsx | 2 +- src/helpers/ConnectorConfigInput.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ConfigInput/ConfigInput.tsx b/src/components/ConfigInput/ConfigInput.tsx index db9f0df9..1c5799d8 100644 --- a/src/components/ConfigInput/ConfigInput.tsx +++ b/src/components/ConfigInput/ConfigInput.tsx @@ -76,7 +76,6 @@ export const ConfigInput = ({ specs, control, setFormValue, entity }: ConfigInpu {connectorSpecs ?.sort((input1, input2) => input1.order - input2.order) .map((spec: EntitySpec) => { - console.log(spec, 'PEC'); return spec?.type === 'string' ? ( spec?.airbyte_secret ? ( @@ -123,6 +122,7 @@ export const ConfigInput = ({ specs, control, setFormValue, entity }: ConfigInpu ) : spec?.enum && spec?.enum.length > 0 ? ( + //usually parent object containing enum has type object. but in the case of mongodb connector the type was string. <> { if (commonField.length > 0) { commonField = Object.keys(ele?.properties) - .filter((key: any) => 'const' in ele?.properties[key]) + .filter((key: any) => 'const' in ele?.properties[key]) // mongodb connector case. Only cluster type had const property and was not at the top level but with the other properties that were to be rendered if a cluster type is selected. .filter((value: any) => commonField.includes(value)); } else { commonField = Object.keys(ele?.properties); From 889c1d683434edcd01550ca10b9ef645f81337c3 Mon Sep 17 00:00:00 2001 From: Ishankoradia Date: Sat, 2 Nov 2024 15:11:49 +0530 Subject: [PATCH 3/3] added check for enum rendering of type string --- src/components/ConfigInput/ConfigInput.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ConfigInput/ConfigInput.tsx b/src/components/ConfigInput/ConfigInput.tsx index 1c5799d8..ad155dbb 100644 --- a/src/components/ConfigInput/ConfigInput.tsx +++ b/src/components/ConfigInput/ConfigInput.tsx @@ -121,7 +121,9 @@ export const ConfigInput = ({ specs, control, setFormValue, entity }: ConfigInpu /> - ) : spec?.enum && spec?.enum.length > 0 ? ( + ) : spec?.enum && + spec?.enum.length > 0 && + (spec?.specs == null || spec?.specs === undefined) ? ( //usually parent object containing enum has type object. but in the case of mongodb connector the type was string. <>