From 534b4fffb48d1508daf9120088d0b4d705dce54d Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 28 Jun 2023 11:42:49 +0100 Subject: [PATCH] Allow hiding config --- .../Datasources/ConfigEditor/index.svelte | 25 +++++++++++-------- .../ConfigEditor/stores/validatedConfig.js | 1 + packages/types/src/sdk/datasources.ts | 3 ++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte b/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte index fc24266959..2cfd3e9ca8 100644 --- a/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte +++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte @@ -6,6 +6,7 @@ Layout, ModalContent, } from "@budibase/bbui" + import { processStringSync } from "@budibase/string-templates" import CreateEditVariableModal from "components/portal/environment/CreateEditVariableModal.svelte" import ConfigInput from "./ConfigInput.svelte" import { createValidatedConfigStore } from "./stores/validatedConfig" @@ -81,17 +82,19 @@ /> {/if} - {#each $configStore.validatedConfig as { type, key, value, error, name }} - - showModal(newValue => configStore.updateFieldValue(key, newValue))} - on:blur={() => configStore.markFieldActive(key)} - on:change={e => configStore.updateFieldValue(key, e.detail)} - /> + {#each $configStore.validatedConfig as { type, key, value, error, name, hidden }} + {#if hidden === undefined || !eval(processStringSync(hidden, $configStore.config))} + + showModal(newValue => configStore.updateFieldValue(key, newValue))} + on:blur={() => configStore.markFieldActive(key)} + on:change={e => configStore.updateFieldValue(key, e.detail)} + /> + {/if} {/each} 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 dc2eab303b..cf5d93028e 100644 --- a/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js +++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js @@ -101,6 +101,7 @@ export const createValidatedConfigStore = (integration, config) => { error: $errorsStore[key], name: capitalise(properties.display || key), type: properties.type, + hidden: properties.hidden, }) }) diff --git a/packages/types/src/sdk/datasources.ts b/packages/types/src/sdk/datasources.ts index f3001a971d..57c534280a 100644 --- a/packages/types/src/sdk/datasources.ts +++ b/packages/types/src/sdk/datasources.ts @@ -110,7 +110,8 @@ export interface DatasourceConfig { required?: boolean default?: any deprecated?: boolean - } + hidden?: string + } & { fields?: DatasourceConfig } } export interface Integration {