diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 58537d7..60736d3 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -6,6 +6,9 @@ import { hasRegistered } from '../list.service'; import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service'; import { testConnection } from '../../../maintain/forms/form.server'; import { DownListCombo, Label, SignEditor } from '@fui/core'; +import { ApiFactory } from '../../../../crud/apiFactory'; + +const api = new ApiFactory().create(); @shortcut() @store(ListItemModel) @@ -206,8 +209,17 @@ export class ListItem extends BI.BasicButton { } private testConnectionAction() { - const { name } = this.options; - testConnection(this.model.connections.find(item => item.connectionName === name)); + // 接口返回的内容是对称加密的,前端要先解密再用新加密传回去 + const connection = this.model.connections + .find(item => item.connectionName === this.options.name); + + if (BI.isNull(connection)) return; + + const validationQuery = connection?.connectionData?.connectionPoolAttr?.validationQuery || ''; + + BI.set(connection, 'connectionData.connectionPoolAttr.validationQuery', api.getCipher(api.getPlain(validationQuery))); + + testConnection(connection); } private itemActionCalculate() {