Browse Source

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

* commit '18de753080aa56345fecf9d6360e8a2d2497839f':
  fix: KERNEL-1212 更新数据连接时同时更新database
qufenxi
alan 5 years ago
parent
commit
f4d9fd70cc
  1. 2
      src/modules/app.service.ts
  2. 6
      src/modules/pages/maintain/forms/form.ts

2
src/modules/app.service.ts

@ -45,7 +45,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT
export function resolveUrlInfo (url: string) { export function resolveUrlInfo (url: string) {
if (BI.isNull(url)) return {}; if (BI.isNull(url)) return {};
const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9]+))?(:|\/|;DatabaseName=)([0-9a-zA-Z_\\.]+)(.*)/i); const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([0-9a-zA-Z_\\.]+)(.*)/i);
if (result) { if (result) {
return { return {
host: result[5], host: result[5],

6
src/modules/pages/maintain/forms/form.ts

@ -7,6 +7,7 @@ import { connectionType } from '@constants/env';
import { ConnectionJDBC, Connection } from 'src/modules/crud/crud.typings'; import { ConnectionJDBC, Connection } from 'src/modules/crud/crud.typings';
import { TestStatusXtype, EVENT_RELOAD, EVENT_CLOSE } from 'src/modules/components/test_status/test_status'; import { TestStatusXtype, EVENT_RELOAD, EVENT_CLOSE } from 'src/modules/components/test_status/test_status';
import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL } from '@constants/constant'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL } from '@constants/constant';
import { getJdbcDatabaseType } from 'src/modules/app.service';
export const MaintainFormXtype = 'dec.dcm.maintain.form'; export const MaintainFormXtype = 'dec.dcm.maintain.form';
@shortcut(MaintainFormXtype) @shortcut(MaintainFormXtype)
@ -164,8 +165,11 @@ export class MaintainForm extends BI.Widget {
} }
this.isEdit = true; this.isEdit = true;
this.connectionName = this.model.connectionSelectedOne.connectionName; this.connectionName = this.model.connectionSelectedOne.connectionName;
const connection = BI.clone(this.model.connectionSelectedOne);
const { database, driver } = connection.connectionData as ConnectionJDBC;
(connection.connectionData as ConnectionJDBC).database = getJdbcDatabaseType(database, driver).databaseType;
return this.model.connectionSelectedOne; return connection;
} }
private getJndiConnection():Connection { private getJndiConnection():Connection {

Loading…
Cancel
Save