diff --git a/packages/builder/src/components/backend/Datasources/ConfigEditor/ConfigInput.svelte b/packages/builder/src/components/backend/Datasources/ConfigEditor/ConfigInput.svelte
index 37fd579594..70f2ffef46 100644
--- a/packages/builder/src/components/backend/Datasources/ConfigEditor/ConfigInput.svelte
+++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/ConfigInput.svelte
@@ -4,11 +4,13 @@
import LongFormField from "./fields/LongForm.svelte"
import FieldGroupField from "./fields/FieldGroup.svelte"
import StringField from "./fields/String.svelte"
+ import SelectField from "./fields/Select.svelte"
export let type
export let value
export let error
export let name
+ export let config
export let showModal = () => {}
const selectComponent = type => {
@@ -20,6 +22,8 @@
return LongFormField
} else if (type === "fieldGroup") {
return FieldGroupField
+ } else if (type === "select") {
+ return SelectField
} else {
return StringField
}
@@ -34,6 +38,7 @@
{value}
{error}
{name}
+ {config}
{showModal}
on:blur
on:change
diff --git a/packages/builder/src/components/backend/Datasources/ConfigEditor/fields/Select.svelte b/packages/builder/src/components/backend/Datasources/ConfigEditor/fields/Select.svelte
new file mode 100644
index 0000000000..3185a6c22c
--- /dev/null
+++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/fields/Select.svelte
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
diff --git a/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte b/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte
index 2cfd3e9ca8..9354ebb787 100644
--- a/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte
+++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/index.svelte
@@ -82,13 +82,14 @@
/>
{/if}
- {#each $configStore.validatedConfig as { type, key, value, error, name, hidden }}
+ {#each $configStore.validatedConfig as { type, key, value, error, name, hidden, config }}
{#if hidden === undefined || !eval(processStringSync(hidden, $configStore.config))}
showModal(newValue => configStore.updateFieldValue(key, newValue))}
on:blur={() => configStore.markFieldActive(key)}
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 cf5d93028e..d7607918df 100644
--- a/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js
+++ b/packages/builder/src/components/backend/Datasources/ConfigEditor/stores/validatedConfig.js
@@ -102,6 +102,7 @@ export const createValidatedConfigStore = (integration, config) => {
name: capitalise(properties.display || key),
type: properties.type,
hidden: properties.hidden,
+ config: properties.config,
})
})
diff --git a/packages/server/src/integrations/microsoftSqlServer.ts b/packages/server/src/integrations/microsoftSqlServer.ts
index 56f78bb932..5b1496a985 100644
--- a/packages/server/src/integrations/microsoftSqlServer.ts
+++ b/packages/server/src/integrations/microsoftSqlServer.ts
@@ -76,6 +76,33 @@ const SCHEMA: Integration = {
type: DatasourceFieldType.BOOLEAN,
default: true,
},
+ authType: {
+ type: DatasourceFieldType.SELECT,
+ config: { options: ["Active Directory"] },
+ },
+ adAuthConfig: {
+ type: DatasourceFieldType.FIELD_GROUP,
+ default: true,
+ display: "Configure Active Directory",
+ hidden: "'{{authType}}' !== 'Active Directory'",
+ fields: {
+ clientId: {
+ type: DatasourceFieldType.STRING,
+ required: false,
+ display: "Client ID",
+ },
+ clientSecret: {
+ type: DatasourceFieldType.STRING,
+ required: false,
+ display: "Client secret",
+ },
+ tenantId: {
+ type: DatasourceFieldType.STRING,
+ required: false,
+ display: "Tenant ID",
+ },
+ },
+ },
},
query: {
create: {
diff --git a/packages/types/src/sdk/datasources.ts b/packages/types/src/sdk/datasources.ts
index 57c534280a..c13c2ca3d5 100644
--- a/packages/types/src/sdk/datasources.ts
+++ b/packages/types/src/sdk/datasources.ts
@@ -36,6 +36,7 @@ export enum DatasourceFieldType {
JSON = "json",
FILE = "file",
FIELD_GROUP = "fieldGroup",
+ SELECT = "select",
}
export enum SourceName {
@@ -103,15 +104,28 @@ export interface ExtraQueryConfig {
}
}
+interface DatasourceBasicFieldConfig {
+ type: DatasourceFieldType
+ display?: string
+ required?: boolean
+ default?: any
+ deprecated?: boolean
+ hidden?: string
+}
+
+interface DatasourceSelectFieldConfig extends DatasourceBasicFieldConfig {
+ type: DatasourceFieldType.SELECT
+ config: { options: string[] }
+}
+
+type DatasourceFieldConfig =
+ | DatasourceBasicFieldConfig
+ | DatasourceSelectFieldConfig
+
export interface DatasourceConfig {
- [key: string]: {
- type: string
- display?: string
- required?: boolean
- default?: any
- deprecated?: boolean
- hidden?: string
- } & { fields?: DatasourceConfig }
+ [key: string]: DatasourceFieldConfig & {
+ fields?: DatasourceConfig
+ }
}
export interface Integration {