|
|
@ -5,6 +5,7 @@ import { TestStatus } from '../../../components/test_status/test_status'; |
|
|
|
import { getJdbcDatabaseType } from '../../../app.service'; |
|
|
|
import { getJdbcDatabaseType } from '../../../app.service'; |
|
|
|
import { ApiFactory } from '../../../crud/apiFactory'; |
|
|
|
import { ApiFactory } from '../../../crud/apiFactory'; |
|
|
|
const api = new ApiFactory().create(); |
|
|
|
const api = new ApiFactory().create(); |
|
|
|
|
|
|
|
|
|
|
|
export function testConnection(value: Connection): Promise<string[]> { |
|
|
|
export function testConnection(value: Connection): Promise<string[]> { |
|
|
|
return new Promise(resolve => { |
|
|
|
return new Promise(resolve => { |
|
|
|
let testStatus = null; |
|
|
|
let testStatus = null; |
|
|
@ -15,12 +16,14 @@ export function testConnection(value: Connection): Promise<string[]> { |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const id = BI.UUID(); |
|
|
|
const id = BI.UUID(); |
|
|
|
const testConnection = () => { |
|
|
|
const testConnection = () => { |
|
|
|
const formValue = value; |
|
|
|
const formValue = value; |
|
|
|
|
|
|
|
|
|
|
|
api.testConnection(formValue).then(re => { |
|
|
|
api.testConnection(formValue).then(re => { |
|
|
|
if (re && re.errorCode) { |
|
|
|
if (re && re.errorCode) { |
|
|
|
if(re.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ |
|
|
|
if (re.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED) { |
|
|
|
testStatus.setFail(); |
|
|
|
testStatus.setFail(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -44,7 +47,11 @@ export function testConnection(value: Connection): Promise<string[]> { |
|
|
|
} else if (re.errorCode === errorCode.DUPLICATE_NAMES) { |
|
|
|
} else if (re.errorCode === errorCode.DUPLICATE_NAMES) { |
|
|
|
testStatus.setFail(BI.i18nText(re.errorMsg)); |
|
|
|
testStatus.setFail(BI.i18nText(re.errorMsg)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
// 不缺少驱动,但连接失败,打印出当前驱动加载路径,并显示检测驱动按钮
|
|
|
|
testStatus.setFail(re.errorMsg); |
|
|
|
testStatus.setFail(re.errorMsg); |
|
|
|
|
|
|
|
api.getDriverLoadPath(formValue).then(res => { |
|
|
|
|
|
|
|
testStatus.setExtraContainer(createDriverTestContainer(res.data)); |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (re.data) { |
|
|
|
} else if (re.data) { |
|
|
|
testStatus.setSuccess(); |
|
|
|
testStatus.setSuccess(); |
|
|
@ -59,7 +66,54 @@ export function testConnection(value: Connection): Promise<string[]> { |
|
|
|
BI.Maskers.remove(id); |
|
|
|
BI.Maskers.remove(id); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 驱动及冲突检测内容,补充到报错弹窗里 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function createDriverTestContainer(path: string) { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
type: BI.VerticalLayout.xtype, |
|
|
|
|
|
|
|
vgap: 5, |
|
|
|
|
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: BI.Label.xtype, |
|
|
|
|
|
|
|
text: BI.i18nText('Dec-Connection_Driver_Current_Load_Path', path), |
|
|
|
|
|
|
|
textAlign: 'left', |
|
|
|
|
|
|
|
whiteSpace: 'normal', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: BI.TextButton.xtype, |
|
|
|
|
|
|
|
cls: 'bi-high-light', |
|
|
|
|
|
|
|
text: BI.i18nText('Dec-Connection_Driver_Check'), |
|
|
|
|
|
|
|
textAlign: 'left', |
|
|
|
|
|
|
|
handler: () => { |
|
|
|
|
|
|
|
api.checkDriverStatus({ |
|
|
|
|
|
|
|
driver: (formValue.connectionData as ConnectionJDBC).driver, |
|
|
|
|
|
|
|
path, |
|
|
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
|
|
const isDriverConflict = res.data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testStatus.setExtraContainer({ |
|
|
|
|
|
|
|
type: BI.VerticalLayout.xtype, |
|
|
|
|
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
type: BI.Label.xtype, |
|
|
|
|
|
|
|
textAlign: 'left', |
|
|
|
|
|
|
|
text: isDriverConflict |
|
|
|
|
|
|
|
? BI.i18nText('Dec-Connection_Driver_Has_Confilt_Tip') |
|
|
|
|
|
|
|
: BI.i18nText('Dec-Connection_Driver_No_Confilt_Tip'), |
|
|
|
|
|
|
|
cls: isDriverConflict ? 'bi-error' : '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
BI.Maskers.create(id, null, { |
|
|
|
BI.Maskers.create(id, null, { |
|
|
|
render: { |
|
|
|
render: { |
|
|
|
type: TestStatus.xtype, |
|
|
|
type: TestStatus.xtype, |
|
|
|