1
0
Fork 0
mirror of synced 2024-09-30 17:18:14 +13:00

Submit nested

This commit is contained in:
Adria Navarro 2023-06-28 14:18:38 +01:00
parent a95a5f1cb2
commit 47d6113fee
3 changed files with 25 additions and 9 deletions

View file

@ -46,6 +46,19 @@ export const createValidatedConfigStore = (integration, config) => {
value.forEach(field => {
newStore[field.key] = field.value
})
if (!integration.datasource[key].config?.nestedFields) {
value.forEach(field => {
newStore[field.key] = field.value
})
} else {
newStore[key] = value.reduce(
(p, field) => ({
...p,
[field.key]: field.value,
}),
{}
)
}
} else {
newStore[key] = value
}

View file

@ -38,9 +38,11 @@ interface MSSQLConfig {
schema: string
encrypt?: boolean
authType?: MSSQLConfigAuthType
adConfig_clientId: string
adConfig_clientSecret: string
adConfig_tenantId: string
adConfig?: {
clientId: string
clientSecret: string
tenantId: string
}
}
const SCHEMA: Integration = {
@ -95,7 +97,7 @@ const SCHEMA: Integration = {
default: true,
display: "Configure Active Directory",
hidden: "'{{authType}}' !== 'Active Directory'",
config: { openByDefault: true },
config: { openByDefault: true, nestedFields: true },
fields: {
clientId: {
type: DatasourceFieldType.STRING,
@ -161,7 +163,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
await this.connect()
response.connected = true
} catch (e: any) {
response.error = e.message as string
response.error = e.message
}
return response
}
@ -187,11 +189,12 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
delete clientCfg.encrypt
if (this.config.authType === MSSQLConfigAuthType.ACTIVE_DIRECTORY) {
const { clientId, tenantId, clientSecret } = this.config.adConfig!
const clientApp = new ConfidentialClientApplication({
auth: {
clientId: this.config.adConfig_clientId,
authority: `https://login.microsoftonline.com/${this.config.adConfig_tenantId}`,
clientSecret: this.config.adConfig_clientSecret,
clientId,
authority: `https://login.microsoftonline.com/${tenantId}`,
clientSecret,
},
})

View file

@ -120,7 +120,7 @@ interface DatasourceSelectFieldConfig extends DatasourceBasicFieldConfig {
interface DatasourceFieldGroupConfig extends DatasourceBasicFieldConfig {
type: DatasourceFieldType.FIELD_GROUP
config: { openByDefault?: boolean }
config: { openByDefault?: boolean; nestedFields?: boolean }
}
type DatasourceFieldConfig =