From 454e3c026ed18cf319900ce8ce75d7e76aaf3963 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 18 Nov 2019 10:08:10 +0800 Subject: [PATCH 01/25] =?UTF-8?q?fix:=20DEC-10992=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=90=8D=E5=8C=85=E5=90=AB=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E7=AC=A6=E5=8F=B7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 16 +++++++++++++++- src/modules/app.service.ts | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index 5b8cf72..07ded52 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -1,11 +1,25 @@ -import { connectionCanEdit } from '../app.service'; +import { connectionCanEdit, resolveUrlInfo } from '../app.service'; const connection = { connectionId: '', connectionType: '', connectionName: '', connectionData: '', }; +/** + * test_author_alan + */ +test('DEC-10992 数据连接名称带-', () => { + expect(resolveUrlInfo('jdbc:sqlserver://192.168.17.111:1433;databaseName=L-Pick-DAS-MengYan')).toEqual({ + host: '192.168.17.111', + port: '1433', + databaseName: 'L-Pick-DAS-MengYan', + urlInfo: '', + }); +}); +/** + * test_author_alan + */ test('BI-51537 判断数据连接是否有权限', () => { expect(connectionCanEdit({ ...connection, diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index a7fe9be..c51f1d9 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -47,7 +47,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|port]+))?(:|\/|;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=)([^]+)(.*)/i); if (result) { return { host: result[5], From 9b3e74d13a4895307f8a8e15a4ebbff432d750f8 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 19 Nov 2019 14:31:04 +0800 Subject: [PATCH 02/25] =?UTF-8?q?fix:=20DEC-11030=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=A9=B1=E5=8A=A8=E6=97=B6=E8=A7=A3=E6=9E=90?= =?UTF-8?q?url=E7=9A=84=E9=97=AE=E9=A2=98=E5=B9=B6=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 31 ++++++++++++++++++- src/modules/app.service.ts | 14 +++++++-- src/modules/constants/constant.ts | 4 +-- .../maintain/forms/components/form.jdbc.ts | 19 ++++++------ 4 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index 07ded52..27d080c 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -1,10 +1,18 @@ -import { connectionCanEdit, resolveUrlInfo } from '../app.service'; +import { connectionCanEdit, resolveUrlInfo, splitUrl } from '../app.service'; const connection = { connectionId: '', connectionType: '', connectionName: '', connectionData: '', }; + +/** + * test_author_alan + */ +test('DEC-11030', () => { + expect(splitUrl('localhost', '22', 'dbname', 'jdbc:pivotal:greenplum://hostname:port;dbname')).toEqual('jdbc:pivotal:greenplum://localhost:22;dbname'); +}); + /** * test_author_alan */ @@ -17,6 +25,27 @@ test('DEC-10992 数据连接名称带-', () => { }); }); +test('解析url', () => { + expect(resolveUrlInfo('jdbc:postgresql://endpoint:port/database')).toEqual({ + host: 'endpoint', + port: '', + databaseName: 'database', + urlInfo: '', + }); + expect(resolveUrlInfo('jdbc:pivotal:greenplum://hostname:port;dbname')).toEqual({ + host: 'hostname', + port: '', + databaseName: 'dbname', + urlInfo: '', + }); + expect(resolveUrlInfo('jdbc:mysql://hostname:22/database')).toEqual({ + host: 'hostname', + port: '22', + databaseName: 'database', + urlInfo: '', + }); +}); + /** * test_author_alan */ diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index c51f1d9..bcc6268 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -47,7 +47,16 @@ 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|port]+))?(:|\/|;DatabaseName=)([^]+)(.*)/i); + const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;)([^]+)(.*)/i); + if (greenplumUrl) { + return { + host: greenplumUrl[4], + port: greenplumUrl[6] === 'port' ? '' : greenplumUrl[6], + databaseName: greenplumUrl[8], + urlInfo: greenplumUrl[9], + }; + } + const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^]+)(.*)/i); if (result) { return { host: result[5], @@ -87,7 +96,8 @@ export function splitUrl(host: string, port: string, database: string, baseUrl: } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') - .replace('database', database); + .replace('database', database) + .replace('dbname', database); } export function connectionCanEdit(connection: Connection) { diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 863c4f7..f63fb59 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -446,8 +446,8 @@ export const DATA_BASE_TYPES = [ hasSchema: false, kerberos: false, urls: { - 'com.mysql.jdbc.Driver': 'jdbc:mysql://localhost/dbname', - 'org.gjt.mm.mysql.Driver': 'jdbc:mysql://localhost/dbname', + 'com.mysql.jdbc.Driver': 'jdbc:mysql://hostname:port/database', + 'org.gjt.mm.mysql.Driver': 'jdbc:mysql://hostname:port/database', }, }, { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 637e1bd..a39b3c1 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -98,13 +98,12 @@ export class FormJdbc extends BI.Widget { const value = this.form.driver.getValue(); const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - if (connectionType.urls) { - this.form.url.setValue(connectionType.urls[value]); - const urlInfo = resolveUrlInfo(connectionType.urls[value]); - this.form.host.setValue(urlInfo.host); - this.form.database.setValue(urlInfo.databaseName); - this.form.port.setValue(urlInfo.port); - } + const url = connectionType.urls ? connectionType.urls[value] : connectionType.url; + this.form.url.setValue(url); + const urlInfo = resolveUrlInfo(url); + this.form.host.setValue(urlInfo.host); + this.form.database.setValue(urlInfo.databaseName); + this.form.port.setValue(urlInfo.port); }, }], }], @@ -692,11 +691,13 @@ export class FormJdbc extends BI.Widget { } private onHostPortChange(databaseType) { - const { url = '' } = databaseType; + const { urls, url } = databaseType; + const driver = this.form.driver.getValue(); + const selectUrl = BI.get(urls, driver) || url; const host = this.form.host.getValue(); const port = this.form.port.getValue(); const database = this.form.database.getValue(); - this.form.url.setValue(splitUrl(host, port, database, url)); + this.form.url.setValue(splitUrl(host, port, database, selectUrl)); } public setSchemas(schemas: string[]) { From fe1e00b2f8af9731ab6646a17b4ed008abf61e9b Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 19 Nov 2019 15:00:41 +0800 Subject: [PATCH 03/25] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index 27d080c..5cea84c 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -9,7 +9,7 @@ const connection = { /** * test_author_alan */ -test('DEC-11030', () => { +test('DEC-11030 拼接url', () => { expect(splitUrl('localhost', '22', 'dbname', 'jdbc:pivotal:greenplum://hostname:port;dbname')).toEqual('jdbc:pivotal:greenplum://localhost:22;dbname'); }); From abcd508dae26934ed5ddf0ec4224b66d315eb111 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 29 Nov 2019 09:45:17 +0800 Subject: [PATCH 04/25] =?UTF-8?q?fix:=20DEC-11216=20jdbc=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E7=A9=BA=E9=97=B2=E5=80=BC=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index f63fb59..d2d22a6 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -667,6 +667,7 @@ export const DEFAULT_JDBC_POOL = { initialSize: 0, maxActive: 50, maxIdle: 10, + minIdle: 0, maxWait: 10000, testOnBorrow: true, testOnReturn: false, From d6f3834748c8b0d79524ccd9fae665a4b600d13b Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 29 Nov 2019 15:26:22 +0800 Subject: [PATCH 05/25] =?UTF-8?q?fix:=20DEC-11219=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index a39b3c1..7badcea 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -374,6 +374,7 @@ export class FormJdbc extends BI.Widget { }, { type: CollapseXtype, + bgap: -15, width: 70, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), listeners: [ @@ -396,6 +397,7 @@ export class FormJdbc extends BI.Widget { items: [ { type: FormItemXtype, + tgap: 15, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), forms: [{ type: TextCheckerXtype, From 3bfa7d6464a2f8fd90c5e26925d2bb821f1b5e9d Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 2 Dec 2019 10:26:24 +0800 Subject: [PATCH 06/25] =?UTF-8?q?fix:=20BI-56355=20=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B1=BB=E5=9E=8B=E5=92=8C=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E9=83=BD=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=88=99=E8=AE=A4?= =?UTF-8?q?=E4=B8=BA=E6=98=AF=E5=85=B6=E4=BB=96jdbc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 10 +++++++++- src/modules/app.service.ts | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index 5cea84c..a1c15e8 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -1,4 +1,4 @@ -import { connectionCanEdit, resolveUrlInfo, splitUrl } from '../app.service'; +import { connectionCanEdit, resolveUrlInfo, splitUrl, getJdbcDatabaseType } from '../app.service'; const connection = { connectionId: '', connectionType: '', @@ -12,6 +12,14 @@ const connection = { test('DEC-11030 拼接url', () => { expect(splitUrl('localhost', '22', 'dbname', 'jdbc:pivotal:greenplum://hostname:port;dbname')).toEqual('jdbc:pivotal:greenplum://localhost:22;dbname'); }); +/** + * test_author_alan + */ +test('BI-56355 如果驱动和URL均为空,则为其他jdbc', () => { + expect(getJdbcDatabaseType('', '').databaseType).toEqual('otherJDBC'); + expect(getJdbcDatabaseType('mysql', '').databaseType).toEqual('mysql'); + expect(getJdbcDatabaseType('', 'com.mysql.jdbc.Driver').databaseType).toEqual('mysql'); +}); /** * test_author_alan diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index bcc6268..31e6ff8 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -27,6 +27,9 @@ export function getPluginWidgetEdit(plugin: string) { // 由于database可能为空,所以为了兼容平台和设计器,需要根据driver来判断数据库类型 export function getJdbcDatabaseType(database: string, driver: string): DatabaseType { + if (!database && !driver) { + return DATA_BASE_TYPES_OTHER; + } let databaseType = null; // KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driber来判断数据类型 // DEC-10872 不能过滤other,因为新版数据连接创建的其他jdbc也是other类型,会混淆,需要和后端讨论一个最佳的解决方案。 @@ -56,7 +59,7 @@ export function resolveUrlInfo (url: string) { urlInfo: greenplumUrl[9], }; } - const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^]+)(.*)/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|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^\\?]+)(.*)/i); if (result) { return { host: result[5], From e4289b5c6aeb83f2930122e7ab0f5c45ee0631f2 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 2 Dec 2019 10:28:16 +0800 Subject: [PATCH 07/25] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 2 +- src/modules/app.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index a1c15e8..9ea92be 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -15,7 +15,7 @@ test('DEC-11030 拼接url', () => { /** * test_author_alan */ -test('BI-56355 如果驱动和URL均为空,则为其他jdbc', () => { +test('BI-56355 如果数据库类型和驱动都为空,则为其他jdbc', () => { expect(getJdbcDatabaseType('', '').databaseType).toEqual('otherJDBC'); expect(getJdbcDatabaseType('mysql', '').databaseType).toEqual('mysql'); expect(getJdbcDatabaseType('', 'com.mysql.jdbc.Driver').databaseType).toEqual('mysql'); diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 31e6ff8..706a0ab 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -59,7 +59,7 @@ export function resolveUrlInfo (url: string) { urlInfo: greenplumUrl[9], }; } - const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^\\?]+)(.*)/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|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^]+)(.*)/i); if (result) { return { host: result[5], From eb68523149d233f30fe9b747a43bcb964f0910d2 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 2 Dec 2019 10:29:25 +0800 Subject: [PATCH 08/25] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 706a0ab..fc18f77 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -32,7 +32,6 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT } let databaseType = null; // KERNEL-1655 兼容旧版 由于旧版设计器创建的数据连接database都为other,所以要根据driber来判断数据类型 - // DEC-10872 不能过滤other,因为新版数据连接创建的其他jdbc也是other类型,会混淆,需要和后端讨论一个最佳的解决方案。 if (database && database !== 'other' && DATA_BASE_TYPES.some(item => item.databaseType === database)) { databaseType = DATA_BASE_TYPES.find(item => item.databaseType === database); } else { From fd569b70e2d5039ccaeee3eba8b9e302100b4b21 Mon Sep 17 00:00:00 2001 From: congqiu Date: Tue, 31 Dec 2019 15:50:54 +0800 Subject: [PATCH 09/25] =?UTF-8?q?DEC-11528=20feat:=20ADS=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=94=B9=E4=B8=BA=E9=98=BF=E9=87=8C=E4=BA=91AnalyticD?= =?UTF-8?q?B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/i18n.ts | 1 + src/modules/constants/constant.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/private/i18n.ts b/private/i18n.ts index 77be638..20f08e7 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -300,4 +300,5 @@ export default { 'BI-Basic_Quarter': '季度', 'BI-Basic_No_Select': '不选', 'BI-Basic_Now': '此刻', + 'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB', }; diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index d2d22a6..445b57d 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -197,7 +197,7 @@ export const DESIGN_DRIVER_TYPE = [ ]; export const DATA_BASE_TYPES = [ { - text: 'ADS', + text: BI.i18nText('Dec-Dcm_Connection_Analytic_DB'), databaseType: 'ads', driver: 'com.mysql.jdbc.Driver', url: 'jdbc:mysql://hostname:port/database', From 2a13073f925216a96e8bf0e032737631119807e6 Mon Sep 17 00:00:00 2001 From: congqiu Date: Tue, 31 Dec 2019 16:09:05 +0800 Subject: [PATCH 10/25] =?UTF-8?q?fix:=20=E5=8A=A0=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 4154eed..7c92a95 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -300,4 +300,5 @@ BI-Basic_Million= 百万 BI-Basic_Billion= 亿 BI-Basic_Quarter= 季度 BI-Basic_No_Select= 不选 -BI-Basic_Now= 此刻 \ No newline at end of file +BI-Basic_Now= 此刻 +Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB \ No newline at end of file From 598a7520c6a8eca11182ecbe6c85d5fdb8b5059e Mon Sep 17 00:00:00 2001 From: alan Date: Thu, 2 Jan 2020 17:30:48 +0800 Subject: [PATCH 11/25] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 15 +++++++++++++++ src/modules/app.service.ts | 16 +++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index 9ea92be..e61efc5 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -52,6 +52,21 @@ test('解析url', () => { databaseName: 'database', urlInfo: '', }); + expect(resolveUrlInfo('jdbc:sqlserver://hostname:port;databaseName=database')).toEqual({ + host: 'hostname', + port: '', + databaseName: 'database', + urlInfo: '', + }); +}); + +test('数据库可能为空', () => { + expect(resolveUrlInfo('jdbc:mysql://secure.finedevelop.com:62306/')).toEqual({ + host: 'secure.finedevelop.com', + port: '62306', + databaseName: '', + urlInfo: '', + }); }); /** diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index fc18f77..c193cbe 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -49,7 +49,17 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT export function resolveUrlInfo (url: string) { if (BI.isNull(url)) return {}; - const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;)([^]+)(.*)/i); + const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:)([^]+)(.*)/i); + if (oracleUlr) { + return { + host: oracleUlr[5], + port: oracleUlr[7] === 'port' ? '' : oracleUlr[7], + databaseName: oracleUlr[9], + urlInfo: oracleUlr[10], + }; + } + + const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;)([^]+)(.*)/i); if (greenplumUrl) { return { host: greenplumUrl[4], @@ -58,12 +68,12 @@ export function resolveUrlInfo (url: string) { urlInfo: greenplumUrl[9], }; } - const result = url.match(/^jdbc:(oracle|mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/|;DatabaseName=)([^]+)(.*)/i); + const result = url.match(/^jdbc:(mysql|sqlserver|db2|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)?(.*)/i); if (result) { return { host: result[5], port: result[7] === 'port' ? '' : result[7], - databaseName: result[9], + databaseName: result[9] || '', urlInfo: result[10], }; } From 8e6e3464ad396856ad3c57b8cb5fea766e22d9a5 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 6 Jan 2020 15:45:39 +0800 Subject: [PATCH 12/25] =?UTF-8?q?fix:=20DEC-11782=20oracle=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5url=E7=AB=AF=E5=8F=A3=E5=8F=B7?= =?UTF-8?q?=E5=92=8C=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B9=8B=E9=97=B4=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E6=98=AF/=E6=88=96:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/__test__/app.test.ts | 12 ++++++++++++ src/modules/app.service.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/__test__/app.test.ts b/src/modules/__test__/app.test.ts index e61efc5..d1a205f 100644 --- a/src/modules/__test__/app.test.ts +++ b/src/modules/__test__/app.test.ts @@ -58,6 +58,18 @@ test('解析url', () => { databaseName: 'database', urlInfo: '', }); + expect(resolveUrlInfo('jdbc:oracle:thin:@192.168.5.143:1521/orcl')).toEqual({ + host: '192.168.5.143', + port: '1521', + databaseName: 'orcl', + urlInfo: '', + }); + expect(resolveUrlInfo('jdbc:oracle:thin:@192.168.5.143:1521:orcl')).toEqual({ + host: '192.168.5.143', + port: '1521', + databaseName: 'orcl', + urlInfo: '', + }); }); test('数据库可能为空', () => { diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index c193cbe..5a06d77 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -49,7 +49,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT export function resolveUrlInfo (url: string) { if (BI.isNull(url)) return {}; - const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:)([^]+)(.*)/i); + const oracleUlr = url.match(/^jdbc:(oracle):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(:|\/)([^]+)(.*)/i); if (oracleUlr) { return { host: oracleUlr[5], From fb5d3e8ee80da8187f16e502d515533988c89f7c Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 7 Jan 2020 11:13:18 +0800 Subject: [PATCH 13/25] =?UTF-8?q?fix:=20DEC-11797=20=E6=94=B9=E7=94=A8dec?= =?UTF-8?q?=E4=B8=AD=E8=87=AA=E5=B8=A6=E7=9A=84http=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/env.ts | 5 +- src/modules/crud/crud.service.ts | 126 +++++-------------------------- src/request.ts | 118 +++++++++++++++++++++++++++++ types/globals.d.ts | 14 +++- webpack/webpack.dev.js | 2 +- 5 files changed, 155 insertions(+), 110 deletions(-) create mode 100644 src/request.ts diff --git a/src/modules/constants/env.ts b/src/modules/constants/env.ts index 3030fbb..8ff0057 100644 --- a/src/modules/constants/env.ts +++ b/src/modules/constants/env.ts @@ -1,5 +1,6 @@ -const fineServletURL = Dec.fineServletURL; -export const ReqPrefix = `${fineServletURL}/v10/config/connection`; +export const fineServletURL = Dec.fineServletURL; +export const ReqPath = '/v10/config/connection'; +export const ReqPrefix = `${fineServletURL}${ReqPath}`; export const ImgPrefix = `${fineServletURL}/resources?path=/com/fr/web/resources/dist/images/2x/icon/database/`; export const PluginImgPrefix = `${fineServletURL}/resources?path=`; diff --git a/src/modules/crud/crud.service.ts b/src/modules/crud/crud.service.ts index 483b918..a9282ff 100644 --- a/src/modules/crud/crud.service.ts +++ b/src/modules/crud/crud.service.ts @@ -1,121 +1,35 @@ -import 'es6-promise/auto'; -import axios, { AxiosResponse, AxiosError } from 'axios'; -import { CrudReqOpts, CrudParams, ResultType } from './crud.typings.d'; -import { ReqPrefix, errorCode } from '../constants/env'; -const defaultHeaders = { - 'Content-Type': 'application/json', - 'X-Requested-With': 'XMLHttpRequest', -}; +import { ResultType } from './crud.typings.d'; +import { ReqPath } from '../constants/env'; -export function paramsSerializer(params: { [key: string]: any }) { - return Object.keys(params || {}) - .map(paramKey => { - const paramValue = params[paramKey]; - let value = ''; - - if (BI.isObject(paramValue)) { - value = encodeURIComponent(JSON.stringify(paramValue)); - } else { - value = paramValue; - } - - return BI.isNull(value) ? '' : `${paramKey}=${value}`; - }) - .filter(v => v !== '') - .join('&'); -} -function getCookieByName(name: string):string { - let value = null; - const regExpName = new RegExp(name); - document.cookie.split(';').forEach((item: string) => { - if (item.match(regExpName)) { - value = item.split(`${name}=`)[1]; - - return false; - } - }); - - return value; -} - -function checkStatus(response: AxiosResponse) { - const status = response.status; - const noLoginErr = [errorCode.LOGIN_INFO_ERROR, errorCode.LOGIN_INFO_NOT_AVAILABLE, errorCode.TIMEOUT]; - - const resData = status === 200 - ? typeof response.data === 'string' - ? BI.jsonDecode(response.data) - : response.data - : {}; - if (noLoginErr.includes(BI.get(resData, 'errorCode'))) { - BI.Msg.alert(BI.i18nText('BI-Basic_Prompt'), BI.i18nText('Dec-Dcm_Login_Error'), () => { - window.location.reload(true); +export function requestGet(url: string, data?: any): Promise { + return new Promise(resolve => { + Dec.reqGet(`${ReqPath}/${url}`, '', re => { + resolve(re); }); - - return new Promise(() => {}); - } - - return resData; -} - -export async function request(reqOptions: CrudReqOpts = {}): Promise { - const { url, type, headers, data, params } = reqOptions; - - return axios - .request({ - url, - baseURL: ReqPrefix, - method: type, - headers: { - ...defaultHeaders, - ...headers, - Authorization: `Bearer ${getCookieByName('fine_auth_token')}`, - 'Content-Type': 'application/json;charset=UTF-8', - }, - params, - paramsSerializer, - data, - }) - .then(checkStatus) - .catch((error: AxiosError) => { - console.log(error); - }); -} - -export function requestGet(url: string, data?: any, params: CrudParams = {}) { - const timeStamp = new Date().getTime(); - - return request({ - url: url.includes('?') ? `${url}&_=${timeStamp}` : `${url}?_=${timeStamp}`, - type: 'GET', - data, - params, }); } -export function requestPost(url: string, data = {}, params: CrudParams = {}) { - return request({ - url, - type: 'POST', - data, - params, +export function requestPost(url: string, data = {}): Promise { + return new Promise(resolve => { + Dec.reqPost(`${ReqPath}/${url}`, data, re => { + resolve(re); + }); }); } export function requestDelete(url: string, data = {}) { - return request({ - url, - type: 'DELETE', - data, + return new Promise(resolve => { + Dec.reqDelete(`${ReqPath}/${url}`, data, re => { + resolve(re); + }); }); } -export function requestPut(url: string, data = {}, params: CrudParams = {}) { - return request({ - url, - type: 'PUT', - data, - params, +export function requestPut(url: string, data = {}) { + return new Promise(resolve => { + Dec.reqPut(`${ReqPath}/${url}`, data, re => { + resolve(re); + }); }); } diff --git a/src/request.ts b/src/request.ts new file mode 100644 index 0000000..b7f4d9a --- /dev/null +++ b/src/request.ts @@ -0,0 +1,118 @@ +import 'es6-promise/auto'; +import axios, { AxiosResponse, AxiosError } from 'axios'; +import { CrudReqOpts, ResultType } from './modules/crud/crud.typings'; +import { fineServletURL, errorCode } from './modules/constants/env'; +const defaultHeaders = { + 'Content-Type': 'application/json', + 'X-Requested-With': 'XMLHttpRequest', +}; + +export function paramsSerializer(params: { [key: string]: any }) { + return Object.keys(params || {}) + .map(paramKey => { + const paramValue = params[paramKey]; + + let value = ''; + + if (BI.isObject(paramValue)) { + value = encodeURIComponent(JSON.stringify(paramValue)); + } else { + value = paramValue; + } + + return BI.isNull(value) ? '' : `${paramKey}=${value}`; + }) + .filter(v => v !== '') + .join('&'); +} +function getCookieByName(name: string):string { + let value = null; + const regExpName = new RegExp(name); + document.cookie.split(';').forEach((item: string) => { + if (item.match(regExpName)) { + value = item.split(`${name}=`)[1]; + + return false; + } + }); + + return value; +} + +function checkStatus(response: AxiosResponse) { + const status = response.status; + const noLoginErr = [errorCode.LOGIN_INFO_ERROR, errorCode.LOGIN_INFO_NOT_AVAILABLE, errorCode.TIMEOUT]; + + const resData = status === 200 + ? typeof response.data === 'string' + ? BI.jsonDecode(response.data) + : response.data + : {}; + if (noLoginErr.includes(BI.get(resData, 'errorCode'))) { + BI.Msg.alert(BI.i18nText('BI-Basic_Prompt'), BI.i18nText('Dec-Dcm_Login_Error'), () => { + window.location.reload(true); + }); + + return new Promise(() => {}); + } + + return resData; +} + +export async function request(reqOptions: CrudReqOpts = {}): Promise { + const { url, type, headers, data, params } = reqOptions; + + return axios + .request({ + url, + baseURL: fineServletURL, + method: type, + headers: { + ...defaultHeaders, + ...headers, + Authorization: `Bearer ${getCookieByName('fine_auth_token')}`, + 'Content-Type': 'application/json;charset=UTF-8', + }, + params, + paramsSerializer, + data, + }) + .then(checkStatus) + .catch((error: AxiosError) => { + console.log(error); + }); +} + +Dec.reqGet = (url: string, data: any, callback: (re: any) => void) => { + const timeStamp = new Date().getTime(); + + request({ + url: url.includes('?') ? `${url}&_=${timeStamp}` : `${url}?_=${timeStamp}`, + type: 'GET', + data, + }).then(re => callback(re)); +}; + +Dec.reqPost = (url: string, data: any, callback: (re: any) => void) => { + request({ + url, + type: 'POST', + data, + }).then(re => callback(re)); +}; + +Dec.reqDelete = (url: string, data: any, callback: (re: any) => void) => { + request({ + url, + type: 'DELETE', + data, + }).then(re => callback(re)); +}; + +Dec.reqPut = (url: string, data: any, callback: (re: any) => void) => { + request({ + url, + type: 'PUT', + data, + }).then(re => callback(re)); +}; diff --git a/types/globals.d.ts b/types/globals.d.ts index ea354bf..e761929 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -5,4 +5,16 @@ interface Obj { declare let BI: Obj & import('fineui')._BI; declare const Fix: Obj; declare const DecCst: Obj; -declare const Dec: Obj; \ No newline at end of file +declare const Dec: { + fineServletURL: string; + socket: { + connected: boolean; + }; + personal: { + username: string; + }; + reqGet: (url: string, data: any, callback: (re: any) => void) => void; + reqPost: (url: string, data: any, callback: (re: any) => void) => void; + reqPut: (url: string, data: any, callback: (re: any) => void) => void; + reqDelete: (url: string, data: any, callback: (re: any) => void) => void; +}; \ No newline at end of file diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index f7e3bd1..d93e397 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -36,7 +36,7 @@ chokidar module.exports = merge(common, { devtool: 'eval-source-map', entry: { - show: ['./src/i18n.ts', './src/index.ts'], + show: ['./src/i18n.ts', './src/request.ts', './src/index.ts'], }, output: { path: dirs.DEST, From 44ad1b5e08b68116a688d49b0e036e31d9e526c0 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 7 Jan 2020 17:50:53 +0800 Subject: [PATCH 14/25] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Durl=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=E5=9C=B0=E5=9D=80=E4=BB=A5/=E7=BB=93?= =?UTF-8?q?=E5=B0=BE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/crud.service.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/crud/crud.service.ts b/src/modules/crud/crud.service.ts index a9282ff..c174421 100644 --- a/src/modules/crud/crud.service.ts +++ b/src/modules/crud/crud.service.ts @@ -3,32 +3,40 @@ import { ReqPath } from '../constants/env'; export function requestGet(url: string, data?: any): Promise { + const requestURL = url ? ReqPath : `${ReqPath}/${url}`; + return new Promise(resolve => { - Dec.reqGet(`${ReqPath}/${url}`, '', re => { + Dec.reqGet(requestURL, '', re => { resolve(re); }); }); } export function requestPost(url: string, data = {}): Promise { + const requestURL = url ? ReqPath : `${ReqPath}/${url}`; + return new Promise(resolve => { - Dec.reqPost(`${ReqPath}/${url}`, data, re => { + Dec.reqPost(requestURL, data, re => { resolve(re); }); }); } export function requestDelete(url: string, data = {}) { + const requestURL = url ? ReqPath : `${ReqPath}/${url}`; + return new Promise(resolve => { - Dec.reqDelete(`${ReqPath}/${url}`, data, re => { + Dec.reqDelete(requestURL, data, re => { resolve(re); }); }); } export function requestPut(url: string, data = {}) { + const requestURL = url ? ReqPath : `${ReqPath}/${url}`; + return new Promise(resolve => { - Dec.reqPut(`${ReqPath}/${url}`, data, re => { + Dec.reqPut(requestURL, data, re => { resolve(re); }); }); From 4c69a4eeb446fd877c1a0d7daa65cbcc29c5aed8 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 7 Jan 2020 17:53:08 +0800 Subject: [PATCH 15/25] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=86=99?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/crud.service.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/modules/crud/crud.service.ts b/src/modules/crud/crud.service.ts index c174421..19297e7 100644 --- a/src/modules/crud/crud.service.ts +++ b/src/modules/crud/crud.service.ts @@ -1,42 +1,37 @@ import { ResultType } from './crud.typings.d'; import { ReqPath } from '../constants/env'; +function getFullUrl(url: string) { + return url ? `${ReqPath}/${url}` : ReqPath; +} export function requestGet(url: string, data?: any): Promise { - const requestURL = url ? ReqPath : `${ReqPath}/${url}`; - return new Promise(resolve => { - Dec.reqGet(requestURL, '', re => { + Dec.reqGet(getFullUrl(url), '', re => { resolve(re); }); }); } export function requestPost(url: string, data = {}): Promise { - const requestURL = url ? ReqPath : `${ReqPath}/${url}`; - return new Promise(resolve => { - Dec.reqPost(requestURL, data, re => { + Dec.reqPost(getFullUrl(url), data, re => { resolve(re); }); }); } export function requestDelete(url: string, data = {}) { - const requestURL = url ? ReqPath : `${ReqPath}/${url}`; - return new Promise(resolve => { - Dec.reqDelete(requestURL, data, re => { + Dec.reqDelete(getFullUrl(url), data, re => { resolve(re); }); }); } export function requestPut(url: string, data = {}) { - const requestURL = url ? ReqPath : `${ReqPath}/${url}`; - return new Promise(resolve => { - Dec.reqPut(requestURL, data, re => { + Dec.reqPut(getFullUrl(url), data, re => { resolve(re); }); }); From cca3760ccac7844bfab2bfa070684729dbe0c925 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 8 Jan 2020 13:49:03 +0800 Subject: [PATCH 16/25] =?UTF-8?q?fix:=20DEC-11815=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=90=8D=E7=A7=B0=E7=9A=84?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 2 +- private/i18n.ts | 2 +- src/modules/app.constant.ts | 4 ++++ .../pages/connection/list/list_item/list_item.model.ts | 7 +++++++ src/modules/pages/maintain/forms/form.ts | 5 +++-- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 7c92a95..64b350f 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -110,7 +110,7 @@ Dec-Dcm_Connection_Deleted=该数据连接已被删除,无法进行操作 Dec-Dcm_Connection_Click_Connect_Database=点击连接数据库 Dec-Dcm_Connection_Read_Mode_List=以读取模式列表 Dec-Dcm_Connection_NO_Connection_Pool=无数据连接,可在数据连接管理页面添加 -Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于200个字符 +Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于150个字符 Dec-Dcm_Login_Error=登录信息已失效,请重新登录 BI-Multi_Date_Quarter_End= 季度末 BI-Multi_Date_Month_Begin= 月初 diff --git a/private/i18n.ts b/private/i18n.ts index 20f08e7..8c93ffa 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -109,7 +109,7 @@ export default { 'Dec-Dcm_Connection_Click_Connect_Database': '点击连接数据库', 'Dec-Dcm_Connection_Read_Mode_List': '以读取模式列表', 'Dec-Dcm_Connection_NO_Connection_Pool': '无数据连接,可在数据连接管理页面添加', - 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于200个字符', + 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于150个字符', 'Dec-Dcm_Login_Error': '登录信息已失效,请重新登录', 'BI-Multi_Date_Quarter_End': '季度末', 'BI-Multi_Date_Month_Begin': '月初', diff --git a/src/modules/app.constant.ts b/src/modules/app.constant.ts index ebb5253..618bdc3 100644 --- a/src/modules/app.constant.ts +++ b/src/modules/app.constant.ts @@ -1,2 +1,6 @@ export const CONSTANT_PLUGIN_TYPES = 'dec.constant.database.conf.connect.types'; BI.constant(CONSTANT_PLUGIN_TYPES, []); +/** + * 数据连接名称的最大长度 + */ +export const NAME_MAX_LENGTH = 150; diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index 1e5ab05..608a428 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/src/modules/pages/connection/list/list_item/list_item.model.ts @@ -2,6 +2,8 @@ import { model, Model } from '@core/core'; import { AppModel } from '../../../../app.model'; import { ApiFactory } from '../../../../crud/apiFactory'; import { ResultType } from '../../../../crud/crud.typings'; +import { getChartLength } from '../../../../app.service'; +import { NAME_MAX_LENGTH } from '../../../../app.constant'; const api = new ApiFactory().create(); export const ListItemModelXtype = 'dec.dcm.model.connection.list_item'; @@ -63,6 +65,11 @@ export class ListItemModel extends Model<{ resolve({ errorCode: '1', errorMsg: 'Dec-Dcm_Connection_ConnectionName_Cannt_Null' }); }); } + if (getChartLength(newName) > NAME_MAX_LENGTH) { + return new Promise(resolve => { + resolve({ errorCode: '1', errorMsg: 'Dec-Dcm_Connection_Cannot_Too_Lang' }); + }); + } const hasNamed = this.model.connections.some(item => item.connectionName === newName); if (hasNamed && oldName !== newName) { return new Promise(resolve => { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 34fa0f2..72159a0 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -7,6 +7,7 @@ import { connectionType, errorCode } from '@constants/env'; import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.typings'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant'; import { getJdbcDatabaseType, getChartLength } from '../../../app.service'; +import { NAME_MAX_LENGTH } from '../../../app.constant'; export const MaintainFormXtype = 'dec.dcm.maintain.form'; @shortcut(MaintainFormXtype) @store(MaintainFormModelXtype) @@ -186,7 +187,7 @@ export class MaintainForm extends BI.Widget { return false; } } - if (getChartLength(value.connectionName) > 200) { + if (getChartLength(value.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); return false; @@ -220,7 +221,7 @@ export class MaintainForm extends BI.Widget { return; } - if (getChartLength(formValue.connectionName) > 200) { + if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); return false; From 6c30ab46434cbeeb88d2951174f25586cfc25283 Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 8 Jan 2020 13:56:15 +0800 Subject: [PATCH 17/25] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9i18n=E7=9A=84?= =?UTF-8?q?=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 2 +- private/i18n.ts | 2 +- .../pages/connection/list/list_item/list_item.model.ts | 2 +- src/modules/pages/maintain/forms/form.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 64b350f..33db53d 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -110,7 +110,7 @@ Dec-Dcm_Connection_Deleted=该数据连接已被删除,无法进行操作 Dec-Dcm_Connection_Click_Connect_Database=点击连接数据库 Dec-Dcm_Connection_Read_Mode_List=以读取模式列表 Dec-Dcm_Connection_NO_Connection_Pool=无数据连接,可在数据连接管理页面添加 -Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于150个字符 +Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于{R1}个字符 Dec-Dcm_Login_Error=登录信息已失效,请重新登录 BI-Multi_Date_Quarter_End= 季度末 BI-Multi_Date_Month_Begin= 月初 diff --git a/private/i18n.ts b/private/i18n.ts index 8c93ffa..97b308f 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -109,7 +109,7 @@ export default { 'Dec-Dcm_Connection_Click_Connect_Database': '点击连接数据库', 'Dec-Dcm_Connection_Read_Mode_List': '以读取模式列表', 'Dec-Dcm_Connection_NO_Connection_Pool': '无数据连接,可在数据连接管理页面添加', - 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于150个字符', + 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于{R1}个字符', 'Dec-Dcm_Login_Error': '登录信息已失效,请重新登录', 'BI-Multi_Date_Quarter_End': '季度末', 'BI-Multi_Date_Month_Begin': '月初', diff --git a/src/modules/pages/connection/list/list_item/list_item.model.ts b/src/modules/pages/connection/list/list_item/list_item.model.ts index 608a428..efc02ca 100644 --- a/src/modules/pages/connection/list/list_item/list_item.model.ts +++ b/src/modules/pages/connection/list/list_item/list_item.model.ts @@ -67,7 +67,7 @@ export class ListItemModel extends Model<{ } if (getChartLength(newName) > NAME_MAX_LENGTH) { return new Promise(resolve => { - resolve({ errorCode: '1', errorMsg: 'Dec-Dcm_Connection_Cannot_Too_Lang' }); + resolve({ errorCode: '1', errorMsg: BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH) }); }); } const hasNamed = this.model.connections.some(item => item.connectionName === newName); diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 72159a0..6eec4d3 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -188,7 +188,7 @@ export class MaintainForm extends BI.Widget { } } if (getChartLength(value.connectionName) > NAME_MAX_LENGTH) { - this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); + this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); return false; } @@ -222,7 +222,7 @@ export class MaintainForm extends BI.Widget { return; } if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { - this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); + this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); return false; } From 03ae058adc5d1d027d4aa2bde6cbf1ffcd9d5360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=8D=A3=E6=AD=86?= Date: Thu, 6 Feb 2020 14:50:07 +0800 Subject: [PATCH 18/25] =?UTF-8?q?DEC-11996=20feat:=20=E3=80=90=E5=8D=8E?= =?UTF-8?q?=E4=B8=BA=E5=AE=89=E5=85=A8=E3=80=91=E5=86=85=E5=AD=98=E7=AD=89?= =?UTF-8?q?=E6=95=8F=E6=84=9F=E4=BF=A1=E6=81=AF=E9=9C=80=E8=A6=81=E9=89=B4?= =?UTF-8?q?=E6=9D=83=E6=89=8D=E8=83=BD=E8=8E=B7=E5=BE=97,=E5=89=8D?= =?UTF-8?q?=E5=8F=B0websocket=E4=BA=8B=E4=BB=B6=E6=90=BA=E5=B8=A6token?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/decision.api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 55096b1..d046519 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -96,7 +96,7 @@ export class DecisionApi implements Api { private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { - Dec.socket.emit(type, BI.encode(name), (re: any) => { + Dec.socketEmit(type, BI.encode(name), (re: any) => { resolve(re); }); } else { From 1c60639b44cfb779d6a9a1b1c2b0159feae06087 Mon Sep 17 00:00:00 2001 From: langwenda Date: Tue, 11 Feb 2020 14:56:35 +0800 Subject: [PATCH 19/25] =?UTF-8?q?fix:=20DEC-12046=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=BF=90=E8=A1=8C=E6=97=B6=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + webpack/webpack.dev.js | 2 +- yarn.lock | 15 ++++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index fe532bf..96d1011 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@babel/core": "7.4.5", "@babel/plugin-proposal-class-properties": "^7.5.0", "@babel/plugin-proposal-decorators": "7.4.4", + "@babel/polyfill": "^7.8.3", "@babel/preset-env": "7.4.5", "@babel/preset-typescript": "7.3.3", "@types/jest": "24.0.11", diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index d93e397..2c6e1ab 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -36,7 +36,7 @@ chokidar module.exports = merge(common, { devtool: 'eval-source-map', entry: { - show: ['./src/i18n.ts', './src/request.ts', './src/index.ts'], + show: ['babel-polyfill', './src/i18n.ts', './src/request.ts', './src/index.ts'], }, output: { path: dirs.DEST, diff --git a/yarn.lock b/yarn.lock index bb642bb..e41649b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -606,10 +606,10 @@ "@babel/helper-regex" "^7.4.4" regexpu-core "^4.5.4" -"@babel/polyfill@7.4.4": - version "7.4.4" - resolved "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz#78801cf3dbe657844eeabf31c1cae3828051e893" - integrity sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg== +"@babel/polyfill@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.8.3.tgz#2333fc2144a542a7c07da39502ceeeb3abe4debd" + integrity sha512-0QEgn2zkCzqGIkSWWAEmvxD7e00Nm9asTtQvi7HdlYvMhjy/J38V/1Y9ode0zEJeIuxAI0uftiAzqc7nVeWUGg== dependencies: core-js "^2.6.5" regenerator-runtime "^0.13.2" @@ -3054,11 +3054,16 @@ core-js-compat@^3.1.1: browserslist "^4.6.6" semver "^6.3.0" -core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5: +core-js@^2.4.0, core-js@^2.5.0: version "2.6.9" resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== +core-js@^2.6.5: + version "2.6.11" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" + integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== + core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" From 27d19b195fcf197a79e71090fee7e0da7fd41125 Mon Sep 17 00:00:00 2001 From: langwenda Date: Tue, 11 Feb 2020 14:58:01 +0800 Subject: [PATCH 20/25] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 96d1011..fb56082 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "scripts": { "dev": "cross-env NODE_ENV=mock webpack-dev-server -p --progress --config=webpack/webpack.dev.js --mode development --open", "build": "webpack -p --progress --config=webpack/webpack.prod.js --mode production", - "eslint": "eslint './*.js' './**/*.js' './**/*.ts'", - "eslint-fix": "eslint './*.js' './**/*.js' './**/*.ts' --fix", + "eslint": "eslint . --ext .ts'", + "eslint-fix": "eslint . --ext .ts --fix", "const": "javac -encoding UTF-8 -d constants/classes constants/*.java && java -cp constants/classes FRConstantsWriter", "i18n": "node ./lib/transform-i18n/transform-i18n.js", "test": "jest --passWithNoTests", From 7734a5cf37f3420f69057e3c76af9acaf59b6564 Mon Sep 17 00:00:00 2001 From: langwenda Date: Tue, 11 Feb 2020 15:03:04 +0800 Subject: [PATCH 21/25] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb56082..9cd2bb5 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "scripts": { "dev": "cross-env NODE_ENV=mock webpack-dev-server -p --progress --config=webpack/webpack.dev.js --mode development --open", "build": "webpack -p --progress --config=webpack/webpack.prod.js --mode production", - "eslint": "eslint . --ext .ts'", + "eslint": "eslint . --ext .ts", "eslint-fix": "eslint . --ext .ts --fix", "const": "javac -encoding UTF-8 -d constants/classes constants/*.java && java -cp constants/classes FRConstantsWriter", "i18n": "node ./lib/transform-i18n/transform-i18n.js", From d227b60eca8558570681d269d6f9f751da16896b Mon Sep 17 00:00:00 2001 From: "Frank.Qiu" Date: Tue, 11 Feb 2020 15:21:47 +0800 Subject: [PATCH 22/25] =?UTF-8?q?DEC-11995=20feat=EF=BC=9A=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E4=BC=A0=E8=BE=93=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 7badcea..f15b410 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -732,7 +732,7 @@ export class FormJdbc extends BI.Widget { driver: this.form.driver.getValue(), url: this.form.url.getValue(), user: this.form.user.getValue(), - password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.encode(this.form.password.getValue()), + password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : BI.Providers.getProvider('dec.provider.cipher').getCipher(this.form.password.getValue()), queryType: '', newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk originalCharsetName, From 35a4a78e8237738de976b8c7c2288c462751a88c Mon Sep 17 00:00:00 2001 From: langwenda Date: Tue, 18 Feb 2020 15:34:41 +0800 Subject: [PATCH 23/25] =?UTF-8?q?fix:=20DEC-11221=20=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=AF=B9=E5=8F=AF=E8=BE=93=E5=85=A5=E6=95=B0=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E5=8C=BA=E9=97=B4=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 3 +- private/i18n.ts | 1 + src/modules/constants/constant.ts | 2 ++ .../maintain/forms/components/form.jdbc.ts | 30 ++++++++++++------- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 33db53d..2010d77 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -301,4 +301,5 @@ BI-Basic_Billion= 亿 BI-Basic_Quarter= 季度 BI-Basic_No_Select= 不选 BI-Basic_Now= 此刻 -Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB \ No newline at end of file +Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB +Dec-Dcm_Connection_Value_Out_Range=数值超出范围 \ No newline at end of file diff --git a/private/i18n.ts b/private/i18n.ts index 97b308f..369845f 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -301,4 +301,5 @@ export default { 'BI-Basic_No_Select': '不选', 'BI-Basic_Now': '此刻', 'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB', + 'Dec-Dcm_Connection_Value_Out_Range': '数值超出范围', }; diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 445b57d..d9ad8f7 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -707,3 +707,5 @@ export const JNDI_FACTORYS = [ ]; export const PAGE_SIZE = 50; +export const INT_MAX_VALUE = 2147483647; +export const INT_MIN_VALUE = -2147483648; diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 7badcea..2b45df6 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -4,7 +4,7 @@ import { CollapseXtype, EVENT_CHANGE } from 'src/modules/components/collapse/col import { FormItemXtype } from '../../components/form_item/form_item'; import { Connection, ConnectionJDBC, ConnectionPoolJDBC } from 'src/modules/crud/crud.typings'; import { connectionType } from '@constants/env'; -import { CONNECT_CHARSET, CONNECTION_LAYOUT } from '@constants/constant'; +import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; import { TextCheckerXtype } from '../../../../components/text_checker/text_checker'; export const FormJdbcXtype = 'dec.dcm.maintain.form.jdbc'; @@ -62,6 +62,12 @@ export class FormJdbc extends BI.Widget { const { host, port, databaseName } = resolveUrlInfo(url); const { hgap, vgap } = CONNECTION_LAYOUT; + const valueRangeConfig = { + errorText: BI.i18nText('Dec-Dcm_Connection_Value_Out_Range'), + checker: (value: string) => this.checkValueRange(value), + autoFix: true, + }; + return { type: Vertical, hgap, @@ -161,7 +167,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.port = _ref; }, @@ -408,7 +414,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), ref: (_ref: any) => { this.form.initialSize = _ref; @@ -428,7 +434,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.maxActive = _ref; }, @@ -447,7 +453,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.maxIdle = _ref; }, @@ -466,7 +472,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.minIdle = _ref; }, @@ -486,7 +492,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.maxWait = _ref; }, @@ -574,7 +580,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), checker: (value: string) => this.checkNumber(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.timeBetweenEvictionRunsMillis = _ref; }, @@ -600,7 +606,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.numTestsPerEvictionRun = _ref; }, @@ -620,7 +626,7 @@ export class FormJdbc extends BI.Widget { errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), checker: (value: string) => this.checkInteger(value), autoFix: true, - }], + }, valueRangeConfig], ref: (_ref: any) => { this.form.minEvictableIdleTimeMillis = _ref; }, @@ -651,6 +657,10 @@ export class FormJdbc extends BI.Widget { return /^[(\-|\+)?\d]+$/.test(value); } + private checkValueRange(value: string) { + return Number(value) <= INT_MAX_VALUE && Number(value) >= INT_MIN_VALUE; + } + private getDrivers() { const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); From cfd715825a37d502c11e58f61b38f8bd961bbffd Mon Sep 17 00:00:00 2001 From: langwenda Date: Tue, 18 Feb 2020 15:46:35 +0800 Subject: [PATCH 24/25] =?UTF-8?q?fix:=20=E7=94=B1=E4=BA=8E=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E7=8E=87=E7=9A=84=E5=85=B3=E7=B3=BB=EF=BC=8CNumber?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=94=B9=E6=88=90parseInt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index d8a0a37..3af4cf6 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -658,7 +658,7 @@ export class FormJdbc extends BI.Widget { } private checkValueRange(value: string) { - return Number(value) <= INT_MAX_VALUE && Number(value) >= INT_MIN_VALUE; + return parseInt(value, 0) <= INT_MAX_VALUE && parseInt(value, 0) >= INT_MIN_VALUE; } private getDrivers() { From d0814a9acfbf5be5a488545764b3d67bd086f29a Mon Sep 17 00:00:00 2001 From: "Frank.Qiu" Date: Thu, 20 Feb 2020 17:39:16 +0800 Subject: [PATCH 25/25] =?UTF-8?q?DEC-12158=20fix:=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E6=B5=8B=E8=AF=95=EF=BC=8C=E9=81=87=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E7=95=8C=E9=9D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 2 +- src/modules/pages/database/database.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 445b57d..6660598 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -597,7 +597,7 @@ export const DATA_BASE_TYPES = [ export const CONNECT_CHARSET = [ { - text: '自动', + text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), value: '', }, { diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index a13921e..e7fa658 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -140,19 +140,23 @@ export class Datebase extends BI.Widget { items: [ { el: { - type: VerticalAdapt, + type: Htape, hgap: 20, invisible: true, items: [ { type: Label, + width: 70, + textAlign: 'left', text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), + title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), }, { type: MultiSelectItem, width: 80, selected: this.model.isInternal, text: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), + title: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), ref: (_ref: any) => { this.internalWidget = _ref; }, @@ -165,6 +169,7 @@ export class Datebase extends BI.Widget { width: 80, selected: this.model.isPlugin, text: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), + title: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), ref: (_ref: any) => { this.pluginWidget = _ref; }, @@ -175,14 +180,16 @@ export class Datebase extends BI.Widget { { type: Label, cls: 'bi-tips', + textAlign: 'left', text: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'), + title: BI.i18nText('Dec-Dcm_Connection_Filter_Tip'), }, ], ref: (_ref: any) => { this.typeFilterWidget = _ref; }, }, - height: 20, + height: 24, }, { type: ButtonGroup,