From 601a855f13e9f43978560935a08b4c8082d11793 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Mon, 26 Jun 2023 14:27:09 +0100 Subject: [PATCH] filter out REST fields --- .../ConfigEditor/stores/validatedConfig.js | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js b/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js index 8e97154322..dc2eab303b 100644 --- a/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js +++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js @@ -71,34 +71,38 @@ export const createValidatedConfigStore = (integration, config) => { const combined = derived( [configStore, errorsStore, selectedValidatorsStore], ([$configStore, $errorsStore, $selectedValidatorsStore]) => { - const validatedConfig = Object.entries(integration.datasource).map( - ([key, properties]) => { - const getValue = () => { - if (properties.type === "fieldGroup") { - return Object.entries(properties.fields).map( - ([fieldKey, fieldProperties]) => { - return { - key: fieldKey, - name: capitalise(fieldProperties.display || fieldKey), - type: fieldProperties.type, - value: $configStore[fieldKey], - } - } - ) - } + const validatedConfig = [] - return $configStore[key] - } - - return { - key, - value: getValue(), - error: $errorsStore[key], - name: capitalise(properties.display || key), - type: properties.type, - } + Object.entries(integration.datasource).forEach(([key, properties]) => { + if (integration.name === "REST" && key !== "rejectUnauthorized") { + return } - ) + + const getValue = () => { + if (properties.type === "fieldGroup") { + return Object.entries(properties.fields).map( + ([fieldKey, fieldProperties]) => { + return { + key: fieldKey, + name: capitalise(fieldProperties.display || fieldKey), + type: fieldProperties.type, + value: $configStore[fieldKey], + } + } + ) + } + + return $configStore[key] + } + + validatedConfig.push({ + key, + value: getValue(), + error: $errorsStore[key], + name: capitalise(properties.display || key), + type: properties.type, + }) + }) const allFieldsActive = Object.keys($selectedValidatorsStore).length ===