Updating testConnection usage.
This commit is contained in:
parent
571987a2ce
commit
bd74f8eef7
|
@ -128,12 +128,20 @@ export async function verify(
|
||||||
) {
|
) {
|
||||||
const datasource = ctx.request.body.datasource
|
const datasource = ctx.request.body.datasource
|
||||||
const connector = (await getConnector(datasource)) as IntegrationBase
|
const connector = (await getConnector(datasource)) as IntegrationBase
|
||||||
if (!connector.connection) {
|
if (!connector.testConnection) {
|
||||||
ctx.throw(400, "Connection information verification not supported")
|
ctx.throw(400, "Connection information verification not supported")
|
||||||
}
|
}
|
||||||
const connectionInfo = await connector.connection()
|
const response = await connector.testConnection()
|
||||||
ctx.body = {
|
|
||||||
connected: connectionInfo.connected,
|
if (typeof response === "boolean") {
|
||||||
|
ctx.body = {
|
||||||
|
connected: response,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ctx.body = {
|
||||||
|
connected: false,
|
||||||
|
error: response.error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ export interface VerifyDatasourceRequest {
|
||||||
|
|
||||||
export interface VerifyDatasourceResponse {
|
export interface VerifyDatasourceResponse {
|
||||||
connected: boolean
|
connected: boolean
|
||||||
|
error?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateDatasourceRequest extends Datasource {
|
export interface UpdateDatasourceRequest extends Datasource {
|
||||||
|
|
Loading…
Reference in New Issue