|
|
|
@ -50,19 +50,28 @@ export class ListItemModel extends Model<{
|
|
|
|
|
setDatebaseTypeSelected(name: string) { |
|
|
|
|
this.model.datebaseTypeSelected = name; |
|
|
|
|
}, |
|
|
|
|
setIsEdit(isEdit: boolean) { |
|
|
|
|
this.model.isEdit = isEdit; |
|
|
|
|
setIsEdit(isEdit: boolean, name: string) { |
|
|
|
|
if (isEdit) { |
|
|
|
|
api.getConnectionStatus(name).then(re => { |
|
|
|
|
if (re.data && re.data === 'success') { |
|
|
|
|
this.model.isEdit = true; |
|
|
|
|
} else { |
|
|
|
|
BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_Is_Using', re.errorMsg), { |
|
|
|
|
level: 'error', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
api.shutdownConnectionStatus(name); |
|
|
|
|
this.model.isEdit = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
changeName(oldName: string, newName: string) { |
|
|
|
|
const connections = this.model.connections.map(item => { |
|
|
|
|
return { |
|
|
|
|
...item, |
|
|
|
|
connectionName: item.connectionName === oldName ? newName : item.connectionName, |
|
|
|
|
connectionId: oldName, |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
const connection = this.model.connections.find(item => item.connectionName === oldName); |
|
|
|
|
connection.connectionId = oldName; |
|
|
|
|
connection.connectionName = newName; |
|
|
|
|
|
|
|
|
|
return api.updateConnection(connections); |
|
|
|
|
return api.updateConnection(connection); |
|
|
|
|
}, |
|
|
|
|
setIsCopy(isCopy: boolean) { |
|
|
|
|
this.model.isCopy = isCopy; |
|
|
|
|