1
0
Fork 0
mirror of synced 2024-07-01 20:41:03 +12:00

Allow hiding config

This commit is contained in:
Adria Navarro 2023-06-28 11:42:49 +01:00
parent 8a7d610faf
commit 534b4fffb4
3 changed files with 17 additions and 12 deletions

View file

@ -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 }}
<ConfigInput
{type}
{value}
{error}
{name}
showModal={() =>
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))}
<ConfigInput
{type}
{value}
{error}
{name}
showModal={() =>
showModal(newValue => configStore.updateFieldValue(key, newValue))}
on:blur={() => configStore.markFieldActive(key)}
on:change={e => configStore.updateFieldValue(key, e.detail)}
/>
{/if}
{/each}
</ModalContent>

View file

@ -101,6 +101,7 @@ export const createValidatedConfigStore = (integration, config) => {
error: $errorsStore[key],
name: capitalise(properties.display || key),
type: properties.type,
hidden: properties.hidden,
})
})

View file

@ -110,7 +110,8 @@ export interface DatasourceConfig {
required?: boolean
default?: any
deprecated?: boolean
}
hidden?: string
} & { fields?: DatasourceConfig }
}
export interface Integration {