|
|
@ -50,19 +50,28 @@ export class ListItemModel extends Model<{ |
|
|
|
setDatebaseTypeSelected(name: string) { |
|
|
|
setDatebaseTypeSelected(name: string) { |
|
|
|
this.model.datebaseTypeSelected = name; |
|
|
|
this.model.datebaseTypeSelected = name; |
|
|
|
}, |
|
|
|
}, |
|
|
|
setIsEdit(isEdit: boolean) { |
|
|
|
setIsEdit(isEdit: boolean, name: string) { |
|
|
|
this.model.isEdit = isEdit; |
|
|
|
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) { |
|
|
|
changeName(oldName: string, newName: string) { |
|
|
|
const connections = this.model.connections.map(item => { |
|
|
|
const connection = this.model.connections.find(item => item.connectionName === oldName); |
|
|
|
return { |
|
|
|
connection.connectionId = oldName; |
|
|
|
...item, |
|
|
|
connection.connectionName = newName; |
|
|
|
connectionName: item.connectionName === oldName ? newName : item.connectionName, |
|
|
|
|
|
|
|
connectionId: oldName, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return api.updateConnection(connections); |
|
|
|
return api.updateConnection(connection); |
|
|
|
}, |
|
|
|
}, |
|
|
|
setIsCopy(isCopy: boolean) { |
|
|
|
setIsCopy(isCopy: boolean) { |
|
|
|
this.model.isCopy = isCopy; |
|
|
|
this.model.isCopy = isCopy; |
|
|
|