From 18de753080aa56345fecf9d6360e8a2d2497839f Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 4 Sep 2019 10:00:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20KERNEL-1212=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=97=B6=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0database?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 2 +- src/modules/pages/maintain/forms/form.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 4f508b8..d919bf7 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -45,7 +45,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT export function resolveUrlInfo (url: string) { 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) { return { host: result[5], diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 43b42b2..ab14cb5 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/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 { TestStatusXtype, EVENT_RELOAD, EVENT_CLOSE } from 'src/modules/components/test_status/test_status'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL } from '@constants/constant'; +import { getJdbcDatabaseType } from 'src/modules/app.service'; export const MaintainFormXtype = 'dec.dcm.maintain.form'; @shortcut(MaintainFormXtype) @@ -164,8 +165,11 @@ export class MaintainForm extends BI.Widget { } this.isEdit = true; 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 {