Browse Source

Pull request #8582: REPORT-110986 feat: 数据连接支持跳转至详情&联动

Merge in DEC/decision-webui-dcm from ~AUSTIN.DUAN/decision-webui-dcm:feature/x to feature/x

* commit '42d94b994834a079b2e291d085d07c9661cd2a40':
  REPORT-110986 feat: 数据连接支持跳转至详情&联动
feature/x
Austin.Duan-段嗣跃 11 months ago committed by drew-倪梦威
parent
commit
9c9e2c0dc4
  1. 19
      src/modules/pages/connection/list/list.model.ts

19
src/modules/pages/connection/list/list.model.ts

@ -1,10 +1,11 @@
import { model, Model } from '@core/core';
import { ApiFactory } from '../../..//crud/apiFactory';
import { AppModel } from '../../../app.model';
import type { ConnectionJDBC } from '../../../crud/crud.typings';
const api = new ApiFactory().create();
@model()
export class ConnectionListModel extends Model<{
types : {
types: {
connections: AppModel['TYPE']['connections'];
connectionSelected: AppModel['TYPE']['connectionSelected'];
},
@ -19,15 +20,25 @@ export class ConnectionListModel extends Model<{
}
actions = {
setConnections: ():Promise<void> => api.getConnectionList().then(data => {
setConnections: (): Promise<void> => api.getConnectionList().then(data => {
data.data.push(...BI.Constants.getConstant('dec.constant.connection.list'));
if (BI.size(data.data) > 0) {
this.model.connections = data.data;
let defaultDatabaseName,
defaultDatabaseId = BI.Services.getService("dec.service.global")
.getHashSearchParams("databaseId");
this.model.connections.forEach(item => {
// 后端传过来的是字符串,转为对象
// 后端传过来的是字符串,转为对象
BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string));
// 目前只有jdbc存在identity,后期拓展
if ((item.connectionData as ConnectionJDBC).identity === defaultDatabaseId) {
defaultDatabaseName = item.connectionName;
}
});
this.model.connectionSelected = data.data[0].connectionName;
this.model.connectionSelected = defaultDatabaseName ?? data.data[0].connectionName;
} else {
this.model.connectionSelected = '';
}

Loading…
Cancel
Save