|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
import {ModelType} from '@ui/index'; |
|
|
|
|
import {LinkType} from '@ui/type'; |
|
|
|
|
import {deleteConnection, getConnectionStatus} from '@shared/crud/crud.request'; |
|
|
|
|
import {deleteConnection, testConnection} from '@shared/crud/crud.request'; |
|
|
|
|
import {databaseTyle, getCnnectionName} from './select/select.service'; |
|
|
|
|
import {confirm} from '@shared/service/dialog.service'; |
|
|
|
|
import dialog from '@shared/service/dialog.service'; |
|
|
|
|
import {saveConnection} from './link-set.service'; |
|
|
|
|
|
|
|
|
|
const className = 'fr.model.linkset'; |
|
|
|
@ -15,7 +15,7 @@ const Model: ModelType = {
|
|
|
|
|
*/ |
|
|
|
|
setLinkSelected(name: string) { |
|
|
|
|
if (this.model.linkSelected && this.model.linkSelected.isSelected) { |
|
|
|
|
confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
dialog.confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
if (isConfirm) { |
|
|
|
|
saveConnection(this.model.linkUpdate).then(() => { |
|
|
|
|
this.setEdit(false); |
|
|
|
@ -50,9 +50,7 @@ const Model: ModelType = {
|
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
case '测试连接': |
|
|
|
|
getConnectionStatus(id, (res: any) => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
this._textLink(id); |
|
|
|
|
break; |
|
|
|
|
case '复制': |
|
|
|
|
this.copyLink(id); |
|
|
|
@ -61,6 +59,20 @@ const Model: ModelType = {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
_textLink(id: string) { |
|
|
|
|
const loadingId = dialog.loading('正在测试连接,请稍候...'); |
|
|
|
|
const link = this.model.linkList.find((item: LinkType) => item.connectionId === id); |
|
|
|
|
testConnection(link, (res: any) => { |
|
|
|
|
dialog.close(loadingId); |
|
|
|
|
if (res && res.errorCode) { |
|
|
|
|
dialog.linkFail(`${link.connectionName}测试连接失败`, res.errorMsg, () => { |
|
|
|
|
this._textLink(id); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
dialog.success('连接成功'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
copyLink(id: string) { |
|
|
|
|
const name = getCnnectionName(this.model.linkList); |
|
|
|
|
let data = {}; |
|
|
|
@ -121,7 +133,7 @@ const Model: ModelType = {
|
|
|
|
|
}, |
|
|
|
|
setNewLink(value: string) { |
|
|
|
|
if (this.model.linkSelected && this.model.linkSelected.isSelected) { |
|
|
|
|
confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
dialog.confirm('当前设置尚未保存,是否保存?', (isConfirm: boolean) => { |
|
|
|
|
if (isConfirm) { |
|
|
|
|
saveConnection(this.model.linkUpdate).then(() => { |
|
|
|
|
this.setEdit(true); |
|
|
|
|