|
|
|
@ -46,15 +46,7 @@ export class MaintainForm extends BI.Widget {
|
|
|
|
|
form.connectionId = this.connectionName; |
|
|
|
|
// DEC-10155 为了适配插件的数据连接,在外层也加一个creator字段
|
|
|
|
|
form.creator = Dec ? Dec.personal.username : ''; |
|
|
|
|
this.store.addConnection(form).then(result => { |
|
|
|
|
if (result.errorCode) { |
|
|
|
|
this.showError(result); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.store.goFirstPage(); |
|
|
|
|
this.store.setIsCopy(false); |
|
|
|
|
}); |
|
|
|
|
this.addConnection(form); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
testEvent: () => { |
|
|
|
@ -252,4 +244,32 @@ export class MaintainForm extends BI.Widget {
|
|
|
|
|
this.form.setSchemas(re); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private addConnection(form: Connection) { |
|
|
|
|
this.store.addConnection(form).then(result => { |
|
|
|
|
if (result.errorCode) { |
|
|
|
|
if (result.errorCode === errorCode.DUPLICATE_NAMES) { |
|
|
|
|
if (form.connectionType !== connectionType.JDBC && form.connectionType !== connectionType.JNDI) { |
|
|
|
|
// 如果不是jdbc或jndi,即如果是插件,名称重复的时候需要修改名字重新提交给后台
|
|
|
|
|
const newName = `${form.connectionName}${Math.floor(Math.random() * 10)}`; |
|
|
|
|
form.connectionName = newName; |
|
|
|
|
if (!this.model.isCopy) { |
|
|
|
|
form.connectionId = newName; |
|
|
|
|
} |
|
|
|
|
this.addConnection(form); |
|
|
|
|
} else { |
|
|
|
|
this.setFromError(result.errorMsg); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
BI.Msg.toast(BI.i18nText(result.errorMsg), { |
|
|
|
|
level: 'error', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.store.goFirstPage(); |
|
|
|
|
this.store.setIsCopy(false); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|