Browse Source

Merge pull request #66 in DEC/decision-webui-dcm from ~ALAN/decision-webui-dcm:feature/10.0 to feature/10.0

* commit 'ab258bbc3831f0cb0e2fd01192f6fbc6152cb1da':
  fix: DEC-10009 数据连接名称旁边显示数据连接类型
qufenxi
alan 5 years ago
parent
commit
a8ec9574d7
  1. 15
      src/modules/pages/connection/connection.ts
  2. 15
      src/modules/pages/maintain/maintain.ts

15
src/modules/pages/connection/connection.ts

@ -7,7 +7,8 @@ import { ConnectionJdbcXtype } from './connection_jdbc/connection_jdbc';
import { ConnectionJndiXtype } from './connection_jndi/connection_jndi';
import { ConnectionPluginXtype } from './connection_plugin/connection_plugin';
import { connectionType } from '@constants/env';
import { getAllDatabaseTypes, connectionCanEdit } from '../../app.service';
import { getAllDatabaseTypes, connectionCanEdit, getJdbcDatabaseType } from '../../app.service';
import { ConnectionJDBC } from '../../crud/crud.typings';
export const ConnectionXtype = 'dec.dcm.connection';
@shortcut(ConnectionXtype)
@ -24,7 +25,7 @@ export class Connection extends BI.Widget {
watch = {
connectionSelected:(name: string) => {
const canEdit = connectionCanEdit(this.model.connectionSelectedOne);
this.connectionTitleWidget.setText(`${name}`);
this.connectionTitleWidget.setText(`${name}${this.getSelectConnectionType()}`);
this.connectionEditWidget.setVisible(!!name && canEdit);
if (name) {
const hasRegistered = this.hasRegistered();
@ -184,4 +185,14 @@ export class Connection extends BI.Widget {
return allDatabaseTypes.some(item => item.databaseType === this.model.connectionSelectedOne.connectionType);
}
}
private getSelectConnectionType() {
let databaseType = this.model.connectionSelectedOne.connectionType;
if (databaseType === connectionType.JDBC) {
const connectionJDBC = this.model.connectionSelectedOne.connectionData as ConnectionJDBC;
databaseType = getJdbcDatabaseType(connectionJDBC.database, connectionJDBC.driver).databaseType;
}
return databaseType;
}
}

15
src/modules/pages/maintain/maintain.ts

@ -6,6 +6,9 @@ import { PAGE_INDEX } from '@constants/constant';
import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
import './maintain.less';
import { connectionType } from '@constants/env';
import { getJdbcDatabaseType } from '../../app.service';
import { ConnectionJDBC } from 'src/modules/crud/crud.typings';
export const MaintainXtype = 'dec.dcm.maintain';
@shortcut(MaintainXtype)
@ -17,7 +20,8 @@ export class Maintain extends BI.Widget {
listView: any;
render() {
const { text, isEdit } = this.getEditConnection();
const { text, isEdit, databaseType } = this.getEditConnection();
const titleText = this.model.isCopy ? `${text}-${BI.i18nText('Dec-Dcm_Copy')}` : text;
return {
type: Vtape,
@ -39,7 +43,7 @@ export class Maintain extends BI.Widget {
},
{
type: Label,
text: this.model.isCopy ? `${text}-${BI.i18nText('Dec-Dcm_Copy')}` : text,
text: `${titleText}${databaseType}`,
},
],
height: 40,
@ -78,13 +82,20 @@ export class Maintain extends BI.Widget {
type: this.model.datebaseTypeSelectedOne.type,
text: this.model.datebaseTypeSelectedOne.text,
isEdit: false,
databaseType: this.model.datebaseTypeSelectedOne.databaseType,
};
}
let databaseType = this.model.connectionSelectedOne.connectionType;
if (databaseType === connectionType.JDBC) {
const connectionJDBC = this.model.connectionSelectedOne.connectionData as ConnectionJDBC;
databaseType = getJdbcDatabaseType(connectionJDBC.database, connectionJDBC.driver).databaseType;
}
return {
type: this.model.connectionSelectedOne.connectionType,
text: this.model.connectionSelectedOne.connectionName,
isEdit: true,
databaseType,
};
}
}

Loading…
Cancel
Save