Submit nested
This commit is contained in:
parent
a95a5f1cb2
commit
47d6113fee
|
@ -46,6 +46,19 @@ export const createValidatedConfigStore = (integration, config) => {
|
||||||
value.forEach(field => {
|
value.forEach(field => {
|
||||||
newStore[field.key] = field.value
|
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 {
|
} else {
|
||||||
newStore[key] = value
|
newStore[key] = value
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,11 @@ interface MSSQLConfig {
|
||||||
schema: string
|
schema: string
|
||||||
encrypt?: boolean
|
encrypt?: boolean
|
||||||
authType?: MSSQLConfigAuthType
|
authType?: MSSQLConfigAuthType
|
||||||
adConfig_clientId: string
|
adConfig?: {
|
||||||
adConfig_clientSecret: string
|
clientId: string
|
||||||
adConfig_tenantId: string
|
clientSecret: string
|
||||||
|
tenantId: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SCHEMA: Integration = {
|
const SCHEMA: Integration = {
|
||||||
|
@ -95,7 +97,7 @@ const SCHEMA: Integration = {
|
||||||
default: true,
|
default: true,
|
||||||
display: "Configure Active Directory",
|
display: "Configure Active Directory",
|
||||||
hidden: "'{{authType}}' !== 'Active Directory'",
|
hidden: "'{{authType}}' !== 'Active Directory'",
|
||||||
config: { openByDefault: true },
|
config: { openByDefault: true, nestedFields: true },
|
||||||
fields: {
|
fields: {
|
||||||
clientId: {
|
clientId: {
|
||||||
type: DatasourceFieldType.STRING,
|
type: DatasourceFieldType.STRING,
|
||||||
|
@ -161,7 +163,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
|
||||||
await this.connect()
|
await this.connect()
|
||||||
response.connected = true
|
response.connected = true
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
response.error = e.message as string
|
response.error = e.message
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
@ -187,11 +189,12 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
|
||||||
delete clientCfg.encrypt
|
delete clientCfg.encrypt
|
||||||
|
|
||||||
if (this.config.authType === MSSQLConfigAuthType.ACTIVE_DIRECTORY) {
|
if (this.config.authType === MSSQLConfigAuthType.ACTIVE_DIRECTORY) {
|
||||||
|
const { clientId, tenantId, clientSecret } = this.config.adConfig!
|
||||||
const clientApp = new ConfidentialClientApplication({
|
const clientApp = new ConfidentialClientApplication({
|
||||||
auth: {
|
auth: {
|
||||||
clientId: this.config.adConfig_clientId,
|
clientId,
|
||||||
authority: `https://login.microsoftonline.com/${this.config.adConfig_tenantId}`,
|
authority: `https://login.microsoftonline.com/${tenantId}`,
|
||||||
clientSecret: this.config.adConfig_clientSecret,
|
clientSecret,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ interface DatasourceSelectFieldConfig extends DatasourceBasicFieldConfig {
|
||||||
|
|
||||||
interface DatasourceFieldGroupConfig extends DatasourceBasicFieldConfig {
|
interface DatasourceFieldGroupConfig extends DatasourceBasicFieldConfig {
|
||||||
type: DatasourceFieldType.FIELD_GROUP
|
type: DatasourceFieldType.FIELD_GROUP
|
||||||
config: { openByDefault?: boolean }
|
config: { openByDefault?: boolean; nestedFields?: boolean }
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatasourceFieldConfig =
|
type DatasourceFieldConfig =
|
||||||
|
|
Loading…
Reference in New Issue