From a5ce8cc9d4dabf1761e09c1b6a8919b755e88bc1 Mon Sep 17 00:00:00 2001 From: dailer Date: Wed, 13 Oct 2021 10:09:13 +0800 Subject: [PATCH 001/116] =?UTF-8?q?DEC-20979=20feat:=20=E3=80=90BI?= =?UTF-8?q?=E9=85=8D=E5=90=88=E3=80=91=E9=80=82=E9=85=8Ddoris=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 5bb3778..cedc99f 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -561,6 +561,17 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: false, kerberos: false, + }, { + text: 'Doris', + databaseType: 'doris', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver'], + url: 'jdbc:mysql://hostname:port/database', + commonly: false, + internal: true, + type: 'jdbc', + hasSchema: false, + kerberos: false, }, { text: 'Presto', databaseType: 'presto', From 351740976c3ef07497be3e142478eb52b8701497 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 15 Oct 2021 10:10:25 +0800 Subject: [PATCH 002/116] =?UTF-8?q?Revert=20"DEC-20201=20feat:=20=E3=80=90?= =?UTF-8?q?=E8=BF=AD=E4=BB=A3=E3=80=91=E3=80=90=E9=A9=B1=E5=8A=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=80=91=E5=B1=8F=E8=94=BD=E9=A9=B1=E5=8A=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=85=A5=E5=8F=A3=E4=BB=A5=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit bff088b06b13bfe970041ee6667f32980d6855a7. --- src/modules/pages/connection/connection.ts | 2 +- .../driverselector/driverselector.ts | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index f8d175c..90f5ba1 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -79,7 +79,7 @@ export class Connection extends BI.Widget { right: [ { type: 'dec.connection.driver.entry', - invisible: true, + invisible: !BI.Services.getService('dec.service.global').isAdmin(), from: '.dec-dcm', listeners: [ { diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index ef6c351..896c157 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -30,14 +30,18 @@ export class DriverSelector extends BI.Widget { customDrivers: SearchTextValueCombo = null; + beforeRender(cb: Function) { + this.store.initDriverClassList(cb); + } + watch = { driverClassItems: items => { - // this.customDrivers.populate(items); - // this.customDrivers.setValue(this.model.customDriver.value); + this.customDrivers.populate(items); + this.customDrivers.setValue(this.model.customDriver.value); }, driverManageEntryVisible: b => { - this.driverManageEntry.setVisible(false); + this.driverManageEntry.setVisible(b); }, }; @@ -55,7 +59,6 @@ export class DriverSelector extends BI.Widget { type: BI.TextValueCombo.xtype, width: 86, value: this.model.selectedDriverType, - invisible: true, items: [ { text: BI.i18nText('Dec-Basic_Default'), @@ -95,7 +98,7 @@ export class DriverSelector extends BI.Widget { this.defaultDrivers = _ref; }, invisible: this.model.driverSource !== '', - width: 300, + width: 204, items: this.model.defaultDrivers, value: this.model.defaultDriver.driver, listeners: [ @@ -116,7 +119,7 @@ export class DriverSelector extends BI.Widget { ref: _ref => { this.customDrivers = _ref; }, - invisible: true, + invisible: this.model.driverSource === '', width: 204, watermark: BI.i18nText('Dec-Please_Input'), items: this.model.driverClassItems, @@ -146,7 +149,7 @@ export class DriverSelector extends BI.Widget { text: BI.i18nText('Dec-Dcm_Create_New_Driver'), }, from: '.dec-dcm', - invisible: true, + invisible: !this.model.driverManageEntryVisible, listeners: [ { eventName: 'EVENT_CLOSE', @@ -175,7 +178,7 @@ export class DriverSelector extends BI.Widget { getValue() { return { - // driverSource: this.model.driverSource, + driverSource: this.model.driverSource, driver: this.model.driverSource === '' ? this.model.defaultDriver.driver : this.model.customDriver.driver, }; } From 9e87e30f645e628bf39dce5e55f62f1a7de6e6de Mon Sep 17 00:00:00 2001 From: dailer Date: Wed, 20 Oct 2021 11:00:56 +0800 Subject: [PATCH 003/116] =?UTF-8?q?BI-95685=20fix:=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E9=93=BE=E6=8E=A5=E6=97=B6=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=87=8D=E5=BB=BA=20identity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/form.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index cb3b573..5cc3b2a 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -139,9 +139,12 @@ 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; - + connectionData = connection.connectionData as ConnectionJDBC; + const { database, driver } = connectionData; + connectionData.database = getJdbcDatabaseType(database, driver).databaseType; + if (this.model.isCopy) { + connectionData.identity = BI.UUID(); + } return connection; } From 29c53b976a1e006e40d55976f3548d9014ec5820 Mon Sep 17 00:00:00 2001 From: dailer Date: Tue, 16 Nov 2021 15:28:21 +0800 Subject: [PATCH 004/116] =?UTF-8?q?DEC-21469=20fix:=20=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E9=A9=B1=E5=8A=A8=E7=AE=A1=E7=90=86?= =?UTF-8?q?v1.1=E3=80=91=E4=B8=A4=E4=B8=AA=E9=A9=B1=E5=8A=A8=E7=B1=BB?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=EF=BC=8C=E6=96=B0=E5=BB=BA=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E4=BF=9D=E5=AD=98=E5=90=8E=E4=BC=9A=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=9C=80=E6=96=B0=E7=9A=84=E9=82=A3=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintain/components/driverselector/driverselector.model.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts index 384e4f4..382f439 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts @@ -67,7 +67,8 @@ export class DriverSelectorModel extends Model { this.model.customDriver.driver = driver; this.model.customDrivers.some(customDriver => { - if (customDriver.driverClass === driver) { + // DEC-21469 存在driver值相同但driver名不同的场景,因此要用拼接名判断 + if (`${customDriver.driverClass} (${customDriver.name})` === value) { this.model.driverSource = customDriver.name; this.model.customDriver.value = `${driver} (${customDriver.name})`; From b14563262d8d1c7ac4391a34588d4ea2fe21de41 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 19 Nov 2021 16:06:48 +0800 Subject: [PATCH 005/116] =?UTF-8?q?DEC-21444=20feat:=20=E3=80=90BI?= =?UTF-8?q?=E9=85=8D=E5=90=88=E3=80=91=E8=BE=BE=E6=A2=A6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index cedc99f..ed5784b 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -572,6 +572,17 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: false, kerberos: false, + }, { + text: '达梦数据库', + databaseType: 'dm', + driver: 'dm.jdbc.driver.DmDriver', + drivers: ['dm.jdbc.driver.DmDriver'], + url: 'jdbc:dm://hostname:port', + commonly: false, + internal: true, + type: 'jdbc', + hasSchema: true, + kerberos: true, }, { text: 'Presto', databaseType: 'presto', From 67151ab586bbafde7ab72325a521c6fc1e544e91 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 19 Nov 2021 16:13:41 +0800 Subject: [PATCH 006/116] =?UTF-8?q?DEC-21444=20feat:=20=E3=80=90BI?= =?UTF-8?q?=E9=85=8D=E5=90=88=E3=80=91=E8=BE=BE=E6=A2=A6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index ed5784b..4becb61 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -573,7 +573,7 @@ export const DATA_BASE_TYPES = [ hasSchema: false, kerberos: false, }, { - text: '达梦数据库', + text: BI.i18nText('Dec-Dcm_Connection_Database_DM'), databaseType: 'dm', driver: 'dm.jdbc.driver.DmDriver', drivers: ['dm.jdbc.driver.DmDriver'], From f4f0a552b6b6ddfe221978cd4478397ae8b47cfa Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 22 Nov 2021 19:22:55 +0800 Subject: [PATCH 007/116] =?UTF-8?q?DEC-21535=20fix:=20=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E8=BE=BE=E6=A2=A6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=80=82=E9=85=8D=E3=80=91=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=BE=93=E5=85=A5URL=EF=BC=8C=E5=AF=B9=E5=BA=94=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=8D=E5=9B=9E=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index af2db61..d36a9f8 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -15,7 +15,7 @@ BI.provider('dec.connection.provider.datebase', function() { 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 { @@ -25,7 +25,7 @@ BI.provider('dec.connection.provider.datebase', function() { urlInfo: greenplumUrl[9], }; } - 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|clickhouse):(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|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse):(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], @@ -34,13 +34,13 @@ BI.provider('dec.connection.provider.datebase', function() { urlInfo: result[10], }; } - + // 处理oracle的RAC方式 if (/^jdbc:oracle:thin:([0-9a-zA-Z/]*)?@\(DESCRIPTION/i.test(url)) { const host = url.match(/\(HOST\s*=\s*([0-9a-zA-Z_\\.-]+)\)/i); const port = url.match(/\(PORT\s*=\s*([0-9]+)\)/i); const databaseName = url.match(/\(SERVICE_NAME\s*=\s*([\s0-9a-zA-Z_\\.]+)\)/i); - + return { host: host ? host[1] : '', port: port && port[1] !== 'port' ? port[1] : '', @@ -48,7 +48,7 @@ BI.provider('dec.connection.provider.datebase', function() { urlInfo: '', }; } - + return { host: '', port: '', @@ -60,10 +60,10 @@ BI.provider('dec.connection.provider.datebase', function() { this.registerDatabaseType = (config: any) => { BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); }; - + this.registerJdbcDatabase = (config: any, resolve?: Function) => { BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' })); - + BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); }; From bef463ad191e3ce191963474e7ee99116ebf36fa Mon Sep 17 00:00:00 2001 From: dailer Date: Tue, 7 Dec 2021 15:31:08 +0800 Subject: [PATCH 008/116] =?UTF-8?q?DEC-21498=20fix:=20=E3=80=90FR=E9=85=8D?= =?UTF-8?q?=E5=90=88=E3=80=91=E8=BF=9E=E6=8E=A5=E6=B1=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connection_jdbc/connection_jdbc.ts | 390 ++-- .../maintain/forms/components/form.jdbc.ts | 1758 ++++++++--------- 2 files changed, 1074 insertions(+), 1074 deletions(-) diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 6f97be8..5bb8a27 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -1,195 +1,195 @@ -import { shortcut, store } from '@core/core'; -import { FormItem } from '../components/form_item/form_item'; -import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; -import { ConnectionJdecModel } from './connection_jdbc.model'; -import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; -import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; -import { CONNECTION_LAYOUT } from '@constants/constant'; -import { VerticalLayout } from '@fui/core'; -import { ApiFactory } from '../../../crud/apiFactory'; - -const api = new ApiFactory().create(); - -@shortcut() -@store(ConnectionJdecModel) -export class ConnectionJdbc extends BI.Widget { - static xtype = 'dec.dcm.connection_jdbc'; - - advancedSet: any; - model: ConnectionJdecModel['model']; - allDatabaseTypes = getAllDatabaseTypes(); - - render() { - const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; - const { - driver, - driverSource, - database, - user, - originalCharsetName, - schema, - connectionPoolAttr, - authType, - principal, - url, - fetchSize, - } = connectionData; - const databaseType = getJdbcDatabaseType(database, driver); - const { host, port, databaseName } = resolveUrlInfo(url, database); - const { hgap, vgap } = CONNECTION_LAYOUT; - - return { - type: BI.VerticalLayout.xtype, - hgap, - vgap, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - value: databaseName, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - value: host, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - value: port, - }, - authType ? - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), - value: authType, - } : { - type: BI.Layout.xtype, - }, - { - type: FormItem.xtype, - name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - value: authType ? principal : user, - }, - { - type: FormItem.xtype, - name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), - value: '******', - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Default'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), - value: schema, - invisible: !databaseType.hasSchema, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), - value: url, - }, - { - type: Collapse.xtype, - width: 70, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), - listeners: [ - { - eventName: EVENT_CHANGE, - action: (isCollapse: boolean) => { - this.advancedSet.setVisible(!isCollapse); - }, - }, - ], - }, - { - type: BI.VerticalLayout.xtype, - tgap: -15, - vgap, - invisible: true, - ref: (_ref: VerticalLayout) => { - this.advancedSet = _ref; - }, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - value: connectionPoolAttr.initialSize, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), - value: connectionPoolAttr.maxActive, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - value: connectionPoolAttr.maxIdle, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - value: connectionPoolAttr.minIdle, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), - value: connectionPoolAttr.maxWait, - unit: BI.i18nText('Dec-Dcm_Millisecond'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), - value: api.getPlain(connectionPoolAttr.validationQuery || ''), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), - value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - value: connectionPoolAttr.timeBetweenEvictionRunsMillis, - unit: BI.i18nText('Dec-Dcm_Millisecond'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - value: connectionPoolAttr.numTestsPerEvictionRun, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - value: connectionPoolAttr.minEvictableIdleTimeMillis, - unit: BI.i18nText('BI-Basic_Seconds'), - }, { - type: FormItem.xtype, - invisible: fetchSize < 0 && fetchSize !== -2, - name: 'Fetchsize', - value: fetchSize === -2 ? '' : fetchSize, - }, - ], - }, - ], - }; - } -} +import { shortcut, store } from '@core/core'; +import { FormItem } from '../components/form_item/form_item'; +import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; +import { ConnectionJdecModel } from './connection_jdbc.model'; +import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; +import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; +import { CONNECTION_LAYOUT } from '@constants/constant'; +import { VerticalLayout } from '@fui/core'; +import { ApiFactory } from '../../../crud/apiFactory'; + +const api = new ApiFactory().create(); + +@shortcut() +@store(ConnectionJdecModel) +export class ConnectionJdbc extends BI.Widget { + static xtype = 'dec.dcm.connection_jdbc'; + + advancedSet: any; + model: ConnectionJdecModel['model']; + allDatabaseTypes = getAllDatabaseTypes(); + + render() { + const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; + const { + driver, + driverSource, + database, + user, + originalCharsetName, + schema, + connectionPoolAttr, + authType, + principal, + url, + fetchSize, + } = connectionData; + const databaseType = getJdbcDatabaseType(database, driver); + const { host, port, databaseName } = resolveUrlInfo(url, database); + const { hgap, vgap } = CONNECTION_LAYOUT; + + return { + type: BI.VerticalLayout.xtype, + hgap, + vgap, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), + value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), + value: databaseName, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + value: host, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + value: port, + }, + authType ? + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), + value: authType, + } : { + type: BI.Layout.xtype, + }, + { + type: FormItem.xtype, + name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + value: authType ? principal : user, + }, + { + type: FormItem.xtype, + name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_KeyPath') : BI.i18nText('Dec-Dcm_Connection_Form_Password'), + value: '******', + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Default'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), + value: schema, + invisible: !databaseType.hasSchema, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), + value: url, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), + value: connectionPoolAttr.maxActive, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), + value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), + value: api.getPlain(connectionPoolAttr.validationQuery || ''), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), + value: connectionPoolAttr.maxWait, + unit: BI.i18nText('Dec-Dcm_Millisecond'), + }, + { + type: Collapse.xtype, + width: 70, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.advancedSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + tgap: -15, + vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.advancedSet = _ref; + }, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), + value: connectionPoolAttr.initialSize, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), + value: connectionPoolAttr.maxIdle, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + value: connectionPoolAttr.minIdle, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), + value: connectionPoolAttr.timeBetweenEvictionRunsMillis, + unit: BI.i18nText('Dec-Dcm_Millisecond'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + value: connectionPoolAttr.numTestsPerEvictionRun, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), + value: connectionPoolAttr.minEvictableIdleTimeMillis, + unit: BI.i18nText('BI-Basic_Seconds'), + }, { + type: FormItem.xtype, + invisible: fetchSize < 0 && fetchSize !== -2, + name: 'Fetchsize', + value: fetchSize === -2 ? '' : fetchSize, + }, + ], + }, + ], + }; + } +} diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index d9fe88c..af4dbca 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1,879 +1,879 @@ -import { shortcut } from '@core/core'; -import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; -import { FormItem } 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, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; -import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; -import { TextChecker } from '../../../../components/text_checker/text_checker'; -import { ApiFactory } from 'src/modules/crud/apiFactory'; -import { - Editor, - EditorIconCheckCombo, - Label, - TextAreaEditor, - TextEditor, - TextValueCombo, - VerticalLayout, -} from '@fui/core'; -import { DriverSelector } from '../../components/driverselector/driverselector'; - -const api = new ApiFactory().create(); - -@shortcut() -export class FormJdbc extends BI.Widget { - static xtype = 'dec.dcm.maintain.form.jdbc'; - - props = { - formData: {} as Connection, - }; - - oldPassword = ''; - allDatabaseTypes = getAllDatabaseTypes(); - - advancedSet: VerticalLayout; - formUser: FormItem; - formPassword: FormItem; - formPrincipal: FormItem; - formKeyPath: FormItem; - labelTips: Label; - - form = { - connectionName: null, - driver: null, - database: null, - host: null, - port: null, - user: null, - password: null, - authType: null, - principal: null, - keyPath: null, - originalCharsetName: null, - schema: null, - url: null, - initialSize: null, - maxActive: null, - maxIdle: null, - maxWait: null, - validationQuery: null, - testOnBorrow: null, - testOnReturn: null, - testWhileIdle: null, - timeBetweenEvictionRunsMillis: null, - numTestsPerEvictionRun: null, - minIdle: null, - minEvictableIdleTimeMillis: null, - fetchSize: null, - }; - - render() { - const { connectionName, connectionData } = this.options.formData; - const { - driver, - driverSource, - user, - password, - originalCharsetName, - schema, - url, - connectionPoolAttr, - database, - authType, - principal, - keyPath, - fetchSize, - } = connectionData as ConnectionJDBC; - const { - initialSize, - maxActive, - maxIdle, - maxWait, - validationQuery, - testOnBorrow, - testOnReturn, - testWhileIdle, - timeBetweenEvictionRunsMillis, - numTestsPerEvictionRun, - minIdle, - minEvictableIdleTimeMillis, - } = connectionPoolAttr as ConnectionPoolJDBC; - const databaseType = getJdbcDatabaseType(database, driver); - this.oldPassword = password; - const { host, port, databaseName } = resolveUrlInfo(url, database); - 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: BI.VerticalLayout.xtype, - hgap, - vgap, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Name'), - forms: [{ - type: TextChecker.xtype, - $value: 'connection-name', - width: 300, - value: connectionName, - allowBlank: true, - ref: (_ref: TextChecker) => { - this.form.connectionName = _ref; - }, - watermark: BI.i18nText('Dec-Dcm_Data_Connections'), - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - forms: [ - { - type: DriverSelector.xtype, - ref: (_ref: DriverSelector) => { - this.form.driver = _ref; - }, - driver, - driverSource, - connectionData, - listeners: [ - { - eventName: 'EVENT_CHANGE', - action: () => { - const value = this.form.driver.getValue(); - const connectionData = this.options.formData.connectionData as ConnectionJDBC; - const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - // DEC-2020 - const url = (connectionType.urls && connectionType.urls[value.driver]) || connectionType.url; - this.form.url.setValue(url); - const urlInfo = resolveUrlInfo(url, connectionData.database); - this.form.host.setValue(urlInfo.host); - this.form.database.setValue(urlInfo.databaseName); - this.form.port.setValue(urlInfo.port); - }, - }, - ], - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - forms: [{ - type: BI.TextEditor.xtype, - $value: 'database-name', - width: 300, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - value: databaseName, - ref: (_ref: any) => { - this.form.database = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - this.onHostPortChange(databaseType); - }, - }], - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - forms: [{ - type: BI.TextEditor.xtype, - $value: 'database-host', - width: 300, - allowBlank: true, - value: host, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - ref: (_ref: any) => { - this.form.host = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - this.onHostPortChange(databaseType); - }, - }], - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - forms: [{ - type: TextChecker.xtype, - $value: 'database-port', - width: 300, - allowBlank: true, - value: port, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.port = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - this.onHostPortChange(databaseType); - }, - }], - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), - invisible: !databaseType.kerberos, - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'auth-type', - width: 300, - value: authType, - ref: (_ref: TextValueCombo) => { - this.form.authType = _ref; - }, - items: [ - { - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName_Password'), - value: '', - }, - { - text: 'Kerberos', - value: 'kerberos', - }, - ], - listeners: [ - { - eventName: BI.Combo.EVENT_CHANGE, - action: () => { - const type = this.form.authType.getValue()[0]; - this.formPrincipal.setVisible(!!type); - this.formKeyPath.setVisible(!!type); - this.formUser.setVisible(!type); - this.formPassword.setVisible(!type); - this.labelTips.setVisible(!!type); - }, - }, - ], - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - invisible: !!authType, - ref: (_ref: FormItem) => { - this.formUser = _ref; - }, - forms: [{ - type: BI.TextEditor.xtype, - $value: 'username', - width: 300, - allowBlank: true, - value: user, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - ref: (_ref: TextEditor) => { - this.form.user = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - invisible: !!authType, - ref: (_ref: FormItem) => { - this.formPassword = _ref; - }, - forms: [{ - type: BI.Editor.xtype, - $value: 'password', - cls: 'bi-border bi-border-radius', - width: 300, - height: 20, - allowBlank: true, - value: password, - inputType: 'password', - autocomplete: 'new-password', - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - ref: (_ref: Editor) => { - this.form.password = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), - invisible: !authType, - ref: (_ref: FormItem) => { - this.formPrincipal = _ref; - }, - forms: [{ - type: BI.TextEditor.xtype, - $value: 'principal', - width: 300, - allowBlank: true, - value: principal, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), - ref: (_ref: TextEditor) => { - this.form.principal = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), - invisible: !authType, - ref: (_ref: FormItem) => { - this.formKeyPath = _ref; - }, - forms: [{ - type: BI.Editor.xtype, - $value: 'key-path', - cls: 'bi-border', - width: 300, - height: 20, - allowBlank: true, - value: keyPath, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), - ref: (_ref: Editor) => { - this.form.keyPath = _ref; - }, - }], - }, - { - type: BI.Label.xtype, - cls: 'bi-tips', - textAlign: 'left', - invisible: true, - text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'), - ref: (_ref: Label) => { - this.labelTips = _ref; - }, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'original-charset-name', - width: 300, - value: originalCharsetName ? originalCharsetName : '', - items: CONNECT_CHARSET, - ref: (_ref: TextValueCombo) => { - this.form.originalCharsetName = _ref; - }, - }], - }, - { - type: FormItem.xtype, - invisible: !databaseType.hasSchema, - height: 64, - name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), - forms: [{ - type: BI.VerticalLayout.xtype, - items: [{ - type: BI.FloatLeftLayout.xtype, - items: [{ - type: BI.TextButton.xtype, - cls: 'bi-high-light', - text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'), - handler: () => { - this.fireEvent('EVENT_TEST_CONNECTION'); - }, - }, { - type: BI.Label.xtype, - cls: 'bi-tips', - lgap: 3, - text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'), - }], - }, { - type: BI.TextValueCombo.xtype, - $value: 'schema', - width: 300, - vgap: 15, - disabled: true, - value: schema, - items: schema ? [{ text: schema, value: schema }] : [], - ref: (_ref: TextValueCombo) => { - this.form.schema = _ref; - }, - }], - }], - }, - { - type: BI.Layout.xtype, - cls: 'bi-border-top', - bgap: 8, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), - forms: [{ - type: BI.TextEditor.xtype, - $value: 'database-url', - width: 300, - allowBlank: true, - value: url, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), - ref: (_ref: TextEditor) => { - this.form.url = _ref; - }, - listeners: [{ - eventName: 'EVENT_CHANGE', - action: () => { - const urlInfo = resolveUrlInfo(this.form.url.getValue(), database); - this.form.host.setValue(urlInfo.host); - this.form.database.setValue(urlInfo.databaseName); - this.form.port.setValue(urlInfo.port); - }, - }], - }], - }, - { - type: Collapse.xtype, - bgap: -15, - width: 70, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), - listeners: [ - { - eventName: EVENT_CHANGE, - action: (isCollapse: boolean) => { - this.advancedSet.setVisible(!isCollapse); - }, - }, - ], - }, - { - type: BI.VerticalLayout.xtype, - vgap, - tgap: -15, - invisible: true, - ref: (_ref: VerticalLayout) => { - this.advancedSet = _ref; - }, - items: [ - { - type: FormItem.xtype, - tgap: 15, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - forms: [{ - type: TextChecker.xtype, - $value: 'initial-size', - width: 300, - allowBlank: false, - value: initialSize, - validationChecker: [{ - 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: TextChecker) => { - this.form.initialSize = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), - forms: [{ - type: TextChecker.xtype, - $value: 'max-active', - width: 300, - allowBlank: false, - value: maxActive, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.maxActive = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - forms: [{ - type: TextChecker.xtype, - $value: 'max-idle', - width: 300, - allowBlank: false, - value: maxIdle, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.maxIdle = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - forms: [{ - type: TextChecker.xtype, - $value: 'min-idle', - width: 300, - allowBlank: false, - value: minIdle, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.minIdle = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), - forms: [ - { - type: TextChecker.xtype, - $value: 'max-wait', - width: 300, - allowBlank: false, - value: maxWait, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.maxWait = _ref; - }, - }, - { - type: BI.Label.xtype, - lgap: 5, - height: CONNECTION_LAYOUT.labelHeight, - text: BI.i18nText('Dec-Dcm_Millisecond'), - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), - forms: [{ - type: BI.TextAreaEditor.xtype, - $value: 'validation-query', - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - value: api.getPlain(validationQuery || ''), - width: 300, - height: 100, - ref: (_ref: TextAreaEditor) => { - this.form.validationQuery = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'check', - width: 300, - allowBlank: true, - value: testOnBorrow, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), - ref: (_ref: TextValueCombo) => { - this.form.testOnBorrow = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'test-on-return', - width: 300, - allowBlank: true, - value: testOnReturn, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - ref: (_ref: TextValueCombo) => { - this.form.testOnReturn = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'test-while-idle', - width: 300, - allowBlank: true, - value: testWhileIdle, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - ref: (_ref: TextValueCombo) => { - this.form.testWhileIdle = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - forms: [ - { - type: TextChecker.xtype, - $value: 'test-between-evicition-millis', - width: 300, - allowBlank: false, - value: timeBetweenEvictionRunsMillis, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), - checker: (value: string) => this.checkNumber(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.timeBetweenEvictionRunsMillis = _ref; - }, - }, - { - type: BI.Label.xtype, - lgap: 5, - height: CONNECTION_LAYOUT.labelHeight, - text: BI.i18nText('Dec-Dcm_Millisecond'), - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - forms: [{ - type: TextChecker.xtype, - $value: 'test-pereviction-run-num', - width: 300, - allowBlank: false, - value: numTestsPerEvictionRun, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.numTestsPerEvictionRun = _ref; - }, - }], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - forms: [ - { - type: TextChecker.xtype, - $value: 'min-evictable-idle-time-millis', - width: 300, - allowBlank: false, - value: minEvictableIdleTimeMillis, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.minEvictableIdleTimeMillis = _ref; - }, - }, - { - type: BI.Label.xtype, - lgap: 5, - height: CONNECTION_LAYOUT.labelHeight, - text: BI.i18nText('BI-Basic_Seconds'), - }, - ], - }, { - el: { - type: BI.VerticalLayout.xtype, - cls: 'bi-border-top', - invisible: fetchSize < 0 && fetchSize !== -2, - items: [ - { - el: { - type: FormItem.xtype, - name: 'Fetchsize', - forms: [{ - type: TextChecker.xtype, - $value: 'fetch-size', - width: 300, - allowBlank: true, - value: fetchSize === -2 ? '' : fetchSize, - watermark: 'Fetchsize', - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), - checker: (value: string) => BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, - autoFix: true, - }], - ref: (_ref: TextChecker) => { - this.form.fetchSize = _ref; - }, - }], - }, - vgap: 15, - }, - ], - }, - }, - ], - }, - ], - }; - } - - public setError(value: string) { - this.form.connectionName.setError(value); - } - - private checkInteger(value: string) { - return /^[\d]+$/.test(value); - } - - private checkNumber(value: string) { - return /^[(\-|\+)?\d]+$/.test(value); - } - - private checkValueRange(value: string) { - return parseInt(value, 0) <= INT_MAX_VALUE && parseInt(value, 0) >= INT_MIN_VALUE; - } - - private getDrivers() { - const connectionData = this.options.formData.connectionData as ConnectionJDBC; - const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - const drivers = connectionType.drivers ? - connectionType.drivers.map(item => { - return { - text: item, - value: item, - }; - }) : - [{ - text: connectionType.driver, - value: connectionType.driver, - }]; - - if (!drivers.some(item => item.text === connectionData.driver)) { - return [ - { - text: connectionData.driver, - value: connectionData.driver, - }, - ...drivers, - ]; - } - - return drivers; - } - - private getBooleanItem() { - return [ - { - text: BI.i18nText('Dec-Dcm_Yes'), - value: true, - }, - { - text: BI.i18nText('Dec-Dcm_No'), - value: false, - }, - ]; - } - - private onHostPortChange(databaseType) { - const { urls, url } = databaseType; - const driver = this.form.driver.getValue(); - const selectUrl = BI.get(urls, driver.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, selectUrl)); - } - - public setSchemas(schemas: string[]) { - this.form.schema.setEnable(true); - if (schemas.length > 0) { - const value = this.form.schema.getValue()[0]; - this.form.schema.populate(schemas.map(item => { - return { - text: item, - value: item, - }; - })); - this.form.schema.setValue(value && schemas.some(item => item === value) ? value : schemas[0]); - } - } - - public validation(): boolean { - return this.form.driver.validation(); - } - - public getSubmitValue(): Connection { - const connectionData = this.options.formData.connectionData as ConnectionJDBC; - const connectionPoolAttr = connectionData.connectionPoolAttr; - const originalCharsetName = this.form.originalCharsetName.getValue()[0] || ''; - // TODO 获取表单数据这里待优化 - - return { - connectionType: connectionType.JDBC, - connectionId: this.form.connectionName.getValue(), - connectionName: this.form.connectionName.getValue(), - connectionData: BI.extend({}, connectionData, { - database: connectionData.database, - connectionName: this.form.connectionName.getValue(), - ...this.form.driver.getValue(), - url: this.form.url.getValue(), - user: this.form.user.getValue(), - password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : api.getCipher(this.form.password.getValue()), - queryType: '', - newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk - originalCharsetName, - schema: this.form.schema.getValue()[0], - host: this.form.host.getValue(), - authType: this.form.authType.getValue()[0] || '', - creator: Dec ? Dec.personal.username : '', - principal: this.form.principal.getValue(), - keyPath: this.form.keyPath.getValue(), - fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -2 : BI.parseInt(this.form.fetchSize.getValue()), - connectionPoolAttr: { - initialSize: this.form.initialSize.getValue(), - maxActive: this.form.maxActive.getValue(), - maxIdle: this.form.maxIdle.getValue(), - minIdle: this.form.minIdle.getValue(), - maxWait: this.form.maxWait.getValue(), - validationQuery: api.getCipher(this.form.validationQuery.getValue()), - testOnBorrow: BI.size(this.form.testOnBorrow.getValue()) > 0 ? this.form.testOnBorrow.getValue()[0] : connectionPoolAttr.testOnBorrow, - testOnReturn: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testOnReturn.getValue()[0] : connectionPoolAttr.testOnReturn, - testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle, - timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), - numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), - minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), - }, - }), - }; - } -} +import { shortcut } from '@core/core'; +import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse'; +import { FormItem } 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, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; +import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; +import { TextChecker } from '../../../../components/text_checker/text_checker'; +import { ApiFactory } from 'src/modules/crud/apiFactory'; +import { + Editor, + EditorIconCheckCombo, + Label, + TextAreaEditor, + TextEditor, + TextValueCombo, + VerticalLayout, +} from '@fui/core'; +import { DriverSelector } from '../../components/driverselector/driverselector'; + +const api = new ApiFactory().create(); + +@shortcut() +export class FormJdbc extends BI.Widget { + static xtype = 'dec.dcm.maintain.form.jdbc'; + + props = { + formData: {} as Connection, + }; + + oldPassword = ''; + allDatabaseTypes = getAllDatabaseTypes(); + + advancedSet: VerticalLayout; + formUser: FormItem; + formPassword: FormItem; + formPrincipal: FormItem; + formKeyPath: FormItem; + labelTips: Label; + + form = { + connectionName: null, + driver: null, + database: null, + host: null, + port: null, + user: null, + password: null, + authType: null, + principal: null, + keyPath: null, + originalCharsetName: null, + schema: null, + url: null, + initialSize: null, + maxActive: null, + maxIdle: null, + maxWait: null, + validationQuery: null, + testOnBorrow: null, + testOnReturn: null, + testWhileIdle: null, + timeBetweenEvictionRunsMillis: null, + numTestsPerEvictionRun: null, + minIdle: null, + minEvictableIdleTimeMillis: null, + fetchSize: null, + }; + + render() { + const { connectionName, connectionData } = this.options.formData; + const { + driver, + driverSource, + user, + password, + originalCharsetName, + schema, + url, + connectionPoolAttr, + database, + authType, + principal, + keyPath, + fetchSize, + } = connectionData as ConnectionJDBC; + const { + initialSize, + maxActive, + maxIdle, + maxWait, + validationQuery, + testOnBorrow, + testOnReturn, + testWhileIdle, + timeBetweenEvictionRunsMillis, + numTestsPerEvictionRun, + minIdle, + minEvictableIdleTimeMillis, + } = connectionPoolAttr as ConnectionPoolJDBC; + const databaseType = getJdbcDatabaseType(database, driver); + this.oldPassword = password; + const { host, port, databaseName } = resolveUrlInfo(url, database); + 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: BI.VerticalLayout.xtype, + hgap, + vgap, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Name'), + forms: [{ + type: TextChecker.xtype, + $value: 'connection-name', + width: 300, + value: connectionName, + allowBlank: true, + ref: (_ref: TextChecker) => { + this.form.connectionName = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Data_Connections'), + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), + forms: [ + { + type: DriverSelector.xtype, + ref: (_ref: DriverSelector) => { + this.form.driver = _ref; + }, + driver, + driverSource, + connectionData, + listeners: [ + { + eventName: 'EVENT_CHANGE', + action: () => { + const value = this.form.driver.getValue(); + const connectionData = this.options.formData.connectionData as ConnectionJDBC; + const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); + // DEC-2020 + const url = (connectionType.urls && connectionType.urls[value.driver]) || connectionType.url; + this.form.url.setValue(url); + const urlInfo = resolveUrlInfo(url, connectionData.database); + this.form.host.setValue(urlInfo.host); + this.form.database.setValue(urlInfo.databaseName); + this.form.port.setValue(urlInfo.port); + }, + }, + ], + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), + forms: [{ + type: BI.TextEditor.xtype, + $value: 'database-name', + width: 300, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), + value: databaseName, + ref: (_ref: any) => { + this.form.database = _ref; + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.onHostPortChange(databaseType); + }, + }], + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + forms: [{ + type: BI.TextEditor.xtype, + $value: 'database-host', + width: 300, + allowBlank: true, + value: host, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + ref: (_ref: any) => { + this.form.host = _ref; + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.onHostPortChange(databaseType); + }, + }], + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + forms: [{ + type: TextChecker.xtype, + $value: 'database-port', + width: 300, + allowBlank: true, + value: port, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.port = _ref; + }, + listeners: [{ + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.onHostPortChange(databaseType); + }, + }], + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), + invisible: !databaseType.kerberos, + forms: [{ + type: BI.TextValueCombo.xtype, + $value: 'auth-type', + width: 300, + value: authType, + ref: (_ref: TextValueCombo) => { + this.form.authType = _ref; + }, + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName_Password'), + value: '', + }, + { + text: 'Kerberos', + value: 'kerberos', + }, + ], + listeners: [ + { + eventName: BI.Combo.EVENT_CHANGE, + action: () => { + const type = this.form.authType.getValue()[0]; + this.formPrincipal.setVisible(!!type); + this.formKeyPath.setVisible(!!type); + this.formUser.setVisible(!type); + this.formPassword.setVisible(!type); + this.labelTips.setVisible(!!type); + }, + }, + ], + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + invisible: !!authType, + ref: (_ref: FormItem) => { + this.formUser = _ref; + }, + forms: [{ + type: BI.TextEditor.xtype, + $value: 'username', + width: 300, + allowBlank: true, + value: user, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + ref: (_ref: TextEditor) => { + this.form.user = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + invisible: !!authType, + ref: (_ref: FormItem) => { + this.formPassword = _ref; + }, + forms: [{ + type: BI.Editor.xtype, + $value: 'password', + cls: 'bi-border bi-border-radius', + width: 300, + height: 20, + allowBlank: true, + value: password, + inputType: 'password', + autocomplete: 'new-password', + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + ref: (_ref: Editor) => { + this.form.password = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), + invisible: !authType, + ref: (_ref: FormItem) => { + this.formPrincipal = _ref; + }, + forms: [{ + type: BI.TextEditor.xtype, + $value: 'principal', + width: 300, + allowBlank: true, + value: principal, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), + ref: (_ref: TextEditor) => { + this.form.principal = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + invisible: !authType, + ref: (_ref: FormItem) => { + this.formKeyPath = _ref; + }, + forms: [{ + type: BI.Editor.xtype, + $value: 'key-path', + cls: 'bi-border', + width: 300, + height: 20, + allowBlank: true, + value: keyPath, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + ref: (_ref: Editor) => { + this.form.keyPath = _ref; + }, + }], + }, + { + type: BI.Label.xtype, + cls: 'bi-tips', + textAlign: 'left', + invisible: true, + text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'), + ref: (_ref: Label) => { + this.labelTips = _ref; + }, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), + forms: [{ + type: BI.TextValueCombo.xtype, + $value: 'original-charset-name', + width: 300, + value: originalCharsetName ? originalCharsetName : '', + items: CONNECT_CHARSET, + ref: (_ref: TextValueCombo) => { + this.form.originalCharsetName = _ref; + }, + }], + }, + { + type: FormItem.xtype, + invisible: !databaseType.hasSchema, + height: 64, + name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), + forms: [{ + type: BI.VerticalLayout.xtype, + items: [{ + type: BI.FloatLeftLayout.xtype, + items: [{ + type: BI.TextButton.xtype, + cls: 'bi-high-light', + text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'), + handler: () => { + this.fireEvent('EVENT_TEST_CONNECTION'); + }, + }, { + type: BI.Label.xtype, + cls: 'bi-tips', + lgap: 3, + text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'), + }], + }, { + type: BI.TextValueCombo.xtype, + $value: 'schema', + width: 300, + vgap: 15, + disabled: true, + value: schema, + items: schema ? [{ text: schema, value: schema }] : [], + ref: (_ref: TextValueCombo) => { + this.form.schema = _ref; + }, + }], + }], + }, + { + type: BI.Layout.xtype, + cls: 'bi-border-top', + bgap: 8, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), + forms: [{ + type: BI.TextEditor.xtype, + $value: 'database-url', + width: 300, + allowBlank: true, + value: url, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), + ref: (_ref: TextEditor) => { + this.form.url = _ref; + }, + listeners: [{ + eventName: 'EVENT_CHANGE', + action: () => { + const urlInfo = resolveUrlInfo(this.form.url.getValue(), database); + this.form.host.setValue(urlInfo.host); + this.form.database.setValue(urlInfo.databaseName); + this.form.port.setValue(urlInfo.port); + }, + }], + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), + forms: [{ + type: TextChecker.xtype, + $value: 'max-active', + width: 300, + allowBlank: false, + value: maxActive, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.maxActive = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), + forms: [{ + type: BI.TextValueCombo.xtype, + $value: 'check', + width: 300, + allowBlank: true, + value: testOnBorrow, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), + ref: (_ref: TextValueCombo) => { + this.form.testOnBorrow = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), + forms: [{ + type: BI.TextAreaEditor.xtype, + $value: 'validation-query', + cls: 'bi-border', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + value: api.getPlain(validationQuery || ''), + width: 300, + height: 100, + ref: (_ref: TextAreaEditor) => { + this.form.validationQuery = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), + forms: [ + { + type: TextChecker.xtype, + $value: 'max-wait', + width: 300, + allowBlank: false, + value: maxWait, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.maxWait = _ref; + }, + }, + { + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('Dec-Dcm_Millisecond'), + }, + ], + }, + { + type: Collapse.xtype, + bgap: -15, + width: 70, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.advancedSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + vgap, + tgap: -15, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.advancedSet = _ref; + }, + items: [ + { + type: FormItem.xtype, + tgap: 15, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), + forms: [{ + type: TextChecker.xtype, + $value: 'initial-size', + width: 300, + allowBlank: false, + value: initialSize, + validationChecker: [{ + 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: TextChecker) => { + this.form.initialSize = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), + forms: [{ + type: TextChecker.xtype, + $value: 'max-idle', + width: 300, + allowBlank: false, + value: maxIdle, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.maxIdle = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + forms: [{ + type: TextChecker.xtype, + $value: 'min-idle', + width: 300, + allowBlank: false, + value: minIdle, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.minIdle = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + forms: [{ + type: BI.TextValueCombo.xtype, + $value: 'test-on-return', + width: 300, + allowBlank: true, + value: testOnReturn, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + ref: (_ref: TextValueCombo) => { + this.form.testOnReturn = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + forms: [{ + type: BI.TextValueCombo.xtype, + $value: 'test-while-idle', + width: 300, + allowBlank: true, + value: testWhileIdle, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + ref: (_ref: TextValueCombo) => { + this.form.testWhileIdle = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), + forms: [ + { + type: TextChecker.xtype, + $value: 'test-between-evicition-millis', + width: 300, + allowBlank: false, + value: timeBetweenEvictionRunsMillis, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), + checker: (value: string) => this.checkNumber(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.timeBetweenEvictionRunsMillis = _ref; + }, + }, + { + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('Dec-Dcm_Millisecond'), + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + forms: [{ + type: TextChecker.xtype, + $value: 'test-pereviction-run-num', + width: 300, + allowBlank: false, + value: numTestsPerEvictionRun, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.numTestsPerEvictionRun = _ref; + }, + }], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), + forms: [ + { + type: TextChecker.xtype, + $value: 'min-evictable-idle-time-millis', + width: 300, + allowBlank: false, + value: minEvictableIdleTimeMillis, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, valueRangeConfig], + ref: (_ref: TextChecker) => { + this.form.minEvictableIdleTimeMillis = _ref; + }, + }, + { + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('BI-Basic_Seconds'), + }, + ], + }, { + el: { + type: BI.VerticalLayout.xtype, + cls: 'bi-border-top', + invisible: fetchSize < 0 && fetchSize !== -2, + items: [ + { + el: { + type: FormItem.xtype, + name: 'Fetchsize', + forms: [{ + type: TextChecker.xtype, + $value: 'fetch-size', + width: 300, + allowBlank: true, + value: fetchSize === -2 ? '' : fetchSize, + watermark: 'Fetchsize', + validationChecker: [{ + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), + checker: (value: string) => BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, + autoFix: true, + }], + ref: (_ref: TextChecker) => { + this.form.fetchSize = _ref; + }, + }], + }, + vgap: 15, + }, + ], + }, + }, + ], + }, + ], + }; + } + + public setError(value: string) { + this.form.connectionName.setError(value); + } + + private checkInteger(value: string) { + return /^[\d]+$/.test(value); + } + + private checkNumber(value: string) { + return /^[(\-|\+)?\d]+$/.test(value); + } + + private checkValueRange(value: string) { + return parseInt(value, 0) <= INT_MAX_VALUE && parseInt(value, 0) >= INT_MIN_VALUE; + } + + private getDrivers() { + const connectionData = this.options.formData.connectionData as ConnectionJDBC; + const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); + const drivers = connectionType.drivers ? + connectionType.drivers.map(item => { + return { + text: item, + value: item, + }; + }) : + [{ + text: connectionType.driver, + value: connectionType.driver, + }]; + + if (!drivers.some(item => item.text === connectionData.driver)) { + return [ + { + text: connectionData.driver, + value: connectionData.driver, + }, + ...drivers, + ]; + } + + return drivers; + } + + private getBooleanItem() { + return [ + { + text: BI.i18nText('Dec-Dcm_Yes'), + value: true, + }, + { + text: BI.i18nText('Dec-Dcm_No'), + value: false, + }, + ]; + } + + private onHostPortChange(databaseType) { + const { urls, url } = databaseType; + const driver = this.form.driver.getValue(); + const selectUrl = BI.get(urls, driver.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, selectUrl)); + } + + public setSchemas(schemas: string[]) { + this.form.schema.setEnable(true); + if (schemas.length > 0) { + const value = this.form.schema.getValue()[0]; + this.form.schema.populate(schemas.map(item => { + return { + text: item, + value: item, + }; + })); + this.form.schema.setValue(value && schemas.some(item => item === value) ? value : schemas[0]); + } + } + + public validation(): boolean { + return this.form.driver.validation(); + } + + public getSubmitValue(): Connection { + const connectionData = this.options.formData.connectionData as ConnectionJDBC; + const connectionPoolAttr = connectionData.connectionPoolAttr; + const originalCharsetName = this.form.originalCharsetName.getValue()[0] || ''; + // TODO 获取表单数据这里待优化 + + return { + connectionType: connectionType.JDBC, + connectionId: this.form.connectionName.getValue(), + connectionName: this.form.connectionName.getValue(), + connectionData: BI.extend({}, connectionData, { + database: connectionData.database, + connectionName: this.form.connectionName.getValue(), + ...this.form.driver.getValue(), + url: this.form.url.getValue(), + user: this.form.user.getValue(), + password: this.oldPassword === this.form.password.getValue() ? this.oldPassword : api.getCipher(this.form.password.getValue()), + queryType: '', + newCharsetName: originalCharsetName ? 'gbk' : '', // 后台要求,originalCharsetName不为空时,newCharsetName为gbk + originalCharsetName, + schema: this.form.schema.getValue()[0], + host: this.form.host.getValue(), + authType: this.form.authType.getValue()[0] || '', + creator: Dec ? Dec.personal.username : '', + principal: this.form.principal.getValue(), + keyPath: this.form.keyPath.getValue(), + fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -2 : BI.parseInt(this.form.fetchSize.getValue()), + connectionPoolAttr: { + initialSize: this.form.initialSize.getValue(), + maxActive: this.form.maxActive.getValue(), + maxIdle: this.form.maxIdle.getValue(), + minIdle: this.form.minIdle.getValue(), + maxWait: this.form.maxWait.getValue(), + validationQuery: api.getCipher(this.form.validationQuery.getValue()), + testOnBorrow: BI.size(this.form.testOnBorrow.getValue()) > 0 ? this.form.testOnBorrow.getValue()[0] : connectionPoolAttr.testOnBorrow, + testOnReturn: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testOnReturn.getValue()[0] : connectionPoolAttr.testOnReturn, + testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle, + timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), + numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), + minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), + }, + }), + }; + } +} From 28aaed596d7a74daefb5759f9c094907629216fe Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 13 Dec 2021 15:00:03 +0800 Subject: [PATCH 009/116] =?UTF-8?q?DEC-21782=20feat:=20=E9=80=82=E9=85=8Dd?= =?UTF-8?q?remio=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 4becb61..608a0fd 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -583,6 +583,17 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: true, kerberos: true, + }, { + text: 'dremio', + databaseType: 'dremio', + driver: 'com.dremio.jdbc.Driver', + drivers: ['com.dremio.jdbc.Driver'], + url: 'jdbc:dremio:direct=hostname:31010', + commonly: false, + internal: true, + type: 'jdbc', + hasSchema: true, + kerberos: true, }, { text: 'Presto', databaseType: 'presto', From 7c727e4e373484408d83dcd9572eb9918b251645 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 13 Dec 2021 16:17:46 +0800 Subject: [PATCH 010/116] =?UTF-8?q?DEC-21809=20fix:=20=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E8=BF=9E=E6=8E=A5=E6=B1=A0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BC=98=E5=8C=96=E3=80=91=E6=9C=80=E5=A4=A7=E7=A9=BA?= =?UTF-8?q?=E9=97=B2=E8=BF=9E=E6=8E=A5=E6=95=B0=E6=9C=AA=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connection_jdbc/connection_jdbc.ts | 9 ++----- .../maintain/forms/components/form.jdbc.ts | 27 ++----------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 5bb8a27..a65d97b 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -109,7 +109,7 @@ export class ConnectionJdbc extends BI.Widget { }, { type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Validation_Query'), + name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), value: api.getPlain(connectionPoolAttr.validationQuery || ''), }, { @@ -121,7 +121,7 @@ export class ConnectionJdbc extends BI.Widget { { type: Collapse.xtype, width: 70, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'), listeners: [ { eventName: EVENT_CHANGE, @@ -145,11 +145,6 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), value: connectionPoolAttr.initialSize, }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - value: connectionPoolAttr.maxIdle, - }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index af4dbca..b432d04 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -54,7 +54,6 @@ export class FormJdbc extends BI.Widget { url: null, initialSize: null, maxActive: null, - maxIdle: null, maxWait: null, validationQuery: null, testOnBorrow: null, @@ -87,7 +86,6 @@ export class FormJdbc extends BI.Widget { const { initialSize, maxActive, - maxIdle, maxWait, validationQuery, testOnBorrow, @@ -481,7 +479,7 @@ export class FormJdbc extends BI.Widget { $value: 'validation-query', cls: 'bi-border', allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query_Watermark'), value: api.getPlain(validationQuery || ''), width: 300, height: 100, @@ -522,7 +520,7 @@ export class FormJdbc extends BI.Widget { type: Collapse.xtype, bgap: -15, width: 70, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Advanced_Setting'), + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'), listeners: [ { eventName: EVENT_CHANGE, @@ -562,26 +560,6 @@ export class FormJdbc extends BI.Widget { }, }], }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - forms: [{ - type: TextChecker.xtype, - $value: 'max-idle', - width: 300, - allowBlank: false, - value: maxIdle, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Idle'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.maxIdle = _ref; - }, - }], - }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), @@ -862,7 +840,6 @@ export class FormJdbc extends BI.Widget { connectionPoolAttr: { initialSize: this.form.initialSize.getValue(), maxActive: this.form.maxActive.getValue(), - maxIdle: this.form.maxIdle.getValue(), minIdle: this.form.minIdle.getValue(), maxWait: this.form.maxWait.getValue(), validationQuery: api.getCipher(this.form.validationQuery.getValue()), From 369e428735f5c69bdadf6bd89dae62a399a7f7a6 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 20 Dec 2021 10:05:01 +0800 Subject: [PATCH 011/116] =?UTF-8?q?DEC-21782=20feat:=20=E9=80=82=E9=85=8Dd?= =?UTF-8?q?remio=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 608a0fd..37da373 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -593,7 +593,7 @@ export const DATA_BASE_TYPES = [ internal: true, type: 'jdbc', hasSchema: true, - kerberos: true, + kerberos: false, }, { text: 'Presto', databaseType: 'presto', From 8158ac4ce62e24b5a0749dca9f2ddb3144eed442 Mon Sep 17 00:00:00 2001 From: "Cauchy.Ke" Date: Wed, 9 Mar 2022 16:10:23 +0800 Subject: [PATCH 012/116] =?UTF-8?q?DEC-22408=20feat:=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81SSH=E5=8F=8ASSL=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 5 +- package.json | 4 +- .../file_chooser/file_chooser.model.ts | 68 + .../components/file_chooser/file_chooser.ts | 182 +++ .../components/text_checker/text_checker.ts | 120 +- src/modules/constants/constant.ts | 22 + src/modules/crud/crud.typings.d.ts | 214 +-- .../connection_jdbc/connection_jdbc.ts | 148 +- .../components/form_item/form_item.ts | 18 +- .../maintain/forms/components/form.jdbc.ts | 1224 ++++++++++++----- tsconfig.json | 2 +- types/globals.d.ts | 22 +- 12 files changed, 1486 insertions(+), 543 deletions(-) create mode 100644 src/modules/components/file_chooser/file_chooser.model.ts create mode 100644 src/modules/components/file_chooser/file_chooser.ts diff --git a/.eslintrc b/.eslintrc index 0a25792..1541dc7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -30,7 +30,8 @@ "no-use-before-define": [ "error", { - "functions": false + "functions": false, + "classes ": false } ], "new-cap": [ @@ -179,7 +180,7 @@ "array-bracket-spacing": ["error", "never"], // 数组紧贴括号部分不允许包含空格 "object-curly-spacing": ["error", "always"], // 对象紧贴花括号部分不允许包含空格 "no-regex-spaces": "error", // 禁止正则表达式字面量中出现多个空格 - "no-multi-spaces": "error", // 禁止出现多个空格而且不是用来作缩进的 + // "no-multi-spaces": "error", // 禁止出现多个空格而且不是用来作缩进的 "block-spacing": ["error", "never"], // 单行代码块中紧贴括号部分不允许包含空格 "computed-property-spacing": ["error", "never"], // 禁止括号和其内部值之间的空格 "no-trailing-spaces": [ diff --git a/package.json b/package.json index d7f4eac..5431bfb 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "devDependencies": { "@fui/babel-preset-fineui": "^1.0.0", "@types/jest": "24.0.11", - "@typescript-eslint/eslint-plugin": "1.7.0", - "@typescript-eslint/parser": "1.7.0", + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", "axios": "0.18.0", "babel-loader": "8.0.6", "body-parser": "1.18.3", diff --git a/src/modules/components/file_chooser/file_chooser.model.ts b/src/modules/components/file_chooser/file_chooser.model.ts new file mode 100644 index 0000000..4850d0c --- /dev/null +++ b/src/modules/components/file_chooser/file_chooser.model.ts @@ -0,0 +1,68 @@ +import { model, Model } from '@core/core'; + +type RootInfo = { + url: string; // api url + prefix: string; // 路径前缀 + root: string; // 根文件夹名称 +}; + +export const ROOT_INFO_MAP: Record = { + // 证书 resources/certificates/ + certificates: { + url: '/v10/certificates/all', + prefix: 'resources/', + root: 'certificates', + }, +}; + +@model() +export class FileChooserModel extends Model { + static xtype = 'dec.dcm.model.components.file_chooser'; + + private options: { + root: string; + }; + + state() { + return { + keyword: '', // 搜索关键字 + items: [], // 文件项 + }; + } + + actions = { + /** + * 请求获取items + * @param callback 回调 + */ + requestGetItems: (callback?: Function) => { + const { keyword } = this.model; + const { url, prefix, root } = ROOT_INFO_MAP[this.options.root]; + const requestUrl = `${url}?keyword=${encodeURIComponent(keyword)}`; + Dec.reqGetHandle(requestUrl, '', (data) => { + this.model.items = data + .concat({ + id: root, + text: root, + value: prefix + root, + }) + .map((item) => ({ + ...item, + text: item.id, + value: prefix + item.path, + open: item.id === root || BI.isKey(keyword), + })); + BI.isFunction(callback) && callback(); + }); + }, + + /** + * 设置keyword + * @param value + */ + setKeyword: (value: string) => { + this.model.keyword = value; + this.requestGetItems(); + }, + }; +} diff --git a/src/modules/components/file_chooser/file_chooser.ts b/src/modules/components/file_chooser/file_chooser.ts new file mode 100644 index 0000000..53200f7 --- /dev/null +++ b/src/modules/components/file_chooser/file_chooser.ts @@ -0,0 +1,182 @@ +import { EVENT_CHANGE } from './../collapse/collapse'; +import { shortcut, store } from '@core/core'; +import { SignEditor, MultiLayerSingleLevelTree, SearchEditor, Button, Editor } from '@fui/core'; +import { FileChooserModel } from './file_chooser.model'; + +@shortcut() +@store(FileChooserModel, { + props(this: FileChooser) { + return this.options; + }, +}) +export class FileChooser extends BI.Widget { + static xtype = 'dec.dcm.components.file_chooser'; + + props = { + width: 300, + root: '', // 含义见model中的RootInfo + watermark: '', + value: '', + }; + + model: FileChooserModel['model']; + store: FileChooserModel['store']; + watch = { + items: (value) => { + this.fileTree.populate(value); + }, + }; + + textEditor: SignEditor; + keywordEditor: SearchEditor; + fileTree: MultiLayerSingleLevelTree; + sureButton: Button; + + render() { + const { width, watermark, value } = this.options; + + return { + type: BI.VerticalAdaptLayout.xtype, + height: 20, + items: [ + { + type: BI.SignEditor.xtype, + cls: 'bi-border bi-focus-shadow', + width, + watermark, + title: value, + value, + ref: (_ref: SignEditor) => { + this.textEditor = _ref; + }, + listeners: [ + { + eventName: BI.SignEditor.EVENT_CHANGE, + action: () => { + const value = this.textEditor.getValue(); + this.setValue(value); + }, + }, + ], + }, + { + el: { + type: BI.Button.xtype, + + text: BI.i18nText('Dec-Basic_Choose_File'), + clear: true, + handler: () => { + this.openFileChoosePopover(); + }, + }, + lgap: 10, + }, + ], + }; + } + + getValue(): string { + return this.textEditor.getValue(); + } + + setValue(value: string) { + this.options.value = value; + this.textEditor.text.setTitle(value); + this.textEditor.setValue(value); + } + + /** + * 打开文件选择弹窗 + */ + private openFileChoosePopover() { + // 重置搜索关键词 + this.store.setKeyword(''); + // 创建并显示窗口 + const popoverName = BI.UUID(); + BI.Popovers.create( + popoverName, + { + header: BI.i18nText('Dec-Data_Set_File_Select_Server_File'), + body: { + type: BI.VTapeLayout.xtype, + items: [ + { + type: BI.SearchEditor.xtype, + ref: (ref: SearchEditor) => { + this.keywordEditor = ref; + }, + height: 24, + value: this.model.keyword, + listeners: [ + { + eventName: BI.SearchEditor.EVENT_CHANGE, + action: () => { + const value = this.keywordEditor.getValue(); + this.store.setKeyword(value); + }, + }, + { + eventName: BI.SearchEditor.EVENT_CLEAR, + action: () => { + this.store.setKeyword(''); + }, + }, + ], + }, + { + el: { + type: BI.MultiLayerSingleLevelTree.xtype, + ref: (ref: MultiLayerSingleLevelTree) => { + this.fileTree = ref; + }, + keywordGetter: () => this.model.keyword, + items: this.model.items, + listeners: [ + { + eventName: BI.MultiLayerSingleLevelTree.EVENT_CHANGE, + action: () => { + this.sureButton.setEnable(true); + }, + }, + ], + }, + tgap: 15, + }, + { + type: BI.RightVerticalAdaptLayout.xtype, + height: 24, + vgap: 10, + items: [ + { + type: BI.Button.xtype, + text: BI.i18nText('BI-Basic_Cancel'), + level: 'ignore', + handler: () => { + BI.Popovers.remove(popoverName); + }, + }, + { + el: { + type: BI.Button.xtype, + ref: (ref: Button) => { + this.sureButton = ref; + }, + text: BI.i18nText('BI-Basic_OK'), + disabled: true, + handler: () => { + const value = this.fileTree.getValue()[0]; + this.setValue(value); + BI.Popovers.remove(popoverName); + }, + }, + lgap: 10, + }, + ], + }, + ], + }, + }, + this + ).show(popoverName); + } +} diff --git a/src/modules/components/text_checker/text_checker.ts b/src/modules/components/text_checker/text_checker.ts index c7984c0..339e1c2 100644 --- a/src/modules/components/text_checker/text_checker.ts +++ b/src/modules/components/text_checker/text_checker.ts @@ -3,87 +3,97 @@ import { Label, TextEditor } from '@fui/core'; @shortcut() export class TextChecker extends BI.Widget { - static xtype = 'dec.dcm.components.text_checker'; + public static xtype = 'dec.dcm.components.text_checker'; - props = { + public props = { width: 300, allowBlank: true, value: '', watermark: '', + inputType: 'text', + autocomplete: '', validationChecker: [] as { errorText: string; checker: (value: string) => boolean; autoFix?: boolean; }[], $value: '', - } + }; - textEditor: TextEditor; - errorLabel: Label; + public textEditor: TextEditor; + public errorLabel: Label; private isError: boolean; private value: string; private errorChecker: { errorText: string; checker: (value: string) => boolean; autoFix?: boolean; - } + }; - render() { - const { width, allowBlank, value, watermark, validationChecker, $value } = this.options; + public render() { + const { width, allowBlank, value, watermark, inputType, autocomplete, validationChecker, $value } = this.options; this.value = value; - + return { type: BI.AbsoluteLayout.xtype, width, height: 20, - items: [{ - el: { - type: BI.TextEditor.xtype, - $value, - width, - allowBlank, - value, - watermark, - ref: (_ref: TextEditor) => { - this.textEditor = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - const value = this.getValue(); - if (value) { - this.errorChecker = validationChecker.find(item => item.checker && !item.checker(value)); - this.errorLabel.setText(BI.get(this.errorChecker, 'errorText')); - this.isError = !!BI.get(this.errorChecker, 'errorText'); - } else { - this.errorLabel.setText(''); - this.isError = false; - } - if (!this.isError) { - this.value = value; - } - this.fireEvent(BI.Editor.EVENT_CHANGE); - }, - }, { - eventName: BI.TextEditor.EVENT_BLUR, - action: () => { - if (BI.get(this.errorChecker, 'autoFix')) { - this.setValue(this.value); - this.errorLabel.setText(''); - } + items: [ + { + el: { + type: BI.TextEditor.xtype, + $value, + width, + allowBlank, + value, + watermark, + inputType, + autocomplete, + ref: (_ref: TextEditor) => { + this.textEditor = _ref; }, - }], + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + const value = this.getValue(); + if (value) { + this.errorChecker = validationChecker.find((item) => item.checker && !item.checker(value)); + this.errorLabel.setText(BI.get(this.errorChecker, 'errorText')); + this.isError = !!BI.get(this.errorChecker, 'errorText'); + } else { + this.errorLabel.setText(''); + this.isError = false; + } + if (!this.isError) { + this.value = value; + } + this.fireEvent(BI.Editor.EVENT_CHANGE); + }, + }, + { + eventName: BI.TextEditor.EVENT_BLUR, + action: () => { + if (BI.get(this.errorChecker, 'autoFix')) { + this.setValue(this.value); + this.errorLabel.setText(''); + } + }, + }, + ], + }, }, - }, { - el: { - type: BI.Label.xtype, - cls: 'bi-error', - ref: (_ref: Label) => { - this.errorLabel = _ref; + { + el: { + type: BI.Label.xtype, + cls: 'bi-error', + ref: (_ref: Label) => { + this.errorLabel = _ref; + }, }, + top: -15, }, - top: -15, - }], + ], }; } @@ -98,4 +108,8 @@ export class TextChecker extends BI.Widget { public setError(value: string) { this.errorLabel.setText(value); } + + public setWatermark(value: string) { + this.textEditor.setWaterMark(value); + } } diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 37da373..4fabf64 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -734,6 +734,28 @@ export const CONNECT_CHARSET = [ }, ]; +export const CONNECT_SSH_TYPE = [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + value: 'NORMAL', + privateKeyPathFormVisible: false, + secretFormName: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + }, + { + text: BI.i18nText('Dec-Dcm_Connection_Form_PublicKey'), + value: 'KEY', + privateKeyPathFormVisible: true, + secretFormName: BI.i18nText('Dec-Dcm_Connection_Form_Passphrase'), + }, +]; + +export const CONNECT_SSL_TYPE = [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + value: 'NORMAL', + }, +]; + export const TEST_STATUS = { LOADING: 'loading', SUCCESS: 'success', diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 9f0f69f..43d6dee 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -1,3 +1,7 @@ +export interface CrudParams { + [key: string]: string | number | { [key: string]: any }; +} + export interface CrudReqOpts { url?: string; type?: 'GET' | 'POST' | 'DELETE' | 'PUT'; @@ -9,28 +13,104 @@ export interface CrudReqOpts { params?: CrudParams; } -export interface CrudParams { - [key: string]: string | number | { [key: string]: any }; +export interface ConnectionLicInfo { + currentConnectionNum: number; + maxConnectionNum: number; } -export interface Connection { - connectionId: string; - connectionType: string; - connectionName: string; - creator?: string; - connectionData: ConnectionJDBC | ConnectionJNDI | ConnectionPlugin | string; - privilegeDetailBeanList?: { - privilegeType: number; - privilegeValue: number; - }[]; +export interface ConnectionPoolType { + maxActive: number; + maxIdle: number; + numActive: number; + numIdle: number; } -export interface ConnectionLicInfo { - currentConnectionNum: number; - maxConnectionNum: number; +type ConnectionDataOfSSH = { + usingSsh: boolean; // 使用SSH通道 + sshIp: string; // 主机 + sshPort: number; // 端口 + sshUser: string; // 用户名 + redirectPort: number; + redirectIp: string; + sshTimeOut: number; + sshKeepAlive: number; +} & ( + | { + sshType: 'NORMAL'; // 验证方法:密码 + sshPrivateKeyPath: ''; // 没啥意义,该验证方法下为空字符串 + sshSecret: string; // 密码 + } + | { + sshType: 'KEY'; // 验证方法:公钥 + sshPrivateKeyPath: string; // 私钥 + sshSecret: string; // 密码短语 + } +); + +type ConnectionDataOfSSL = { + usingSsl: boolean; // 使用SSL通道 + sslType: 'NORMAL'; // SSL类型,只有NORMAL一种 + caCertificate: string; // CA证书 + verifyCa: boolean; // 验证针对CA的服务器证书 + sslClientPrivateKey: string; // 客户端密钥 + sslClientCertificate: string; // 客户端证书 +}; + +export interface ConnectionPoolJDBC { + /** + * 初始化连接数量 + */ + initialSize?: number; + /** + * 最大连接数 + */ + maxActive?: number; + /** + * 最大空闲数 + */ + maxIdle?: number; + /** + * 最小空闲数 + */ + minIdle?: number; + /** + * 最大等待时间 + */ + maxWait?: number; + /** + * sql查询 + */ + validationQuery?: string; + + /** + * 连接前校验 + */ + testOnBorrow?: boolean; + + /** + * 归还前校验 + */ + testOnReturn?: boolean; + + /** + * 空闲校验 + */ + testWhileIdle?: boolean; + /** + * 在空闲连接回收器线程运行期间休眠的时间值,毫秒。 + */ + timeBetweenEvictionRunsMillis?: number; + /** + * 每次空闲连接回收器现成运行时检查的连接数量 + */ + numTestsPerEvictionRun?: number; + /** + * 连接在池中保持空闲而不被空闲连接回收器回收的最小时间,单位毫秒 + */ + minEvictableIdleTimeMillis?: number; } -export interface ConnectionJDBC { +export type ConnectionJDBC ={ /** * 数据库名称 */ @@ -44,6 +124,10 @@ export interface ConnectionJDBC { * 驱动 */ driver: string; + /** + * 驱动来源 + */ + driverSource: 'default' | 'custom'; /** * 数据库连接url */ @@ -118,72 +202,8 @@ export interface ConnectionJDBC { identity?: string; connectionPoolAttr: ConnectionPoolJDBC; -} - -export interface ConnectionPoolJDBC { - /** - * 初始化连接数量 - */ - initialSize?: number; - /** - * 最大连接数 - */ - maxActive?: number; - /** - * 最大空闲数 - */ - maxIdle?: number; - /** - * 最小空闲数 - */ - minIdle?: number; - /** - * 最大等待时间 - */ - maxWait?: number; - /** - * sql查询 - */ - validationQuery?: string; - - /** - * 连接前校验 - */ - testOnBorrow?: boolean; - - /** - * 归还前校验 - */ - testOnReturn?: boolean; - - /** - * 空闲校验 - */ - testWhileIdle?: boolean; - /** - * 在空闲连接回收器线程运行期间休眠的时间值,毫秒。 - */ - timeBetweenEvictionRunsMillis?: number; - /** - * 每次空闲连接回收器现成运行时检查的连接数量 - */ - numTestsPerEvictionRun?: number; - /** - * 连接在池中保持空闲而不被空闲连接回收器回收的最小时间,单位毫秒 - */ - minEvictableIdleTimeMillis?: number; -} - -export interface ConnectionJNDI { - jndiName: string; - /** - * 编码 - */ - originalCharsetName: string; - newCharsetName: string; - creator?: string; - contextHashtable: ContextHashtable; -} +}& ConnectionDataOfSSH & +ConnectionDataOfSSL export interface ContextHashtable { 'java.naming.factory.initial': string; @@ -203,25 +223,41 @@ export interface ContextHashtable { 'java.naming.applet': string; } +export interface ConnectionJNDI { + jndiName: string; + /** + * 编码 + */ + originalCharsetName: string; + newCharsetName: string; + creator?: string; + contextHashtable: ContextHashtable; +} + export interface ConnectionPlugin { pluginType: 'json'; creator: ''; pluginData: any; } +export interface Connection { + connectionId: string; + connectionType: string; + connectionName: string; + creator?: string; + connectionData: ConnectionJDBC | ConnectionJNDI | ConnectionPlugin | string; + privilegeDetailBeanList?: { + privilegeType: number; + privilegeValue: number; + }[]; +} + export interface TestRequest { data?: string[]; errorCode?: string; errorMsg?: string; } -export interface ConnectionPoolType { - maxActive: number; - maxIdle: number; - numActive: number; - numIdle: number; -} - export interface SocketResult { data?: string; errorCode?: string; diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index a65d97b..d4e37dd 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -4,7 +4,7 @@ import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse import { ConnectionJdecModel } from './connection_jdbc.model'; import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo } from '../../../app.service'; -import { CONNECTION_LAYOUT } from '@constants/constant'; +import { CONNECTION_LAYOUT, CONNECT_SSH_TYPE } from '@constants/constant'; import { VerticalLayout } from '@fui/core'; import { ApiFactory } from '../../../crud/apiFactory'; @@ -15,10 +15,13 @@ const api = new ApiFactory().create(); export class ConnectionJdbc extends BI.Widget { static xtype = 'dec.dcm.connection_jdbc'; - advancedSet: any; model: ConnectionJdecModel['model']; allDatabaseTypes = getAllDatabaseTypes(); + sshSet: VerticalLayout; + sslSet: VerticalLayout; + advancedSet: VerticalLayout; + render() { const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; const { @@ -33,6 +36,20 @@ export class ConnectionJdbc extends BI.Widget { principal, url, fetchSize, + // ssh + usingSsh, + sshIp, + sshPort, + sshUser, + sshType, + sshSecret, + sshPrivateKeyPath, + // ssl + usingSsl, + caCertificate, + verifyCa, + sslClientPrivateKey, + sslClientCertificate, } = connectionData; const databaseType = getJdbcDatabaseType(database, driver); const { host, port, databaseName } = resolveUrlInfo(url, database); @@ -63,14 +80,15 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), value: port, }, - authType ? - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), - value: authType, - } : { - type: BI.Layout.xtype, - }, + authType + ? { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), + value: authType, + } + : { + type: BI.Layout.xtype, + }, { type: FormItem.xtype, name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), @@ -118,9 +136,114 @@ export class ConnectionJdbc extends BI.Widget { value: connectionPoolAttr.maxWait, unit: BI.i18nText('Dec-Dcm_Millisecond'), }, + // ssh设置 + { + type: Collapse.xtype, + width: 100, + invisible: !usingSsh, + name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSH'), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.sshSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + tgap: -15, + vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.sshSet = _ref; + }, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + value: sshIp, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + value: sshPort, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + value: sshUser, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), + value: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).text, + }, + { + type: FormItem.xtype, + invisible: sshType !== 'KEY', + name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), + value: sshPrivateKeyPath, + }, + { + type: FormItem.xtype, + name: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).secretFormName, + value: sshSecret, + }, + ], + }, + // ssl设置 { type: Collapse.xtype, - width: 70, + width: 100, + invisible: !usingSsl, + name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSL'), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.sslSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + tgap: -15, + vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.sslSet = _ref; + }, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), + value: caCertificate, + }, + { + type: FormItem.xtype, + invisible: !caCertificate, + name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), + value: verifyCa ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), + value: sslClientPrivateKey, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), + value: sslClientCertificate, + }, + ], + }, + // 更多设置 + { + type: Collapse.xtype, + width: 100, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'), listeners: [ { @@ -176,7 +299,8 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), value: connectionPoolAttr.minEvictableIdleTimeMillis, unit: BI.i18nText('BI-Basic_Seconds'), - }, { + }, + { type: FormItem.xtype, invisible: fetchSize < 0 && fetchSize !== -2, name: 'Fetchsize', diff --git a/src/modules/pages/maintain/components/form_item/form_item.ts b/src/modules/pages/maintain/components/form_item/form_item.ts index 00b6f1a..a0d54eb 100644 --- a/src/modules/pages/maintain/components/form_item/form_item.ts +++ b/src/modules/pages/maintain/components/form_item/form_item.ts @@ -1,4 +1,5 @@ import { shortcut } from '@core/core'; +import { Label } from '@fui/core'; import { CONNECTION_LAYOUT } from '@constants/constant'; @shortcut() @@ -11,14 +12,19 @@ export class FormItem extends BI.Widget { nameWidth: 140, isBold: true, $testId: 'dec-dcm-maintain-form-item', - } + }; + + nameLabel: Label; - render () { + render() { return { type: BI.FloatLeftLayout.xtype, items: [ { type: BI.Label.xtype, + ref: (ref: Label) => { + this.nameLabel = ref; + }, cls: this.options.isBold ? 'bi-font-bold' : '', width: this.options.nameWidth, textAlign: 'left', @@ -29,4 +35,12 @@ export class FormItem extends BI.Widget { ], }; } + + /** + * 设置表单名称 + * @param name + */ + setName(name: string) { + this.nameLabel.setText(name); + } } diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index b432d04..ffdbb1d 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -3,19 +3,13 @@ import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse import { FormItem } 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, INT_MAX_VALUE, INT_MIN_VALUE } from '@constants/constant'; +import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE, CONNECT_SSH_TYPE, CONNECT_SSL_TYPE } from '@constants/constant'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; +import { DatabaseType } from 'src/modules/app.typings'; import { TextChecker } from '../../../../components/text_checker/text_checker'; +import { FileChooser } from '../../../../components/file_chooser/file_chooser'; import { ApiFactory } from 'src/modules/crud/apiFactory'; -import { - Editor, - EditorIconCheckCombo, - Label, - TextAreaEditor, - TextEditor, - TextValueCombo, - VerticalLayout, -} from '@fui/core'; +import { Editor, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout, MultiSelectItem } from '@fui/core'; import { DriverSelector } from '../../components/driverselector/driverselector'; const api = new ApiFactory().create(); @@ -29,8 +23,15 @@ export class FormJdbc extends BI.Widget { }; oldPassword = ''; + oldSshSecret = ''; + + databaseType: DatabaseType; allDatabaseTypes = getAllDatabaseTypes(); + sshSet: VerticalLayout; + sshForm: VerticalLayout; + sslSet: VerticalLayout; + sslForm: VerticalLayout; advancedSet: VerticalLayout; formUser: FormItem; formPassword: FormItem; @@ -55,6 +56,23 @@ export class FormJdbc extends BI.Widget { initialSize: null, maxActive: null, maxWait: null, + // ssh + usingSsh: null, + sshIp: null, + sshPort: null, + sshUser: null, + sshType: null, + sshPrivateKeyPathForm: null, + sshPrivateKeyPath: null, + sshSecretForm: null, + sshSecret: null, + // ssl + usingSsl: null, + caCertificate: null, + verifyCa: null, + sslClientPrivateKey: null, + sslClientCertificate: null, + // more validationQuery: null, testOnBorrow: null, testOnReturn: null, @@ -82,7 +100,24 @@ export class FormJdbc extends BI.Widget { principal, keyPath, fetchSize, + // ssh + usingSsh = false, + sshIp, // sshIp默认值在表单那用||设置,因为在这可能是空字符串,解构默认值没用 + sshPort = 22, + sshUser = '', + sshType = CONNECT_SSH_TYPE[0].value, + sshPrivateKeyPath = '', + sshSecret = '', + // ssl + usingSsl = false, + caCertificate = '', + verifyCa = false, + sslClientPrivateKey = '', + sslClientCertificate = '', } = connectionData as ConnectionJDBC; + this.oldPassword = password; + this.oldSshSecret = sshSecret; + const { initialSize, maxActive, @@ -97,7 +132,8 @@ export class FormJdbc extends BI.Widget { minEvictableIdleTimeMillis, } = connectionPoolAttr as ConnectionPoolJDBC; const databaseType = getJdbcDatabaseType(database, driver); - this.oldPassword = password; + this.databaseType = databaseType; + const { host, port, databaseName } = resolveUrlInfo(url, database); const { hgap, vgap } = CONNECTION_LAYOUT; @@ -112,21 +148,25 @@ export class FormJdbc extends BI.Widget { hgap, vgap, items: [ + // 数据连接名称 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Name'), - forms: [{ - type: TextChecker.xtype, - $value: 'connection-name', - width: 300, - value: connectionName, - allowBlank: true, - ref: (_ref: TextChecker) => { - this.form.connectionName = _ref; - }, - watermark: BI.i18nText('Dec-Dcm_Data_Connections'), - }], + forms: [ + { + type: TextChecker.xtype, + $value: 'connection-name', + width: 300, + value: connectionName, + allowBlank: true, + ref: (_ref: TextChecker) => { + this.form.connectionName = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Data_Connections'), + }, + ], }, + // 驱动 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), @@ -159,111 +199,133 @@ export class FormJdbc extends BI.Widget { }, ], }, + // 数据库名称 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - forms: [{ - type: BI.TextEditor.xtype, - $value: 'database-name', - width: 300, - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), - value: databaseName, - ref: (_ref: any) => { - this.form.database = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - this.onHostPortChange(databaseType); + forms: [ + { + type: BI.TextEditor.xtype, + $value: 'database-name', + width: 300, + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), + value: databaseName, + ref: (_ref: any) => { + this.form.database = _ref; }, - }], - }], + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.onHostPortChange(databaseType); + }, + }, + ], + }, + ], }, + // 主机 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - forms: [{ - type: BI.TextEditor.xtype, - $value: 'database-host', - width: 300, - allowBlank: true, - value: host, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - ref: (_ref: any) => { - this.form.host = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - this.onHostPortChange(databaseType); + forms: [ + { + type: BI.TextEditor.xtype, + $value: 'database-host', + width: 300, + allowBlank: true, + value: host, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + ref: (_ref: any) => { + this.form.host = _ref; }, - }], - }], + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.onHostPortChange(databaseType); + }, + }, + ], + }, + ], }, + // 端口 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - forms: [{ - type: TextChecker.xtype, - $value: 'database-port', - width: 300, - allowBlank: true, - value: port, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.port = _ref; - }, - listeners: [{ - eventName: BI.Editor.EVENT_CHANGE, - action: () => { - this.onHostPortChange(databaseType); + forms: [ + { + type: TextChecker.xtype, + $value: 'database-port', + width: 300, + allowBlank: true, + value: port, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.port = _ref; }, - }], - }], + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.onHostPortChange(databaseType); + }, + }, + ], + }, + ], }, + // 认证方式 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), invisible: !databaseType.kerberos, - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'auth-type', - width: 300, - value: authType, - ref: (_ref: TextValueCombo) => { - this.form.authType = _ref; - }, - items: [ - { - text: BI.i18nText('Dec-Dcm_Connection_Form_UserName_Password'), - value: '', - }, - { - text: 'Kerberos', - value: 'kerberos', + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'auth-type', + width: 300, + value: authType, + ref: (_ref: TextValueCombo) => { + this.form.authType = _ref; }, - ], - listeners: [ - { - eventName: BI.Combo.EVENT_CHANGE, - action: () => { - const type = this.form.authType.getValue()[0]; - this.formPrincipal.setVisible(!!type); - this.formKeyPath.setVisible(!!type); - this.formUser.setVisible(!type); - this.formPassword.setVisible(!type); - this.labelTips.setVisible(!!type); + items: [ + { + text: BI.i18nText('Dec-Dcm_Connection_Form_UserName_Password'), + value: '', }, - }, - ], - }], + { + text: 'Kerberos', + value: 'kerberos', + }, + ], + listeners: [ + { + eventName: BI.Combo.EVENT_CHANGE, + action: () => { + const type = this.form.authType.getValue()[0]; + this.formPrincipal.setVisible(!!type); + this.formKeyPath.setVisible(!!type); + this.formUser.setVisible(!type); + this.formPassword.setVisible(!type); + this.labelTips.setVisible(!!type); + }, + }, + ], + }, + ], }, + // 用户名 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), @@ -271,18 +333,21 @@ export class FormJdbc extends BI.Widget { ref: (_ref: FormItem) => { this.formUser = _ref; }, - forms: [{ - type: BI.TextEditor.xtype, - $value: 'username', - width: 300, - allowBlank: true, - value: user, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - ref: (_ref: TextEditor) => { - this.form.user = _ref; - }, - }], + forms: [ + { + type: BI.TextEditor.xtype, + $value: 'username', + width: 300, + allowBlank: true, + value: user, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + ref: (_ref: TextEditor) => { + this.form.user = _ref; + }, + }, + ], }, + // 密码 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Password'), @@ -290,22 +355,25 @@ export class FormJdbc extends BI.Widget { ref: (_ref: FormItem) => { this.formPassword = _ref; }, - forms: [{ - type: BI.Editor.xtype, - $value: 'password', - cls: 'bi-border bi-border-radius', - width: 300, - height: 20, - allowBlank: true, - value: password, - inputType: 'password', - autocomplete: 'new-password', - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'), - ref: (_ref: Editor) => { - this.form.password = _ref; - }, - }], + forms: [ + { + type: BI.Editor.xtype, + $value: 'password', + cls: 'bi-border bi-border-radius', + width: 300, + height: 20, + allowBlank: true, + value: password, + inputType: 'password', + autocomplete: 'new-password', + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Password'), + ref: (_ref: Editor) => { + this.form.password = _ref; + }, + }, + ], }, + // 客户端principal { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), @@ -313,18 +381,21 @@ export class FormJdbc extends BI.Widget { ref: (_ref: FormItem) => { this.formPrincipal = _ref; }, - forms: [{ - type: BI.TextEditor.xtype, - $value: 'principal', - width: 300, - allowBlank: true, - value: principal, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), - ref: (_ref: TextEditor) => { - this.form.principal = _ref; - }, - }], + forms: [ + { + type: BI.TextEditor.xtype, + $value: 'principal', + width: 300, + allowBlank: true, + value: principal, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), + ref: (_ref: TextEditor) => { + this.form.principal = _ref; + }, + }, + ], }, + // keytab密钥路径 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), @@ -332,20 +403,23 @@ export class FormJdbc extends BI.Widget { ref: (_ref: FormItem) => { this.formKeyPath = _ref; }, - forms: [{ - type: BI.Editor.xtype, - $value: 'key-path', - cls: 'bi-border', - width: 300, - height: 20, - allowBlank: true, - value: keyPath, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), - ref: (_ref: Editor) => { - this.form.keyPath = _ref; - }, - }], + forms: [ + { + type: BI.Editor.xtype, + $value: 'key-path', + cls: 'bi-border', + width: 300, + height: 20, + allowBlank: true, + value: keyPath, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + ref: (_ref: Editor) => { + this.form.keyPath = _ref; + }, + }, + ], }, + // 关于krb5的提示 { type: BI.Label.xtype, cls: 'bi-tips', @@ -356,138 +430,169 @@ export class FormJdbc extends BI.Widget { this.labelTips = _ref; }, }, + // 编码 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'original-charset-name', - width: 300, - value: originalCharsetName ? originalCharsetName : '', - items: CONNECT_CHARSET, - ref: (_ref: TextValueCombo) => { - this.form.originalCharsetName = _ref; - }, - }], + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'original-charset-name', + width: 300, + value: originalCharsetName ? originalCharsetName : '', + items: CONNECT_CHARSET, + ref: (_ref: TextValueCombo) => { + this.form.originalCharsetName = _ref; + }, + }, + ], }, + // 模式 { type: FormItem.xtype, invisible: !databaseType.hasSchema, height: 64, name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), - forms: [{ - type: BI.VerticalLayout.xtype, - items: [{ - type: BI.FloatLeftLayout.xtype, - items: [{ - type: BI.TextButton.xtype, - cls: 'bi-high-light', - text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'), - handler: () => { - this.fireEvent('EVENT_TEST_CONNECTION'); - }, - }, { - type: BI.Label.xtype, - cls: 'bi-tips', - lgap: 3, - text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'), - }], - }, { - type: BI.TextValueCombo.xtype, - $value: 'schema', - width: 300, - vgap: 15, - disabled: true, - value: schema, - items: schema ? [{ text: schema, value: schema }] : [], - ref: (_ref: TextValueCombo) => { - this.form.schema = _ref; - }, - }], - }], + forms: [ + { + type: BI.VerticalLayout.xtype, + items: [ + { + type: BI.FloatLeftLayout.xtype, + items: [ + { + type: BI.TextButton.xtype, + cls: 'bi-high-light', + text: BI.i18nText('Dec-Dcm_Connection_Click_Connect_Database'), + handler: () => { + this.fireEvent('EVENT_TEST_CONNECTION'); + }, + }, + { + type: BI.Label.xtype, + cls: 'bi-tips', + lgap: 3, + text: BI.i18nText('Dec-Dcm_Connection_Read_Mode_List'), + }, + ], + }, + { + type: BI.TextValueCombo.xtype, + $value: 'schema', + width: 300, + vgap: 15, + disabled: true, + value: schema, + items: schema ? [{ text: schema, value: schema }] : [], + ref: (_ref: TextValueCombo) => { + this.form.schema = _ref; + }, + }, + ], + }, + ], }, + // 分隔线 { type: BI.Layout.xtype, cls: 'bi-border-top', bgap: 8, }, + // 数据连接URL { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), - forms: [{ - type: BI.TextEditor.xtype, - $value: 'database-url', - width: 300, - allowBlank: true, - value: url, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), - ref: (_ref: TextEditor) => { - this.form.url = _ref; - }, - listeners: [{ - eventName: 'EVENT_CHANGE', - action: () => { - const urlInfo = resolveUrlInfo(this.form.url.getValue(), database); - this.form.host.setValue(urlInfo.host); - this.form.database.setValue(urlInfo.databaseName); - this.form.port.setValue(urlInfo.port); + forms: [ + { + type: BI.TextEditor.xtype, + $value: 'database-url', + width: 300, + allowBlank: true, + value: url, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), + ref: (_ref: TextEditor) => { + this.form.url = _ref; }, - }], - }], + listeners: [ + { + eventName: 'EVENT_CHANGE', + action: () => { + const urlInfo = resolveUrlInfo(this.form.url.getValue(), database); + this.form.host.setValue(urlInfo.host); + this.form.database.setValue(urlInfo.databaseName); + this.form.port.setValue(urlInfo.port); + }, + }, + ], + }, + ], }, + // 最大活动连接数 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), - forms: [{ - type: TextChecker.xtype, - $value: 'max-active', - width: 300, - allowBlank: false, - value: maxActive, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.maxActive = _ref; - }, - }], + forms: [ + { + type: TextChecker.xtype, + $value: 'max-active', + width: 300, + allowBlank: false, + value: maxActive, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.maxActive = _ref; + }, + }, + ], }, + // 获取连接前检验 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'check', - width: 300, - allowBlank: true, - value: testOnBorrow, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), - ref: (_ref: TextValueCombo) => { - this.form.testOnBorrow = _ref; - }, - }], + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'check', + width: 300, + allowBlank: true, + value: testOnBorrow, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), + ref: (_ref: TextValueCombo) => { + this.form.testOnBorrow = _ref; + }, + }, + ], }, + // 校验语句 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), - forms: [{ - type: BI.TextAreaEditor.xtype, - $value: 'validation-query', - cls: 'bi-border', - allowBlank: true, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query_Watermark'), - value: api.getPlain(validationQuery || ''), - width: 300, - height: 100, - ref: (_ref: TextAreaEditor) => { - this.form.validationQuery = _ref; - }, - }], + forms: [ + { + type: BI.TextAreaEditor.xtype, + $value: 'validation-query', + cls: 'bi-border', + allowBlank: true, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query_Watermark'), + value: api.getPlain(validationQuery || ''), + width: 300, + height: 100, + ref: (_ref: TextAreaEditor) => { + this.form.validationQuery = _ref; + }, + }, + ], }, + // 最大等待时间 { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), @@ -499,11 +604,14 @@ export class FormJdbc extends BI.Widget { allowBlank: false, value: maxWait, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], ref: (_ref: TextChecker) => { this.form.maxWait = _ref; }, @@ -516,10 +624,303 @@ export class FormJdbc extends BI.Widget { }, ], }, + // SSH设置 + { + type: Collapse.xtype, + width: 100, + name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSH'), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.sshSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sshSet = _ref; + }, + invisible: true, + items: [ + { + type: FormItem.xtype, + bgap: -15, + name: BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSH'), + forms: [ + { + type: BI.MultiSelectItem.xtype, + ref: (_ref: MultiSelectItem) => { + this.form.usingSsh = _ref; + }, + logic: { dynamic: true }, + text: BI.i18nText('Dec-Basic_Use') + BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSH'), + selected: usingSsh, + listeners: [ + { + eventName: BI.MultiSelectItem.EVENT_CHANGE, + action: () => { + const value = this.form.usingSsh.isSelected(); + this.sshForm.setVisible(value); + }, + }, + ], + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sshForm = _ref; + }, + vgap, + invisible: !usingSsh, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshIp = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + allowBlank: false, + value: sshIp || 'hostname', + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshPort = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + allowBlank: false, + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + value: String(sshPort || 22), + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshUser = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + value: sshUser, + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), + forms: [ + { + type: BI.TextValueCombo.xtype, + ref: (_ref: TextValueCombo) => { + this.form.sshType = _ref; + }, + width: 300, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), + items: CONNECT_SSH_TYPE, + value: sshType, + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: () => { + const sshType = this.form.sshType.getValue()[0]; + this.onSshTypeChange(sshType); + }, + }, + ], + }, + ], + }, + { + type: FormItem.xtype, + ref: (_ref: FormItem) => { + this.form.sshPrivateKeyPathForm = _ref; + }, + name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: TextChecker) => { + this.form.sshPrivateKeyPath = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), + value: sshPrivateKeyPath, + }, + ], + }, + { + type: FormItem.xtype, + ref: (ref: FormItem) => { + this.form.sshSecretForm = ref; + }, + name: BI.i18nText(''), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshSecret = _ref; + }, + watermark: BI.i18nText(''), + inputType: 'password', + autocomplete: 'new-password', + value: sshSecret, + }, + ], + }, + ], + }, + ], + }, + // SSL设置 + { + type: Collapse.xtype, + width: 100, + name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSL'), + invisible: !this.getSslSetEnabled(), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.sslSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sslSet = _ref; + }, + invisible: true, + items: [ + { + type: FormItem.xtype, + bgap: -15, + name: BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSL'), + forms: [ + { + type: BI.MultiSelectItem.xtype, + ref: (_ref: MultiSelectItem) => { + this.form.usingSsl = _ref; + }, + logic: { dynamic: true }, + text: BI.i18nText('Dec-Basic_Use') + BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSL'), + selected: usingSsl, + listeners: [ + { + eventName: BI.MultiSelectItem.EVENT_CHANGE, + action: () => { + const value = this.form.usingSsl.isSelected(); + this.sslForm.setVisible(value); + }, + }, + ], + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sslForm = _ref; + }, + vgap, + invisible: !usingSsl, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: FileChooser) => { + this.form.caCertificate = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), + value: caCertificate, + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), + forms: [ + { + type: BI.TextValueCombo.xtype, + ref: (_ref: TextValueCombo) => { + this.form.verifyCa = _ref; + }, + width: 300, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), + items: this.getBooleanItem(), + value: verifyCa, + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: FileChooser) => { + this.form.sslClientPrivateKey = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), + value: sslClientPrivateKey, + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: FileChooser) => { + this.form.sslClientCertificate = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), + value: sslClientCertificate, + }, + ], + }, + ], + }, + ], + }, + // 高级设置 { type: Collapse.xtype, bgap: -15, - width: 70, + width: 100, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'), listeners: [ { @@ -543,74 +944,88 @@ export class FormJdbc extends BI.Widget { type: FormItem.xtype, tgap: 15, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - forms: [{ - type: TextChecker.xtype, - $value: 'initial-size', - width: 300, - allowBlank: false, - value: initialSize, - validationChecker: [{ - 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: TextChecker) => { - this.form.initialSize = _ref; + forms: [ + { + type: TextChecker.xtype, + $value: 'initial-size', + width: 300, + allowBlank: false, + value: initialSize, + validationChecker: [ + { + 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: TextChecker) => { + this.form.initialSize = _ref; + }, }, - }], + ], }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - forms: [{ - type: TextChecker.xtype, - $value: 'min-idle', - width: 300, - allowBlank: false, - value: minIdle, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.minIdle = _ref; + forms: [ + { + type: TextChecker.xtype, + $value: 'min-idle', + width: 300, + allowBlank: false, + value: minIdle, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.minIdle = _ref; + }, }, - }], + ], }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'test-on-return', - width: 300, - allowBlank: true, - value: testOnReturn, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - ref: (_ref: TextValueCombo) => { - this.form.testOnReturn = _ref; + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'test-on-return', + width: 300, + allowBlank: true, + value: testOnReturn, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + ref: (_ref: TextValueCombo) => { + this.form.testOnReturn = _ref; + }, }, - }], + ], }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - forms: [{ - type: BI.TextValueCombo.xtype, - $value: 'test-while-idle', - width: 300, - allowBlank: true, - value: testWhileIdle, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - ref: (_ref: TextValueCombo) => { - this.form.testWhileIdle = _ref; + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'test-while-idle', + width: 300, + allowBlank: true, + value: testWhileIdle, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + ref: (_ref: TextValueCombo) => { + this.form.testWhileIdle = _ref; + }, }, - }], + ], }, { type: FormItem.xtype, @@ -623,11 +1038,14 @@ export class FormJdbc extends BI.Widget { allowBlank: false, value: timeBetweenEvictionRunsMillis, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), - checker: (value: string) => this.checkNumber(value), - autoFix: true, - }, valueRangeConfig], + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), + checker: (value: string) => this.checkNumber(value), + autoFix: true, + }, + valueRangeConfig, + ], ref: (_ref: TextChecker) => { this.form.timeBetweenEvictionRunsMillis = _ref; }, @@ -643,22 +1061,27 @@ export class FormJdbc extends BI.Widget { { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - forms: [{ - type: TextChecker.xtype, - $value: 'test-pereviction-run-num', - width: 300, - allowBlank: false, - value: numTestsPerEvictionRun, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], - ref: (_ref: TextChecker) => { - this.form.numTestsPerEvictionRun = _ref; + forms: [ + { + type: TextChecker.xtype, + $value: 'test-pereviction-run-num', + width: 300, + allowBlank: false, + value: numTestsPerEvictionRun, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.numTestsPerEvictionRun = _ref; + }, }, - }], + ], }, { type: FormItem.xtype, @@ -671,11 +1094,14 @@ export class FormJdbc extends BI.Widget { allowBlank: false, value: minEvictableIdleTimeMillis, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, - }, valueRangeConfig], + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], ref: (_ref: TextChecker) => { this.form.minEvictableIdleTimeMillis = _ref; }, @@ -687,7 +1113,8 @@ export class FormJdbc extends BI.Widget { text: BI.i18nText('BI-Basic_Seconds'), }, ], - }, { + }, + { el: { type: BI.VerticalLayout.xtype, cls: 'bi-border-top', @@ -697,22 +1124,27 @@ export class FormJdbc extends BI.Widget { el: { type: FormItem.xtype, name: 'Fetchsize', - forms: [{ - type: TextChecker.xtype, - $value: 'fetch-size', - width: 300, - allowBlank: true, - value: fetchSize === -2 ? '' : fetchSize, - watermark: 'Fetchsize', - validationChecker: [{ - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), - checker: (value: string) => BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, - autoFix: true, - }], - ref: (_ref: TextChecker) => { - this.form.fetchSize = _ref; + forms: [ + { + type: TextChecker.xtype, + $value: 'fetch-size', + width: 300, + allowBlank: true, + value: fetchSize === -2 ? '' : fetchSize, + watermark: 'Fetchsize', + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), + checker: (value: string) => + BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, + autoFix: true, + }, + ], + ref: (_ref: TextChecker) => { + this.form.fetchSize = _ref; + }, }, - }], + ], }, vgap: 15, }, @@ -725,6 +1157,11 @@ export class FormJdbc extends BI.Widget { }; } + public mounted() { + const sshType = this.form.sshType.getValue()[0]; + this.onSshTypeChange(sshType); + } + public setError(value: string) { this.form.connectionName.setError(value); } @@ -744,19 +1181,21 @@ export class FormJdbc extends BI.Widget { private getDrivers() { const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - const drivers = connectionType.drivers ? - connectionType.drivers.map(item => { - return { - text: item, - value: item, - }; - }) : - [{ - text: connectionType.driver, - value: connectionType.driver, - }]; + const drivers = connectionType.drivers + ? connectionType.drivers.map((item) => { + return { + text: item, + value: item, + }; + }) + : [ + { + text: connectionType.driver, + value: connectionType.driver, + }, + ]; - if (!drivers.some(item => item.text === connectionData.driver)) { + if (!drivers.some((item) => item.text === connectionData.driver)) { return [ { text: connectionData.driver, @@ -792,22 +1231,39 @@ export class FormJdbc extends BI.Widget { this.form.url.setValue(splitUrl(host, port, database, selectUrl)); } + private onSshTypeChange(sshType) { + const { privateKeyPathFormVisible, secretFormName } = CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value); + this.form.sshPrivateKeyPathForm.setVisible(privateKeyPathFormVisible); + this.form.sshSecretForm.setName(secretFormName); + this.form.sshSecret.setWatermark(secretFormName); + } + + private getSslSetEnabled(): boolean { + const { databaseType } = this.databaseType; + return databaseType === 'mysql'; + } + public setSchemas(schemas: string[]) { this.form.schema.setEnable(true); if (schemas.length > 0) { const value = this.form.schema.getValue()[0]; - this.form.schema.populate(schemas.map(item => { - return { - text: item, - value: item, - }; - })); - this.form.schema.setValue(value && schemas.some(item => item === value) ? value : schemas[0]); + this.form.schema.populate( + schemas.map((item) => { + return { + text: item, + value: item, + }; + }) + ); + this.form.schema.setValue(value && schemas.some((item) => item === value) ? value : schemas[0]); } } public validation(): boolean { - return this.form.driver.validation(); + const driver = this.form.driver.validation(); + const sshSet = !this.form.usingSsh.isSelected() || (this.form.sshIp.getValue() !== '' && this.form.sshPort.getValue() !== ''); + + return driver && sshSet; } public getSubmitValue(): Connection { @@ -837,6 +1293,26 @@ export class FormJdbc extends BI.Widget { principal: this.form.principal.getValue(), keyPath: this.form.keyPath.getValue(), fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -2 : BI.parseInt(this.form.fetchSize.getValue()), + // ssh + usingSsh: this.form.usingSsh.isSelected(), + // redirectPort: 0, + // redirectIp: '', + // sshKeepAlive: 10000, + // sshTimeOut: 10000, + sshIp: this.form.sshIp.getValue(), + sshPort: Number(this.form.sshPort.getValue()), + sshUser: this.form.sshUser.getValue(), + sshType: this.form.sshType.getValue()[0], + sshPrivateKeyPath: this.form.sshPrivateKeyPath.getValue(), + sshSecret: this.oldSshSecret === this.form.sshSecret.getValue() ? this.oldSshSecret : api.getCipher(this.form.sshSecret.getValue()), + // ssl + usingSsl: this.getSslSetEnabled() && this.form.usingSsl.isSelected(), + caCertificate: this.form.caCertificate.getValue(), + verifyCa: this.form.verifyCa.getValue()[0], + sslType: CONNECT_SSL_TYPE[0].value, + sslClientPrivateKey: this.form.sslClientPrivateKey.getValue(), + sslClientCertificate: this.form.sslClientCertificate.getValue(), + // 连接池 connectionPoolAttr: { initialSize: this.form.initialSize.getValue(), maxActive: this.form.maxActive.getValue(), diff --git a/tsconfig.json b/tsconfig.json index 4e9e3db..0506075 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,7 @@ // "noUnusedParameters": true, // "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "skipLibCheck": true, + "skipLibCheck": false, "paths": { "ui": ["./src/ui"], "ReportCst": ["./private/constants"], diff --git a/types/globals.d.ts b/types/globals.d.ts index 09a8987..4d1c456 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -2,6 +2,8 @@ interface Obj { [key: string]: any; } +type RequestFunction = (url: string, data: any, callback: (re: any) => void) => void; + declare let BI: Obj & import('@fui/core').BI & import('@fui/materials').BI; declare const Fix: Obj; declare const DecCst: Obj; @@ -10,15 +12,19 @@ declare const Dec: { socket: { connected: boolean; }; - system: { - - }; + system: {}; personal: { username: string; }; socketEmit: (type: string, name: string, callback: (re: any) => void) => void; - 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 + // req + reqGet: RequestFunction; + reqPost: RequestFunction; + reqPut: RequestFunction; + reqDelete: RequestFunction; + // reqHandle + reqGetHandle: RequestFunction; + reqPostHandle: RequestFunction; + reqPutHandle: RequestFunction; + reqDeleteHandle: RequestFunction; +}; From f427f41fd8c2c8c8d38ba5b12f82c40376d19f36 Mon Sep 17 00:00:00 2001 From: "Cauchy.Ke" Date: Wed, 9 Mar 2022 18:05:35 +0800 Subject: [PATCH 013/116] =?UTF-8?q?DEC-22408=20feat:=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81SSH=E5=8F=8ASSL=E3=80=91=E8=B0=83=E6=95=B4gap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/file_chooser/file_chooser.ts | 3 +- .../connection_jdbc/connection_jdbc.ts | 241 ++--- .../maintain/forms/components/form.jdbc.ts | 859 +++++++++--------- 3 files changed, 557 insertions(+), 546 deletions(-) diff --git a/src/modules/components/file_chooser/file_chooser.ts b/src/modules/components/file_chooser/file_chooser.ts index 53200f7..634cfdb 100644 --- a/src/modules/components/file_chooser/file_chooser.ts +++ b/src/modules/components/file_chooser/file_chooser.ts @@ -37,12 +37,13 @@ export class FileChooser extends BI.Widget { return { type: BI.VerticalAdaptLayout.xtype, - height: 20, + height: 24, items: [ { type: BI.SignEditor.xtype, cls: 'bi-border bi-focus-shadow', width, + height: 22, watermark, title: value, value, diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index d4e37dd..dd6f50a 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -152,46 +152,47 @@ export class ConnectionJdbc extends BI.Widget { ], }, { - type: BI.VerticalLayout.xtype, - tgap: -15, - vgap, - invisible: true, - ref: (_ref: VerticalLayout) => { - this.sshSet = _ref; - }, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - value: sshIp, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - value: sshPort, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - value: sshUser, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), - value: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).text, + el: { + type: BI.VerticalLayout.xtype, + bgap: vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.sshSet = _ref; }, - { - type: FormItem.xtype, - invisible: sshType !== 'KEY', - name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), - value: sshPrivateKeyPath, - }, - { - type: FormItem.xtype, - name: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).secretFormName, - value: sshSecret, - }, - ], + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + value: sshIp, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + value: sshPort, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + value: sshUser, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), + value: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).text, + }, + { + type: FormItem.xtype, + invisible: sshType !== 'KEY', + name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), + value: sshPrivateKeyPath, + }, + { + type: FormItem.xtype, + name: CONNECT_SSH_TYPE.find((SSH_TYPE) => sshType === SSH_TYPE.value).secretFormName, + value: sshSecret, + }, + ], + }, }, // ssl设置 { @@ -209,36 +210,37 @@ export class ConnectionJdbc extends BI.Widget { ], }, { - type: BI.VerticalLayout.xtype, - tgap: -15, - vgap, - invisible: true, - ref: (_ref: VerticalLayout) => { - this.sslSet = _ref; - }, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), - value: caCertificate, + el: { + type: BI.VerticalLayout.xtype, + bgap: vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.sslSet = _ref; }, - { - type: FormItem.xtype, - invisible: !caCertificate, - name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), - value: verifyCa ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), - value: sslClientPrivateKey, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), - value: sslClientCertificate, - }, - ], + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), + value: caCertificate, + }, + { + type: FormItem.xtype, + invisible: !caCertificate, + name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), + value: verifyCa ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), + value: sslClientPrivateKey, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), + value: sslClientCertificate, + }, + ], + }, }, // 更多设置 { @@ -255,58 +257,59 @@ export class ConnectionJdbc extends BI.Widget { ], }, { - type: BI.VerticalLayout.xtype, - tgap: -15, - vgap, - invisible: true, - ref: (_ref: VerticalLayout) => { - this.advancedSet = _ref; - }, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - value: connectionPoolAttr.initialSize, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - value: connectionPoolAttr.minIdle, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - value: connectionPoolAttr.timeBetweenEvictionRunsMillis, - unit: BI.i18nText('Dec-Dcm_Millisecond'), - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - value: connectionPoolAttr.numTestsPerEvictionRun, - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - value: connectionPoolAttr.minEvictableIdleTimeMillis, - unit: BI.i18nText('BI-Basic_Seconds'), - }, - { - type: FormItem.xtype, - invisible: fetchSize < 0 && fetchSize !== -2, - name: 'Fetchsize', - value: fetchSize === -2 ? '' : fetchSize, + el: { + type: BI.VerticalLayout.xtype, + bgap: vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.advancedSet = _ref; }, - ], + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), + value: connectionPoolAttr.initialSize, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + value: connectionPoolAttr.minIdle, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + value: connectionPoolAttr.testOnReturn ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + value: connectionPoolAttr.testWhileIdle ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), + value: connectionPoolAttr.timeBetweenEvictionRunsMillis, + unit: BI.i18nText('Dec-Dcm_Millisecond'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + value: connectionPoolAttr.numTestsPerEvictionRun, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), + value: connectionPoolAttr.minEvictableIdleTimeMillis, + unit: BI.i18nText('BI-Basic_Seconds'), + }, + { + type: FormItem.xtype, + invisible: fetchSize < 0 && fetchSize !== -2, + name: 'Fetchsize', + value: fetchSize === -2 ? '' : fetchSize, + }, + ], + }, }, ], }; diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index ffdbb1d..4e6c4a6 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -639,162 +639,166 @@ export class FormJdbc extends BI.Widget { ], }, { - type: BI.VerticalLayout.xtype, - ref: (_ref: VerticalLayout) => { - this.sshSet = _ref; - }, - invisible: true, - items: [ - { - type: FormItem.xtype, - bgap: -15, - name: BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSH'), - forms: [ - { - type: BI.MultiSelectItem.xtype, - ref: (_ref: MultiSelectItem) => { - this.form.usingSsh = _ref; - }, - logic: { dynamic: true }, - text: BI.i18nText('Dec-Basic_Use') + BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSH'), - selected: usingSsh, - listeners: [ - { - eventName: BI.MultiSelectItem.EVENT_CHANGE, - action: () => { - const value = this.form.usingSsh.isSelected(); - this.sshForm.setVisible(value); - }, - }, - ], - }, - ], + el: { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sshSet = _ref; }, - { - type: BI.VerticalLayout.xtype, - ref: (_ref: VerticalLayout) => { - this.sshForm = _ref; + bgap: vgap, + invisible: true, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSH'), + forms: [ + { + type: BI.MultiSelectItem.xtype, + ref: (_ref: MultiSelectItem) => { + this.form.usingSsh = _ref; + }, + logic: { dynamic: true }, + text: BI.i18nText('Dec-Basic_Use') + BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSH'), + selected: usingSsh, + listeners: [ + { + eventName: BI.MultiSelectItem.EVENT_CHANGE, + action: () => { + const value = this.form.usingSsh.isSelected(); + this.sshForm.setVisible(value); + }, + }, + ], + }, + ], }, - vgap, - invisible: !usingSsh, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - forms: [ + { + el: { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sshForm = _ref; + }, + bgap: vgap, + invisible: !usingSsh, + items: [ { - type: TextChecker.xtype, - ref: (_ref: TextChecker) => { - this.form.sshIp = _ref; - }, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - allowBlank: false, - value: sshIp || 'hostname', + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshIp = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), + allowBlank: false, + value: sshIp || 'hostname', + }, + ], }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - forms: [ { - type: TextChecker.xtype, - ref: (_ref: TextChecker) => { - this.form.sshPort = _ref; - }, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), - allowBlank: false, - validationChecker: [ + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + forms: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshPort = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), + allowBlank: false, + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + value: String(sshPort || 22), }, - valueRangeConfig, ], - value: String(sshPort || 22), }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - forms: [ { - type: TextChecker.xtype, - ref: (_ref: TextChecker) => { - this.form.sshUser = _ref; - }, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), - value: sshUser, + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshUser = _ref; + }, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), + value: sshUser, + }, + ], }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), - forms: [ { - type: BI.TextValueCombo.xtype, - ref: (_ref: TextValueCombo) => { - this.form.sshType = _ref; - }, - width: 300, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), - items: CONNECT_SSH_TYPE, - value: sshType, - listeners: [ + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), + forms: [ { - eventName: BI.TextValueCombo.EVENT_CHANGE, - action: () => { - const sshType = this.form.sshType.getValue()[0]; - this.onSshTypeChange(sshType); + type: BI.TextValueCombo.xtype, + ref: (_ref: TextValueCombo) => { + this.form.sshType = _ref; }, + width: 300, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), + items: CONNECT_SSH_TYPE, + value: sshType, + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: () => { + const sshType = this.form.sshType.getValue()[0]; + this.onSshTypeChange(sshType); + }, + }, + ], }, ], }, - ], - }, - { - type: FormItem.xtype, - ref: (_ref: FormItem) => { - this.form.sshPrivateKeyPathForm = _ref; - }, - name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), - forms: [ { - type: FileChooser.xtype, - ref: (_ref: TextChecker) => { - this.form.sshPrivateKeyPath = _ref; + type: FormItem.xtype, + ref: (_ref: FormItem) => { + this.form.sshPrivateKeyPathForm = _ref; }, - root: 'certificates', - watermark: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), - value: sshPrivateKeyPath, + name: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: TextChecker) => { + this.form.sshPrivateKeyPath = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Form_PrivateKey'), + value: sshPrivateKeyPath, + }, + ], }, - ], - }, - { - type: FormItem.xtype, - ref: (ref: FormItem) => { - this.form.sshSecretForm = ref; - }, - name: BI.i18nText(''), - forms: [ { - type: TextChecker.xtype, - ref: (_ref: TextChecker) => { - this.form.sshSecret = _ref; + type: FormItem.xtype, + ref: (ref: FormItem) => { + this.form.sshSecretForm = ref; }, - watermark: BI.i18nText(''), - inputType: 'password', - autocomplete: 'new-password', - value: sshSecret, + name: BI.i18nText(''), + forms: [ + { + type: TextChecker.xtype, + ref: (_ref: TextChecker) => { + this.form.sshSecret = _ref; + }, + watermark: BI.i18nText(''), + inputType: 'password', + autocomplete: 'new-password', + value: sshSecret, + }, + ], }, ], }, - ], - }, - ], + }, + ], + }, }, // SSL设置 { @@ -812,114 +816,117 @@ export class FormJdbc extends BI.Widget { ], }, { - type: BI.VerticalLayout.xtype, - ref: (_ref: VerticalLayout) => { - this.sslSet = _ref; - }, - invisible: true, - items: [ - { - type: FormItem.xtype, - bgap: -15, - name: BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSL'), - forms: [ - { - type: BI.MultiSelectItem.xtype, - ref: (_ref: MultiSelectItem) => { - this.form.usingSsl = _ref; - }, - logic: { dynamic: true }, - text: BI.i18nText('Dec-Basic_Use') + BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSL'), - selected: usingSsl, - listeners: [ - { - eventName: BI.MultiSelectItem.EVENT_CHANGE, - action: () => { - const value = this.form.usingSsl.isSelected(); - this.sslForm.setVisible(value); - }, - }, - ], - }, - ], + el: { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sslSet = _ref; }, - { - type: BI.VerticalLayout.xtype, - ref: (_ref: VerticalLayout) => { - this.sslForm = _ref; + bgap: vgap, + invisible: true, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSL'), + forms: [ + { + type: BI.MultiSelectItem.xtype, + ref: (_ref: MultiSelectItem) => { + this.form.usingSsl = _ref; + }, + logic: { dynamic: true }, + text: BI.i18nText('Dec-Basic_Use') + BI.i18nText('Dec-Dcm_Connection_Tunnel', 'SSL'), + selected: usingSsl, + listeners: [ + { + eventName: BI.MultiSelectItem.EVENT_CHANGE, + action: () => { + const value = this.form.usingSsl.isSelected(); + this.sslForm.setVisible(value); + }, + }, + ], + }, + ], }, - vgap, - invisible: !usingSsl, - items: [ - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), - forms: [ + { + el: { + type: BI.VerticalLayout.xtype, + ref: (_ref: VerticalLayout) => { + this.sslForm = _ref; + }, + bgap: vgap, + invisible: !usingSsl, + items: [ { - type: FileChooser.xtype, - ref: (_ref: FileChooser) => { - this.form.caCertificate = _ref; - }, - root: 'certificates', - watermark: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), - value: caCertificate, + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: FileChooser) => { + this.form.caCertificate = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Form_CA_Certificate'), + value: caCertificate, + }, + ], }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), - forms: [ { - type: BI.TextValueCombo.xtype, - ref: (_ref: TextValueCombo) => { - this.form.verifyCa = _ref; - }, - width: 300, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), - items: this.getBooleanItem(), - value: verifyCa, + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), + forms: [ + { + type: BI.TextValueCombo.xtype, + ref: (_ref: TextValueCombo) => { + this.form.verifyCa = _ref; + }, + width: 300, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), + items: this.getBooleanItem(), + value: verifyCa, + }, + ], }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), - forms: [ { - type: FileChooser.xtype, - ref: (_ref: FileChooser) => { - this.form.sslClientPrivateKey = _ref; - }, - root: 'certificates', - watermark: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), - value: sslClientPrivateKey, + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: FileChooser) => { + this.form.sslClientPrivateKey = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_SecretKey'), + value: sslClientPrivateKey, + }, + ], }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), - forms: [ { - type: FileChooser.xtype, - ref: (_ref: FileChooser) => { - this.form.sslClientCertificate = _ref; - }, - root: 'certificates', - watermark: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), - value: sslClientCertificate, + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), + forms: [ + { + type: FileChooser.xtype, + ref: (_ref: FileChooser) => { + this.form.sslClientCertificate = _ref; + }, + root: 'certificates', + watermark: BI.i18nText('Dec-Dcm_Connection_Client') + BI.i18nText('Dec-Dcm_Connection_Form_Certificate'), + value: sslClientCertificate, + }, + ], }, ], }, - ], - }, - ], + }, + ], + }, }, // 高级设置 { type: Collapse.xtype, - bgap: -15, width: 100, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_More_Setting'), listeners: [ @@ -932,226 +939,226 @@ export class FormJdbc extends BI.Widget { ], }, { - type: BI.VerticalLayout.xtype, - vgap, - tgap: -15, - invisible: true, - ref: (_ref: VerticalLayout) => { - this.advancedSet = _ref; - }, - items: [ - { - type: FormItem.xtype, - tgap: 15, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - forms: [ - { - type: TextChecker.xtype, - $value: 'initial-size', - width: 300, - allowBlank: false, - value: initialSize, - validationChecker: [ - { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, + el: { + type: BI.VerticalLayout.xtype, + bgap: vgap, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.advancedSet = _ref; + }, + items: [ + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), + forms: [ + { + type: TextChecker.xtype, + $value: 'initial-size', + width: 300, + allowBlank: false, + value: initialSize, + validationChecker: [ + { + 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: TextChecker) => { + this.form.initialSize = _ref; }, - valueRangeConfig, - ], - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Initial_Size'), - ref: (_ref: TextChecker) => { - this.form.initialSize = _ref; }, - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - forms: [ - { - type: TextChecker.xtype, - $value: 'min-idle', - width: 300, - allowBlank: false, - value: minIdle, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), - validationChecker: [ - { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + forms: [ + { + type: TextChecker.xtype, + $value: 'min-idle', + width: 300, + allowBlank: false, + value: minIdle, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.minIdle = _ref; }, - valueRangeConfig, - ], - ref: (_ref: TextChecker) => { - this.form.minIdle = _ref; }, - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - forms: [ - { - type: BI.TextValueCombo.xtype, - $value: 'test-on-return', - width: 300, - allowBlank: true, - value: testOnReturn, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), - ref: (_ref: TextValueCombo) => { - this.form.testOnReturn = _ref; + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'test-on-return', + width: 300, + allowBlank: true, + value: testOnReturn, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Return'), + ref: (_ref: TextValueCombo) => { + this.form.testOnReturn = _ref; + }, }, - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - forms: [ - { - type: BI.TextValueCombo.xtype, - $value: 'test-while-idle', - width: 300, - allowBlank: true, - value: testWhileIdle, - items: this.getBooleanItem(), - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), - ref: (_ref: TextValueCombo) => { - this.form.testWhileIdle = _ref; + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'test-while-idle', + width: 300, + allowBlank: true, + value: testWhileIdle, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_While_Idle'), + ref: (_ref: TextValueCombo) => { + this.form.testWhileIdle = _ref; + }, }, - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - forms: [ - { - type: TextChecker.xtype, - $value: 'test-between-evicition-millis', - width: 300, - allowBlank: false, - value: timeBetweenEvictionRunsMillis, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), - validationChecker: [ - { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), - checker: (value: string) => this.checkNumber(value), - autoFix: true, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), + forms: [ + { + type: TextChecker.xtype, + $value: 'test-between-evicition-millis', + width: 300, + allowBlank: false, + value: timeBetweenEvictionRunsMillis, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Number'), + checker: (value: string) => this.checkNumber(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.timeBetweenEvictionRunsMillis = _ref; }, - valueRangeConfig, - ], - ref: (_ref: TextChecker) => { - this.form.timeBetweenEvictionRunsMillis = _ref; }, - }, - { - type: BI.Label.xtype, - lgap: 5, - height: CONNECTION_LAYOUT.labelHeight, - text: BI.i18nText('Dec-Dcm_Millisecond'), - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - forms: [ - { - type: TextChecker.xtype, - $value: 'test-pereviction-run-num', - width: 300, - allowBlank: false, - value: numTestsPerEvictionRun, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), - validationChecker: [ - { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, + { + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('Dec-Dcm_Millisecond'), + }, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + forms: [ + { + type: TextChecker.xtype, + $value: 'test-pereviction-run-num', + width: 300, + allowBlank: false, + value: numTestsPerEvictionRun, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.numTestsPerEvictionRun = _ref; }, - valueRangeConfig, - ], - ref: (_ref: TextChecker) => { - this.form.numTestsPerEvictionRun = _ref; }, - }, - ], - }, - { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - forms: [ - { - type: TextChecker.xtype, - $value: 'min-evictable-idle-time-millis', - width: 300, - allowBlank: false, - value: minEvictableIdleTimeMillis, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), - validationChecker: [ - { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), - autoFix: true, + ], + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), + forms: [ + { + type: TextChecker.xtype, + $value: 'min-evictable-idle-time-millis', + width: 300, + allowBlank: false, + value: minEvictableIdleTimeMillis, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.minEvictableIdleTimeMillis = _ref; }, - valueRangeConfig, - ], - ref: (_ref: TextChecker) => { - this.form.minEvictableIdleTimeMillis = _ref; }, - }, - { - type: BI.Label.xtype, - lgap: 5, - height: CONNECTION_LAYOUT.labelHeight, - text: BI.i18nText('BI-Basic_Seconds'), - }, - ], - }, - { - el: { - type: BI.VerticalLayout.xtype, - cls: 'bi-border-top', - invisible: fetchSize < 0 && fetchSize !== -2, - items: [ { - el: { - type: FormItem.xtype, - name: 'Fetchsize', - forms: [ - { - type: TextChecker.xtype, - $value: 'fetch-size', - width: 300, - allowBlank: true, - value: fetchSize === -2 ? '' : fetchSize, - watermark: 'Fetchsize', - validationChecker: [ - { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), - checker: (value: string) => - BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, - autoFix: true, + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('BI-Basic_Seconds'), + }, + ], + }, + { + el: { + type: BI.VerticalLayout.xtype, + cls: 'bi-border-top', + invisible: fetchSize < 0 && fetchSize !== -2, + items: [ + { + el: { + type: FormItem.xtype, + name: 'Fetchsize', + forms: [ + { + type: TextChecker.xtype, + $value: 'fetch-size', + width: 300, + allowBlank: true, + value: fetchSize === -2 ? '' : fetchSize, + watermark: 'Fetchsize', + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), + checker: (value: string) => + BI.isInteger(value) && BI.parseInt(value) >= 0 && BI.parseInt(value) <= 1000000, + autoFix: true, + }, + ], + ref: (_ref: TextChecker) => { + this.form.fetchSize = _ref; }, - ], - ref: (_ref: TextChecker) => { - this.form.fetchSize = _ref; }, - }, - ], + ], + }, + vgap: 15, }, - vgap: 15, - }, - ], + ], + }, }, - }, - ], + ], + }, }, ], }; From 248451ea602766210616ccb0254afb8085697680 Mon Sep 17 00:00:00 2001 From: "Cauchy.Ke" Date: Mon, 14 Mar 2022 09:50:12 +0800 Subject: [PATCH 014/116] =?UTF-8?q?DEC-22540=20fix:=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81SSH=E5=8F=8ASSL=E3=80=91=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=A0=91=E8=8A=82=E7=82=B9=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_chooser/file_chooser.model.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/components/file_chooser/file_chooser.model.ts b/src/modules/components/file_chooser/file_chooser.model.ts index 4850d0c..4903702 100644 --- a/src/modules/components/file_chooser/file_chooser.model.ts +++ b/src/modules/components/file_chooser/file_chooser.model.ts @@ -48,7 +48,6 @@ export class FileChooserModel extends Model { }) .map((item) => ({ ...item, - text: item.id, value: prefix + item.path, open: item.id === root || BI.isKey(keyword), })); From ed600b2006c54247dcb09d591a4dbc8595c7e783 Mon Sep 17 00:00:00 2001 From: "Cauchy.Ke" Date: Fri, 18 Mar 2022 13:44:34 +0800 Subject: [PATCH 015/116] =?UTF-8?q?REPORT-67986=20fix:=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81SSH=E5=8F=8ASSL=E3=80=91=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_chooser/file_chooser.model.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/components/file_chooser/file_chooser.model.ts b/src/modules/components/file_chooser/file_chooser.model.ts index 4903702..708bd0f 100644 --- a/src/modules/components/file_chooser/file_chooser.model.ts +++ b/src/modules/components/file_chooser/file_chooser.model.ts @@ -43,8 +43,9 @@ export class FileChooserModel extends Model { this.model.items = data .concat({ id: root, - text: root, + text: prefix + root, value: prefix + root, + isParent: true, }) .map((item) => ({ ...item, From 1745a5e9d8c83a1a1fac633a085ccb7018a7715e Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 11 Apr 2022 15:49:50 +0800 Subject: [PATCH 016/116] =?UTF-8?q?REPORT-69127=20fix:=E4=BF=AE=E6=94=B9Ha?= =?UTF-8?q?doop=E7=94=9F=E6=80=81=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5hasSc?= =?UTF-8?q?hema=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 4fabf64..554c260 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -250,7 +250,7 @@ export const DATA_BASE_TYPES = [ commonly: false, internal: true, type: 'jdbc', - hasSchema: false, + hasSchema: true, kerberos: true, }, { @@ -392,7 +392,7 @@ export const DATA_BASE_TYPES = [ commonly: false, internal: true, type: 'jdbc', - hasSchema: false, + hasSchema: true, kerberos: true, }, { text: 'Hbase', @@ -632,7 +632,7 @@ export const DATA_BASE_TYPES = [ commonly: false, internal: true, type: 'jdbc', - hasSchema: false, + hasSchema: true, kerberos: true, }, { text: 'Sqlite', From 449030d9a7c9597ca54e82819996f8d0295b9d08 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 18 Apr 2022 14:09:22 +0800 Subject: [PATCH 017/116] =?UTF-8?q?Revert=20"REPORT-69127=20fix:=E4=BF=AE?= =?UTF-8?q?=E6=94=B9Hadoop=E7=94=9F=E6=80=81=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5hasSchema=E5=80=BC"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1745a5e9d8c83a1a1fac633a085ccb7018a7715e. --- src/modules/constants/constant.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 554c260..4fabf64 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -250,7 +250,7 @@ export const DATA_BASE_TYPES = [ commonly: false, internal: true, type: 'jdbc', - hasSchema: true, + hasSchema: false, kerberos: true, }, { @@ -392,7 +392,7 @@ export const DATA_BASE_TYPES = [ commonly: false, internal: true, type: 'jdbc', - hasSchema: true, + hasSchema: false, kerberos: true, }, { text: 'Hbase', @@ -632,7 +632,7 @@ export const DATA_BASE_TYPES = [ commonly: false, internal: true, type: 'jdbc', - hasSchema: true, + hasSchema: false, kerberos: true, }, { text: 'Sqlite', From 9c851d9d02d1b7c82aa29f047dfa3ea6ff95ecc1 Mon Sep 17 00:00:00 2001 From: "Cauchy.Ke" Date: Mon, 23 May 2022 17:29:58 +0800 Subject: [PATCH 018/116] =?UTF-8?q?REPORT-72078=20fix:=E4=BF=AE=E5=A4=8DIn?= =?UTF-8?q?formix=E7=B1=BB=E5=9E=8B=E8=BF=9E=E6=8E=A5=E7=9A=84URL=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 145b807..e35475f 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -66,6 +66,14 @@ export function splitUrl(host: string, port: string, database: string, baseUrl: return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('=database', `=${database}`); } + + // https://work.fineres.com/browse/REPORT-72078 + if (baseUrl.startsWith('jdbc:informix-sqli')) { + return baseUrl.replace('hostname', host) + .replace(':port', port ? `:${port}` : '') + .replace('database', database) + .replace(':INFORMIXSERVER={server}',''); + } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('database', database) From 796386969eecf19b995eb63c0629c6a19f70c5fc Mon Sep 17 00:00:00 2001 From: "Cauchy.Ke" Date: Mon, 23 May 2022 17:29:58 +0800 Subject: [PATCH 019/116] =?UTF-8?q?REPORT-72078=20fix:=E4=BF=AE=E5=A4=8DIn?= =?UTF-8?q?formix=E7=B1=BB=E5=9E=8B=E8=BF=9E=E6=8E=A5=E7=9A=84URL=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 145b807..e35475f 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -66,6 +66,14 @@ export function splitUrl(host: string, port: string, database: string, baseUrl: return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('=database', `=${database}`); } + + // https://work.fineres.com/browse/REPORT-72078 + if (baseUrl.startsWith('jdbc:informix-sqli')) { + return baseUrl.replace('hostname', host) + .replace(':port', port ? `:${port}` : '') + .replace('database', database) + .replace(':INFORMIXSERVER={server}',''); + } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('database', database) From cc95b3f2e07f3914a192566509d526df119f9810 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 7 Jul 2022 16:07:00 +0800 Subject: [PATCH 020/116] =?UTF-8?q?REPORT-74590=20fix:=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96key=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/maintain/components/driverselector/driverselector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 896c157..862dc6a 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -121,7 +121,7 @@ export class DriverSelector extends BI.Widget { }, invisible: this.model.driverSource === '', width: 204, - watermark: BI.i18nText('Dec-Please_Input'), + watermark: BI.i18nText('Dec-Please_Select_One'), items: this.model.driverClassItems, value: this.model.customDriver.value, text: () => this.model.customDriver.value || '', From a2c1620dba024c44bcfb0e7cabe9ab2907b8f52c Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 7 Jul 2022 17:48:22 +0800 Subject: [PATCH 021/116] =?UTF-8?q?REPORT-72487=20f=08=08eat:=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 30f185f..3170f13 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -62,6 +62,11 @@ Dec-Dcm_Connection_Form_UserName= 用户名 Dec-Dcm_Connection_Form_Password= 密码 Dec-Dcm_Connection_Form_Principal= 客户端principal Dec-Dcm_Connection_Form_KeyPath= keytab密钥路径 +Dec-Dcm_Connection_Form_Krb5File= krb5.conf文件 +Dec-Dcm_Connection_File_Upload_Success= 已成功上传并校验成功 +Dec-Dcm_Connection_File_Upload_Error= 检测异常 +Dec-Dcm_Connection_File_Upload_ErrorCode= 错误代码 +Dec-Dcm_Connection_File_Upload_ErrorMsg= 错误详情 Dec-Dcm_Connection_Form_Pool_Properties= 连接池属性 Dec-Dcm_Connection_Form_SQL_Validation_Query= SQL验证查询 Dec-Dcm_Connection_Form_Connection-Check= 获取连接前校验 @@ -303,4 +308,7 @@ BI-Basic_No_Select= 不选 BI-Basic_Now= 此刻 Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB Dec-Dcm_Connection_Value_Out_Range=数值超出范围 -Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 \ No newline at end of file +Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 +Dec-Dcm_Connection_File_Upload_ErrorTip1= 参考 +Dec-Dcm_Connection_File_Upload_ErrorTip2= kerberos配置 +Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 \ No newline at end of file From f9d98bff0c630a5f0e3765680290717457a4a83f Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:03:18 +0800 Subject: [PATCH 022/116] =?UTF-8?q?REPORT-72487=20fix:=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- private/i18n.ts | 8 + .../components/file_upload/file_upload.less | 13 + .../file_upload/file_upload.model.ts | 35 ++ .../components/file_upload/file_upload.ts | 328 ++++++++++++++++++ src/modules/crud/crud.typings.d.ts | 4 + src/modules/crud/decision.api.ts | 4 + .../maintain/forms/components/form.jdbc.ts | 146 ++++++-- 7 files changed, 507 insertions(+), 31 deletions(-) create mode 100644 src/modules/components/file_upload/file_upload.less create mode 100644 src/modules/components/file_upload/file_upload.model.ts create mode 100644 src/modules/components/file_upload/file_upload.ts diff --git a/private/i18n.ts b/private/i18n.ts index 8f00670..1a530af 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -61,6 +61,11 @@ export default { 'Dec-Dcm_Connection_Form_Password': '密码', 'Dec-Dcm_Connection_Form_Principal': '客户端principal', 'Dec-Dcm_Connection_Form_KeyPath': 'keytab密钥路径', + 'Dec-Dcm_Connection_Form_Krb5File': 'krb5.conf文件', + 'Dec-Dcm_Connection_File_Upload_Success': ' 已成功上传并校验成功', + 'Dec-Dcm_Connection_File_Upload_Error': '检测异常', + 'Dec-Dcm_Connection_File_Upload_ErrorCode': '错误代码', + 'Dec-Dcm_Connection_File_Upload_ErrorMsg': '错误详情', 'Dec-Dcm_Connection_Form_Pool_Properties': '连接池属性', 'Dec-Dcm_Connection_Form_SQL_Validation_Query': 'SQL验证查询', 'Dec-Dcm_Connection_Form_Connection-Check': '获取连接前校验', @@ -306,4 +311,7 @@ export default { 'Dec-Connection_Lic_Limit_Approach_Tip': '当前数据连接数量超过注册lic限制({}个),所有数据连接都不可用,请删除多余的数据连接', 'Dec-Connection_Lic_Limit_Approach_Prevent_Tip': '当前数据连接数量已经达到注册lic限制({}个),无法新增', 'Dec-Dcm_Connection_Check_Fetch_Size_Range': '请输入0-1000000之间的值', + 'Dec-Dcm_Connection_File_Upload_ErrorTip1':'参考', + 'Dec-Dcm_Connection_File_Upload_ErrorTip2': 'kerberos配置', + 'Dec-Dcm_Connection_File_Upload_ErrorTip3': '取帮助或联系技术支持', }; diff --git a/src/modules/components/file_upload/file_upload.less b/src/modules/components/file_upload/file_upload.less new file mode 100644 index 0000000..83c51ce --- /dev/null +++ b/src/modules/components/file_upload/file_upload.less @@ -0,0 +1,13 @@ +.data-conf-file { + .x-icon{ + width: 48px; + height: 48px; + } +} + +.data-keytab-file { + .x-icon{ + width: 48px; + height: 48px; + } +} diff --git a/src/modules/components/file_upload/file_upload.model.ts b/src/modules/components/file_upload/file_upload.model.ts new file mode 100644 index 0000000..78d0a75 --- /dev/null +++ b/src/modules/components/file_upload/file_upload.model.ts @@ -0,0 +1,35 @@ +import { model, Model } from '@core/core'; + +type UploadParam = { + keytabPath: string; + krb5ConfPath: string; + principal: string; +} + +@model() +export class FileUploadModel extends Model { + static xtype = 'dec.dcm.model.components.file_upload'; + + private options: { + inter: string; + } + + state() { + return { + uploadUrl: '', + fileName: '', + }; + } + + actions = { + setFileInfo: (params: UploadParam) => { + var inter = this.options.inter; + + this.model.uploadUrl = Dec.Utils.getEncodeURL(Dec.fineServletURL + inter, "", params); + }, + + setFileName:(v: string) => { + this.model.fileName = v; + } + } +} diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts new file mode 100644 index 0000000..56265be --- /dev/null +++ b/src/modules/components/file_upload/file_upload.ts @@ -0,0 +1,328 @@ +import { shortcut, store } from '@core/core'; +import { SignEditor, MultiLayerSingleLevelTree, SearchEditor, Button, Editor, Label } from '@fui/core'; +import { FileUploadModel } from './file_upload.model'; +import { ApiFactory } from 'src/modules/crud/apiFactory'; +import './file_upload.less'; + +const api = new ApiFactory().create(); + +@shortcut() +@store(FileUploadModel, { + props(this: FileUpload) { + return this.options; + }, +}) +export class FileUpload extends BI.Widget { + public static xtype = "dec.dcm.components.file_upload"; + public static EVENT_CHECK_SUCCESS = 'EVENT_CHECK_SUCCESS'; + public static EVENT_CLEAR_FILE = 'EVENT_CLEAR_FILE'; + + public props = { + watermark: '', + value: '', + processId: '', + disabled: false, + inter: '', + access: '', + iconCls: '' + }; + + model: FileUploadModel['model']; + store: FileUploadModel['store']; + watch = { + uploadUrl: function () { + this.uploader.setUrl(this.model.uploadUrl); + }, + }; + + public textEditor: SignEditor; + public keywordEditor: SearchEditor; + public fileTree: MultiLayerSingleLevelTree; + public sureButton: Button; + public infoLabel: Label; + + public render() { + const { width, watermark, value, processId, inter } = this.options; + var self = this; + var processName = BI.concat("process-", processId); + var processClass = BI.concat(".process-", processId); + this.setFileInfo({ + keytabPath: '', + principal:'', + krb5ConfPath: '', + }); + + return { + type: BI.VerticalLayout.xtype, + items:[{ + type: BI.FloatLeftLayout.xtype, + items: [ + { + type: BI.SignEditor.xtype, + cls: 'bi-border bi-focus-shadow', + width: 300, + height: 22, + watermark, + disabled: true, + value, + ref: (_ref: SignEditor) => { + this.textEditor = _ref; + }, + listeners: [ + { + eventName: BI.SignEditor.EVENT_CHANGE, + action: () => { + const value = this.textEditor.getValue(); + this.setValue(value); + }, + }, + ], + }, { + type: BI.Button.xtype, + width: 100, + _lgap: 10, + iconCls: "upload-font", + level: "ignore", + ghost: true, + ref: (_ref: Button) => { + this.uploadButton = _ref; + }, + text: BI.i18nText('Dec-Basic_Choose_File'), + handler: () => { + self.uploader.select(); + }, + }, + ], + }, { + type: BI.FloatLeftLayout.xtype, + tgap: 8, + invisible: true, + ref: (_ref) => { + this.fileInfo = _ref; + }, + items: [ + { + type: BI.VerticalLayout.xtype, + cls: "bi-border", + items: [{ + type: BI.HTapeLayout.xtype, + height: 68, + width: 300, + items: [{ + el: { + type: BI.IconLabel.xtype, + cls: this.options.iconCls, + }, + width: 48, + lgap: 8, + }, { + el: { + type: BI.VerticalLayout.xtype, + items : [{ + type: BI.Label.xtype, + width: 200, + height: 20, + textAlign: "left", + ref: (_ref: Label) => { + this.fileName = _ref; + }, + },{ + type: BI.VerticalAdaptLayout.xtype, + items: [{ + type: BI.Label.xtype, + cls: "bi-tips", + height: 20, + rgap: 3, + ref: (_ref: Label) => { + this.fileSize = _ref; + }, + }, { + type: BI.Label.xtype, + cls: "bi-tips", + height: 20, + ref: (_ref: Label) => { + this.fileModified = _ref; + }, + }] + + }], + + }, + tgap: 14, + lgap: 4, + }, { + el: { + type: BI.IconButton.xtype, + cls: "default-delete-font", + handler: function () { + NProgress.set(0.0); + self.xhr.abort(); + self.uploadButton.setEnable(true); + self.fileInfo.setVisible(false); + self.store.setFileName(''); + self.clearInfo(); + self.fireEvent(FileUpload.EVENT_CLEAR_FILE); + + }, + }, + rgap: 10, + }] + }, { + type: BI.VerticalLayout.xtype, + cls: processName, + width: 300, + height: 1, + }] + + }, { + el :{ + type: BI.VerticalLayout.xtype, + cls: "bi-error", + ref: (_ref: any) => { + this.errorInfo = _ref; + }, + invisible: true, + items : [{ + type: BI.Label.xtype, + height: 20, + textAlign: "left", + ref: (_ref: Label) => { + this.errorCode = _ref; + }, + },{ + type: BI.Label.xtype, + height: 20, + textAlign: "left", + ref: (_ref: Label) => { + this.errorMsg = _ref; + }, + }, { + type: "bi.vertical_adapt", + rgap: 5, + items: [ + { + type: "bi.label", + text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip1'), + },{ + type: "bi.text_button", + cls: "bi-high-light bi-high-light-border-bottom", + text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip2'), + handler: function () { + window.open(Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][DecCst.Hyperlink.KERBEROS_CONF_HELP]); + }, + },{ + type: "bi.label", + text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip3'), + } + ], + },], + }, + vgap: 4, + lgap: 8, + } + ], + }, { + type: BI.MultifileEditor.xtype, + ref: (ref:any) => { + self.uploader = ref; + }, + url: this.model.uploadUrl, + accept: this.options.accept, + listeners: [ + { + // 选择文件 + eventName: BI.MultifileEditor.EVENT_CHANGE, + action: function (files) { + self.options.attachId = ''; + var fileInfo = files.files[0]; + self.setInfo(fileInfo); + self.store.setFileName(fileInfo.fileName); + this.upload(); + NProgress.configure({ parent: processClass, minimum: 0.0 }); + }, + }, + { + // 上传进度刷新 + eventName: BI.MultifileEditor.EVENT_PROGRESS, + action: function (progress) { + var rate = progress.loaded/progress.total; + NProgress.set(rate); + }, + }, + { + // 开始上传文件 + eventName: BI.MultifileEditor.EVENT_UPLOADSTART, + action: function (progressEvent, xhr) { + self.xhr = xhr; + }, + }, + { + // 上传文件完毕 + eventName: BI.MultifileEditor.EVENT_UPLOADED, + action: function () { + var uploadedInfo = this.getValue(); + var failed = BI.some(uploadedInfo, function (index, file) { + if (file.data.errorCode) { + BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Error'), { + level: "error", + }); + self.setErrorInfo(file.data) + return true; + } + }); + var key = self.options.processId +'Path'; + !failed && self.setValue(uploadedInfo[0].data.kerberosInfo[key]); + !failed && self.fireEvent(FileUpload.EVENT_CHECK_SUCCESS, uploadedInfo[0].data); + !failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ + level: "success" + }); + }, + }, + ], + }] + + }; + } + + public getValue(): string { + return this.options.value; + } + + public setValue(value: string) { + this.options.value = value; + this.textEditor.text.setTitle(value); + this.textEditor.setValue(value); + } + + public setInfo(info: any) { + this.uploadButton.setEnable(false); + this.fileInfo.setVisible(true); + this.textEditor.setValue(info.fileName); + this.fileName.setText(info.fileName); + this.fileSize.setText(Dec.Utils.getByteWidthUnit(info.size)); + this.fileModified.setText(BI.getDate(info.lastModified).print("%Y-%X-%d %H:%M:%S")) + } + + public clearInfo() { + this.uploadButton.setEnable(true); + this.fileInfo.setVisible(false); + this.textEditor.setValue(''); + this.options.attachId = ''; + } + + public setErrorInfo(errorInfo: any) { + this.errorInfo.setVisible(true); + this.errorCode.setText(BI.i18nText("Dec-Dcm_Connection_File_Upload_ErrorCode") + ":"+ errorInfo.errorCode); + this.errorMsg.setText(BI.i18nText("Dec-Dcm_Connection_File_Upload_ErrorMsg") + ":" + errorInfo.errorMessage); + } + + public setEnable(v) { + this.uploadButton._setEnable(v); + } + + public setFileInfo(params) { + this.store.setFileInfo(params); + } +} + +BI.shortcut("dec.dcm.components.file_upload", FileUpload); diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 43d6dee..339f02a 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -192,6 +192,10 @@ export type ConnectionJDBC ={ * 秘钥路径 */ keyPath?: string; + /** + * krb5.conf文件 + */ + krb5Path?: string; /** * fetchSize */ diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 7301526..5a5c8ce 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -120,6 +120,10 @@ export class DecisionApi implements Api { return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name]; } + changePrincipal(value: any) { + return requestPost(`switch/principal`, value); + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 4e6c4a6..1f39f08 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -11,6 +11,7 @@ import { FileChooser } from '../../../../components/file_chooser/file_chooser'; import { ApiFactory } from 'src/modules/crud/apiFactory'; import { Editor, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout, MultiSelectItem } from '@fui/core'; import { DriverSelector } from '../../components/driverselector/driverselector'; +import { FileUpload } from '../../../../components/file_upload/file_upload'; const api = new ApiFactory().create(); @@ -37,6 +38,7 @@ export class FormJdbc extends BI.Widget { formPassword: FormItem; formPrincipal: FormItem; formKeyPath: FormItem; + formKrb5File: FormItem; labelTips: Label; form = { @@ -50,6 +52,7 @@ export class FormJdbc extends BI.Widget { authType: null, principal: null, keyPath: null, + krb5Path: null, originalCharsetName: null, schema: null, url: null, @@ -99,6 +102,7 @@ export class FormJdbc extends BI.Widget { authType, principal, keyPath, + krb5Path, fetchSize, // ssh usingSsh = false, @@ -316,9 +320,10 @@ export class FormJdbc extends BI.Widget { const type = this.form.authType.getValue()[0]; this.formPrincipal.setVisible(!!type); this.formKeyPath.setVisible(!!type); + this.formKrb5File.setVisible(!!type); + this.form.krb5Path.setEnable(!type); this.formUser.setVisible(!type); this.formPassword.setVisible(!type); - this.labelTips.setVisible(!!type); }, }, ], @@ -373,6 +378,55 @@ export class FormJdbc extends BI.Widget { }, ], }, + // keytab密钥路径 + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + invisible: !authType, + ref: (_ref: FormItem) => { + this.formKeyPath = _ref; + }, + forms: [ + { + type: FileUpload.xtype, + $value: 'key-path', + processId: "keytab", + allowBlank: true, + value: keyPath, + accept: '.keytab', + inter: '/v10/config/connection/upload/keytab?', + iconCls: "data-keytab-file", + watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + ref: (_ref: FileUpload) => { + this.form.keyPath = _ref; + }, + listeners: [ + { + eventName: FileUpload.EVENT_CHECK_SUCCESS, + action: (value) => { + var principalsItems = BI.map(value.principals, function(index, item) { + return { + text: item, + value: item + } + }) + this.form.principal.populate(principalsItems); + this.form.principal.setValue(principalsItems[0].value); + this.setKerberos(); + this.form.krb5Path.setEnable(true); + }, + }, { + eventName: FileUpload.EVENT_CLEAR_FILE, + action: () => { + this.form.krb5Path.setEnable(false); + this.form.principal.populate(); + this.form.principal.setValue(); + } + } + ] + }, + ], + }, // 客户端principal { type: FormItem.xtype, @@ -383,52 +437,57 @@ export class FormJdbc extends BI.Widget { }, forms: [ { - type: BI.TextEditor.xtype, + type: BI.TextValueCombo.xtype, $value: 'principal', width: 300, - allowBlank: true, value: principal, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_Principal'), ref: (_ref: TextEditor) => { this.form.principal = _ref; }, - }, + listeners: [ + { + eventName: BI.Combo.EVENT_CHANGE, + action: () => { + this.changePrincipal(); + this.setKerberos(); + }, + }, + ], + } ], }, - // keytab密钥路径 + // krb5.conf文件 { type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), + name: BI.i18nText('Dec-Dcm_Connection_Form_Krb5File'), invisible: !authType, ref: (_ref: FormItem) => { - this.formKeyPath = _ref; + this.formKrb5File = _ref; }, forms: [ { - type: BI.Editor.xtype, - $value: 'key-path', - cls: 'bi-border', - width: 300, - height: 20, + type: FileUpload.xtype, + $value: 'krb5-file', + processId: "krb5Conf", allowBlank: true, - value: keyPath, - watermark: BI.i18nText('Dec-Dcm_Connection_Form_KeyPath'), - ref: (_ref: Editor) => { - this.form.keyPath = _ref; + value: krb5Path, + iconCls: "data-conf-file", + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Krb5File'), + ref: (_ref: FileUpload) => { + this.form.krb5Path = _ref; }, - }, - ], - }, - // 关于krb5的提示 - { - type: BI.Label.xtype, - cls: 'bi-tips', - textAlign: 'left', - invisible: true, - text: BI.i18nText('Dec-Dcm_Connection_JDBC_Warning'), - ref: (_ref: Label) => { - this.labelTips = _ref; - }, + inter: '/v10/config/connection/upload/krb5?', + accept: '.conf', + listeners: [ + { + eventName: FileUpload.EVENT_CHECK_SUCCESS, + action: () => { + this.setKerberos(); + }, + } + ] + } + ] }, // 编码 { @@ -1266,6 +1325,30 @@ export class FormJdbc extends BI.Widget { } } + public setKerberos() { + const KerberosParams = BI.extend({},{ + keytabPath: this.form.keyPath.getValue(), + krb5ConfPath: this.form.krb5Path.getValue(), + principal: this.form.principal.getValue()[0] + }); + this.form.krb5Path.setFileInfo(KerberosParams); + this.form.keyPath.setFileInfo(KerberosParams); + } + + public changePrincipal() { + var self = this; + const KerberosParams = BI.extend({},{ + keytabPath: this.form.keyPath.getValue(), + krb5ConfPath: this.form.krb5Path.getValue(), + principal: this.form.principal.getValue()[0] + }); + api.changePrincipal(KerberosParams).then(res =>{ + self.form.keyPath.setValue(res.data.keytabPath); + self.form.krb5Path.setValue(res.data.krb5ConfPath); + }); + + } + public validation(): boolean { const driver = this.form.driver.validation(); const sshSet = !this.form.usingSsh.isSelected() || (this.form.sshIp.getValue() !== '' && this.form.sshPort.getValue() !== ''); @@ -1297,8 +1380,9 @@ export class FormJdbc extends BI.Widget { host: this.form.host.getValue(), authType: this.form.authType.getValue()[0] || '', creator: Dec ? Dec.personal.username : '', - principal: this.form.principal.getValue(), + principal: this.form.principal.getValue()[0], keyPath: this.form.keyPath.getValue(), + krb5Path: this.form.krb5Path.getValue(), fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -2 : BI.parseInt(this.form.fetchSize.getValue()), // ssh usingSsh: this.form.usingSsh.isSelected(), From 912407297dd6bc0d9730002fec61a53e31ca8f2e Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:32:02 +0800 Subject: [PATCH 023/116] =?UTF-8?q?REPORT-72487=20fix:var=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BAlet=E6=88=96const?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/file_upload/file_upload.model.ts | 2 +- .../components/file_upload/file_upload.ts | 16 ++++++++-------- .../pages/maintain/forms/components/form.jdbc.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.model.ts b/src/modules/components/file_upload/file_upload.model.ts index 78d0a75..bf6d905 100644 --- a/src/modules/components/file_upload/file_upload.model.ts +++ b/src/modules/components/file_upload/file_upload.model.ts @@ -23,7 +23,7 @@ export class FileUploadModel extends Model { actions = { setFileInfo: (params: UploadParam) => { - var inter = this.options.inter; + const inter = this.options.inter; this.model.uploadUrl = Dec.Utils.getEncodeURL(Dec.fineServletURL + inter, "", params); }, diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 56265be..e3211a2 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -43,9 +43,9 @@ export class FileUpload extends BI.Widget { public render() { const { width, watermark, value, processId, inter } = this.options; - var self = this; - var processName = BI.concat("process-", processId); - var processClass = BI.concat(".process-", processId); + let self = this; + const processName = BI.concat("process-", processId); + const processClass = BI.concat(".process-", processId); this.setFileInfo({ keytabPath: '', principal:'', @@ -234,7 +234,7 @@ export class FileUpload extends BI.Widget { eventName: BI.MultifileEditor.EVENT_CHANGE, action: function (files) { self.options.attachId = ''; - var fileInfo = files.files[0]; + const fileInfo = files.files[0]; self.setInfo(fileInfo); self.store.setFileName(fileInfo.fileName); this.upload(); @@ -245,7 +245,7 @@ export class FileUpload extends BI.Widget { // 上传进度刷新 eventName: BI.MultifileEditor.EVENT_PROGRESS, action: function (progress) { - var rate = progress.loaded/progress.total; + let rate = progress.loaded/progress.total; NProgress.set(rate); }, }, @@ -260,8 +260,8 @@ export class FileUpload extends BI.Widget { // 上传文件完毕 eventName: BI.MultifileEditor.EVENT_UPLOADED, action: function () { - var uploadedInfo = this.getValue(); - var failed = BI.some(uploadedInfo, function (index, file) { + const uploadedInfo = this.getValue(); + const failed = BI.some(uploadedInfo, function (index, file) { if (file.data.errorCode) { BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Error'), { level: "error", @@ -270,7 +270,7 @@ export class FileUpload extends BI.Widget { return true; } }); - var key = self.options.processId +'Path'; + const key = self.options.processId +'Path'; !failed && self.setValue(uploadedInfo[0].data.kerberosInfo[key]); !failed && self.fireEvent(FileUpload.EVENT_CHECK_SUCCESS, uploadedInfo[0].data); !failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 1f39f08..3e1685d 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -404,7 +404,7 @@ export class FormJdbc extends BI.Widget { { eventName: FileUpload.EVENT_CHECK_SUCCESS, action: (value) => { - var principalsItems = BI.map(value.principals, function(index, item) { + const principalsItems = BI.map(value.principals, function(index, item) { return { text: item, value: item @@ -1336,7 +1336,7 @@ export class FormJdbc extends BI.Widget { } public changePrincipal() { - var self = this; + let self = this; const KerberosParams = BI.extend({},{ keytabPath: this.form.keyPath.getValue(), krb5ConfPath: this.form.krb5Path.getValue(), From 3c4f53a4abc19abbb872bd19bcfafb6d848eb275 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:38:12 +0800 Subject: [PATCH 024/116] =?UTF-8?q?REPORT-72487=20fix:=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index e3211a2..988dbf8 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -89,7 +89,7 @@ export class FileUpload extends BI.Widget { }, text: BI.i18nText('Dec-Basic_Choose_File'), handler: () => { - self.uploader.select(); + this.uploader.select(); }, }, ], @@ -197,7 +197,7 @@ export class FileUpload extends BI.Widget { this.errorMsg = _ref; }, }, { - type: "bi.vertical_adapt", + type: BI.VerticalLayout.xtype, rgap: 5, items: [ { From 16f8d2182332cb728947d0617203284fa2424ec5 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 15:57:18 +0800 Subject: [PATCH 025/116] =?UTF-8?q?REPORT-72487=20fix:=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 988dbf8..ece2282 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -197,7 +197,7 @@ export class FileUpload extends BI.Widget { this.errorMsg = _ref; }, }, { - type: BI.VerticalLayout.xtype, + type: BI.VerticalAdaptLayout.xtype, rgap: 5, items: [ { @@ -276,6 +276,8 @@ export class FileUpload extends BI.Widget { !failed && BI.Msg.toast(uploadedInfo[0].filename + BI.i18nText('Dec-Dcm_Connection_File_Upload_Success'),{ level: "success" }); + NProgress.configure({ parent: 'body'}); + }, }, ], From 598546772cc84e39e29024a1f5bdd31c9ec24496 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 8 Jul 2022 16:06:42 +0800 Subject: [PATCH 026/116] =?UTF-8?q?REPORT-72487=20fix:=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index ece2282..6633d07 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -201,17 +201,17 @@ export class FileUpload extends BI.Widget { rgap: 5, items: [ { - type: "bi.label", + type: BI.Label.xtype, text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip1'), },{ - type: "bi.text_button", + type: BI.TextButton.xtype, cls: "bi-high-light bi-high-light-border-bottom", text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip2'), handler: function () { window.open(Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][DecCst.Hyperlink.KERBEROS_CONF_HELP]); }, },{ - type: "bi.label", + type: BI.Label.xtype, text: BI.i18nText('Dec-Dcm_Connection_File_Upload_ErrorTip3'), } ], From fa84ddb63b53cb8c516aa68b23cdbe536d36a733 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Tue, 12 Jul 2022 10:30:47 +0800 Subject: [PATCH 027/116] =?UTF-8?q?REPORT-74590=20fix:=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96key=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintain/components/driverselector/driverselector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 862dc6a..7eac368 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -121,11 +121,11 @@ export class DriverSelector extends BI.Widget { }, invisible: this.model.driverSource === '', width: 204, - watermark: BI.i18nText('Dec-Please_Select_One'), + watermark: BI.i18nText('Dec-Please_Input'), items: this.model.driverClassItems, value: this.model.customDriver.value, text: () => this.model.customDriver.value || '', - defaultText: BI.i18nText('Dec-Please_Select'), + defaultText: BI.i18nText('Dec-Please_Select_One'), warningTitle: BI.i18nText('Dec-Dcm-Driver_Driver_File_Lost'), listeners: [ { From af840451ad28be0df9af8c23411484f600639ed5 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 14 Jul 2022 11:24:22 +0800 Subject: [PATCH 028/116] =?UTF-8?q?REPORT-75736=20fix:=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=94=B9=E4=B8=BA=E4=B8=8A=E4=BC=A0=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 6633d07..f81f622 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -302,7 +302,7 @@ export class FileUpload extends BI.Widget { this.textEditor.setValue(info.fileName); this.fileName.setText(info.fileName); this.fileSize.setText(Dec.Utils.getByteWidthUnit(info.size)); - this.fileModified.setText(BI.getDate(info.lastModified).print("%Y-%X-%d %H:%M:%S")) + this.fileModified.setText(BI.getDate().print("%Y-%X-%d %H:%M:%S")) } public clearInfo() { From 27871652ab2f91fd0a9c11d7dced6fa68879a9f7 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 18 Jul 2022 18:52:19 +0800 Subject: [PATCH 029/116] =?UTF-8?q?REPORT-75699=20fix:=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=97=B6principal=E5=80=BC=E4=B8=8E=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/decision.api.ts | 4 ++++ .../pages/maintain/forms/components/form.jdbc.ts | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 5a5c8ce..d399399 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -124,6 +124,10 @@ export class DecisionApi implements Api { return requestPost(`switch/principal`, value); } + getPrincipals(keytab: string) { + return requestGet(`/principals?keytabPath=${keytab}`, {}); + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 3e1685d..9415eb7 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -121,6 +121,7 @@ export class FormJdbc extends BI.Widget { } = connectionData as ConnectionJDBC; this.oldPassword = password; this.oldSshSecret = sshSecret; + !BI.isUndefined(principal) && this.getPrincipals(keyPath, principal); const { initialSize, @@ -1335,6 +1336,20 @@ export class FormJdbc extends BI.Widget { this.form.keyPath.setFileInfo(KerberosParams); } + public getPrincipals(keyPath, principal) { + let self = this; + api.getPrincipals(keyPath).then(res => { + const principalsItems = BI.map(res.data, function(index, item) { + return { + text: item, + value: item + } + }); + self.form.principal.populate(principalsItems); + self.form.principal.setValue(principal); + }) + } + public changePrincipal() { let self = this; const KerberosParams = BI.extend({},{ From 787aa83b90e8f4778373ae9ce14f37100339d5c8 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Tue, 19 Jul 2022 09:50:17 +0800 Subject: [PATCH 030/116] =?UTF-8?q?REPORT-75699=20fix:=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 9415eb7..fdfce5c 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -121,7 +121,7 @@ export class FormJdbc extends BI.Widget { } = connectionData as ConnectionJDBC; this.oldPassword = password; this.oldSshSecret = sshSecret; - !BI.isUndefined(principal) && this.getPrincipals(keyPath, principal); + !BI.isUndefined(principal) && this.initPrincipals(keyPath, principal); const { initialSize, @@ -1336,7 +1336,7 @@ export class FormJdbc extends BI.Widget { this.form.keyPath.setFileInfo(KerberosParams); } - public getPrincipals(keyPath, principal) { + public initPrincipals(keyPath, principal) { let self = this; api.getPrincipals(keyPath).then(res => { const principalsItems = BI.map(res.data, function(index, item) { From 8158bc5a03e5f58349445106196d74172422e892 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Wed, 10 Aug 2022 14:11:43 +0800 Subject: [PATCH 031/116] =?UTF-8?q?REPORT-75699=20fix:=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E9=87=8D=E5=A4=8D=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index f81f622..9a6b406 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -326,5 +326,3 @@ export class FileUpload extends BI.Widget { this.store.setFileInfo(params); } } - -BI.shortcut("dec.dcm.components.file_upload", FileUpload); From 10098674456884dbf462cd67a1ac7eefefaa7835 Mon Sep 17 00:00:00 2001 From: "Kevin.King" Date: Sat, 13 Aug 2022 15:06:51 +0800 Subject: [PATCH 032/116] =?UTF-8?q?REPORT-77480=20fix:SSRF=E6=BC=8F?= =?UTF-8?q?=E6=B4=9E=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/test_status/test_status.ts | 13 ++++++++++--- .../components/test_status/tip_icon/tip_fail.ts | 11 +++++++++-- src/modules/pages/maintain/forms/form.server.ts | 4 ++++ src/modules/pages/maintain/forms/form.ts | 10 ++++++++++ webpack/webpack.dev.js | 2 +- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/modules/components/test_status/test_status.ts b/src/modules/components/test_status/test_status.ts index 0cfba82..96b32af 100644 --- a/src/modules/components/test_status/test_status.ts +++ b/src/modules/components/test_status/test_status.ts @@ -29,6 +29,7 @@ export class TestStatus extends BI.Widget { failDriverMessage: Label; driverLink: FloatLeftLayout; detail: VerticalLayout; + failMaskers:any; watch = { status: (status: string) => { @@ -38,7 +39,7 @@ export class TestStatus extends BI.Widget { render() { const { loadingCls, loadingText, successCls, successText, failCls, failText, retryText } = this.options; - + var self=this; return { type: BI.CenterAdaptLayout.xtype, cls: 'bi-z-index-mask', @@ -51,7 +52,7 @@ export class TestStatus extends BI.Widget { cls: 'bi-card', width: 450, height: 250, - single: true, + // single: true, showIndex: this.model.status, ref: (_ref: Tab) => { this.tab = _ref; @@ -70,6 +71,12 @@ export class TestStatus extends BI.Widget { tipCls: failCls, tipText: failText, retryText, + ref:(_ref:any)=>{ + self.failMaskers=_ref; + if(this.failMessage.getText()===''){ + this.failMaskers.populateFail(BI.i18nText("Dec-Connect-Failed"),false); + } + }, listeners: [ { eventName: TipFail.EVENT_RELOAD, @@ -168,7 +175,7 @@ export class TestStatus extends BI.Widget { this.store.setStatus(TEST_STATUS.SUCCESS); } - setFail(message: string, driver = '', link = '') { + setFail(message: string='', driver = '', link = '') { this.store.setStatus(TEST_STATUS.FAIL); this.failMessage.setText(message); this.failDriverMessage.setVisible(!!driver); diff --git a/src/modules/components/test_status/tip_icon/tip_fail.ts b/src/modules/components/test_status/tip_icon/tip_fail.ts index 05ef93f..f8a77f3 100644 --- a/src/modules/components/test_status/tip_icon/tip_fail.ts +++ b/src/modules/components/test_status/tip_icon/tip_fail.ts @@ -1,5 +1,5 @@ import { shortcut, store } from '@core/core'; -import { Button } from '@fui/core'; +import { Button, Label } from '@fui/core'; import { TipFailModel } from './tip_fail.model'; @shortcut() @@ -21,7 +21,7 @@ export class TipFail extends BI.Widget { store: TipFailModel['store']; detailButton: Button; - + failText:Label; watch = { isCollapse: (isCollapse: boolean) => { this.detailButton.setText(isCollapse ? @@ -29,6 +29,10 @@ export class TipFail extends BI.Widget { BI.i18nText('Dec-Dcm_Connection_Detailed_Information')); }, } + populateFail(text:string,isVisible:boolean){ + this.failText.setText(text); + this.detailButton.setVisible(isVisible); + } render() { const { tipCls, tipText, retryText } = this.options; @@ -53,6 +57,9 @@ export class TipFail extends BI.Widget { height: 14, bgap: 10, text: tipText, + ref:(_ref:Label)=>{ + this.failText=_ref; + } }, { type: BI.VerticalAdaptLayout.xtype, diff --git a/src/modules/pages/maintain/forms/form.server.ts b/src/modules/pages/maintain/forms/form.server.ts index d378768..67647fc 100644 --- a/src/modules/pages/maintain/forms/form.server.ts +++ b/src/modules/pages/maintain/forms/form.server.ts @@ -20,6 +20,10 @@ export function testConnection(value: Connection): Promise { const formValue = value; api.testConnection(formValue).then(re => { if (re && re.errorCode) { + if(re.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ + testStatus.setFail(); + return; + } // 判断是否是缺少驱动,如果缺少驱动则显示下载驱动的连接 if (api.isDriverError(re.errorCode)) { if (formValue.connectionType === connectionType.JDBC) { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 5cc3b2a..9ac3908 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -38,6 +38,11 @@ export class MaintainForm extends BI.Widget { value.creator = BI.get(this.getFormData(), 'creator'); this.store.updateConnection(this.connectionName, value).then(result => { if (result.errorCode) { + if(result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"),{ + level: "error", + }); + } this.showError(result); return; @@ -253,6 +258,11 @@ export class MaintainForm extends BI.Widget { private addConnection(form: Connection) { this.store.addConnection(form).then(result => { if (result.errorCode) { + if(result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"),{ + level: "error", + }); + } if (result.errorCode === errorCode.DUPLICATE_NAMES) { if (form.connectionType !== connectionType.JDBC && form.connectionType !== connectionType.JNDI) { // 如果不是jdbc或jndi,即如果是插件,名称重复的时候需要修改名字重新提交给后台 diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index 2d280f8..39912ca 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: ['./src/i18n.ts', './src/request.ts', './src/modules/app.ts'], }, output: { path: dirs.DEST, From 50debb93e9bf850838668bad3ae5073f7729d1a8 Mon Sep 17 00:00:00 2001 From: "Kevin.King" Date: Sat, 13 Aug 2022 15:21:09 +0800 Subject: [PATCH 033/116] =?UTF-8?q?REPORT-77480=20fix:SSRF=E6=BC=8F?= =?UTF-8?q?=E6=B4=9E=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/test_status/test_status.ts | 2 +- webpack/webpack.dev.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/components/test_status/test_status.ts b/src/modules/components/test_status/test_status.ts index 96b32af..8929f7d 100644 --- a/src/modules/components/test_status/test_status.ts +++ b/src/modules/components/test_status/test_status.ts @@ -74,7 +74,7 @@ export class TestStatus extends BI.Widget { ref:(_ref:any)=>{ self.failMaskers=_ref; if(this.failMessage.getText()===''){ - this.failMaskers.populateFail(BI.i18nText("Dec-Connect-Failed"),false); + this.failMaskers.populateFail(BI.i18nText("Dec-Conn-ect-Failed"),false); } }, listeners: [ diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index 39912ca..2d280f8 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/modules/app.ts'], + show: ['./src/i18n.ts', './src/request.ts', './src/index.ts'], }, output: { path: dirs.DEST, From 0708799d067ea221d60bba81320b4b88cdd08d82 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 15 Aug 2022 16:01:04 +0800 Subject: [PATCH 034/116] =?UTF-8?q?REPORT-78047=20fix:greenplum=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5url=E8=87=AA=E5=8A=A8=E6=8B=BC=E5=86=99=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0DatabaseName=3D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 2 +- src/modules/constants/constant.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index d36a9f8..18a03af 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -16,7 +16,7 @@ BI.provider('dec.connection.provider.datebase', function() { }; } - const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;)([^]+)(.*)/i); + const greenplumUrl = url.match(/^jdbc:(pivotal:greenplum):(thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\/|;DatabaseName=)?([^]+)(.*)/i); if (greenplumUrl) { return { host: greenplumUrl[4], diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 4fabf64..2394339 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -537,7 +537,7 @@ export const DATA_BASE_TYPES = [ kerberos: false, urls: { 'org.postgresql.Driver': 'jdbc:postgresql://hostname:port/dbname', - 'com.pivotal.jdbc.GreenplumDriver': 'jdbc:pivotal:greenplum://hostname:port;dbname', + 'com.pivotal.jdbc.GreenplumDriver': 'jdbc:pivotal:greenplum://hostname:port;DatabaseName=dbname', }, }, { text: 'Postgresql', From 08c8df4012fbd86f11a2c68312eb60965c303c84 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 15 Aug 2022 16:29:09 +0800 Subject: [PATCH 035/116] =?UTF-8?q?BI-108526=20BI-111537=20feat:=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0trino=20tdsql=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 4fabf64..1615dc6 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -692,6 +692,29 @@ export const DATA_BASE_TYPES = [ 'org.sqlite.JDBC': 'jdbc:sqlite:[PATH_TO_DB_FILES]', }, }, + { + text: 'trino', + databaseType: 'trino', + driver: 'io.trino.jdbc.TrinoDriver', + url: 'jdbc:trino://hostname:port/database', + commonly: false, + internal: true, + type: 'jdbc', + hasSchema: true, + kerberos: false, + }, + { + text: BI.i18nText('Dec-Dcm_Connection_TDSQL'), + databaseType: 'tdsql', + driver: 'org.postgresql.Driver', + url: 'jdbc:postgresql://hostname:port/database', + commonly: false, + internal: true, + type: 'jdbc', + hasSchema: true, + kerberos: false, + fetchSize: 10000, + } ]; From 49e216478ce0c763d40d7aea24d54fd0c049efd2 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Tue, 30 Aug 2022 15:08:29 +0800 Subject: [PATCH 036/116] =?UTF-8?q?BI-112953=20fix:jdbcResolve=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E5=8C=B9=E9=85=8Dtrino?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 18a03af..e888267 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -25,7 +25,7 @@ BI.provider('dec.connection.provider.datebase', function() { urlInfo: greenplumUrl[9], }; } - const result = url.match(/^jdbc:(mysql|sqlserver|db2|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse):(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|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse|trino):(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 9deb4cb5b319fd783264303caddf527ba17bd829 Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Tue, 20 Sep 2022 13:55:40 +0800 Subject: [PATCH 037/116] =?UTF-8?q?BI-112056=E3=80=90=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E5=90=88=E4=BB=BB=E5=8A=A1=E3=80=91=E5=9C=A8=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?starrocks=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 064d448..48b7ded 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -714,6 +714,18 @@ export const DATA_BASE_TYPES = [ hasSchema: true, kerberos: false, fetchSize: 10000, + }, + { + text: BI.i18nText('StarRocks'), + databaseType: 'starrocks', + driver: 'com.mysql.jdbc.Driver', + drivers: ['com.mysql.jdbc.Driver'], + url: 'jdbc:mysql://hostname:port/database', + commonly: false, + internal: true, + type: 'jdbc', + hasSchema: false, + kerberos: false, } ]; From 2e7097acc3b07e5ced6551f29062f02ca23066bb Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Wed, 28 Sep 2022 11:37:56 +0800 Subject: [PATCH 038/116] =?UTF-8?q?REPORT-79641=20fix:KerberosParams?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=89=8D=E9=9C=80=E8=A6=81=E8=A2=AB=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index fdfce5c..277f1a7 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1227,6 +1227,7 @@ export class FormJdbc extends BI.Widget { public mounted() { const sshType = this.form.sshType.getValue()[0]; this.onSshTypeChange(sshType); + this.setKerberos(); } public setError(value: string) { From 00c48eee0ccbe3d5fe45f0340b5930e4f91f91e4 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 14 Oct 2022 17:00:13 +0800 Subject: [PATCH 039/116] =?UTF-8?q?REPORT-81743=20fix:=E7=94=A8buttongroup?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2listview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/maintain.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/pages/maintain/maintain.ts b/src/modules/pages/maintain/maintain.ts index 98ff521..28b47b9 100644 --- a/src/modules/pages/maintain/maintain.ts +++ b/src/modules/pages/maintain/maintain.ts @@ -9,7 +9,7 @@ import './maintain.less'; import { connectionType } from '@constants/env'; import { getJdbcDatabaseType, getTextByDatabaseType } from '../../app.service'; import { ConnectionJDBC } from 'src/modules/crud/crud.typings'; -import { ListView } from '@fui/core'; +import { ButtonGroup } from '@fui/core'; @shortcut() @store(MaintainModel) @@ -19,7 +19,7 @@ export class Maintain extends BI.Widget { model: MaintainModel['model']; store: MaintainModel['store']; - listView: ListView; + buttonGroup: ButtonGroup; socketTip: LinkButton; render() { @@ -64,9 +64,9 @@ export class Maintain extends BI.Widget { ], }, { - type: BI.ListView.xtype, - ref: (_ref: ListView) => { - this.listView = _ref; + type: BI.ButtonGroup.xtype, + ref: (_ref: ButtonGroup) => { + this.buttonGroup = _ref; }, items: this.renderItems(), }, From aed9cbd4b5cbf65981e62e11213bf41bfc2a811b Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Wed, 19 Oct 2022 15:07:31 +0800 Subject: [PATCH 040/116] =?UTF-8?q?BI-115632=20fix:jdbcResolve=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=80=82=E9=85=8DSAPHANA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index e888267..f3e9a60 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -35,6 +35,17 @@ BI.provider('dec.connection.provider.datebase', function() { }; } + // 处理SAP HANA数据连接url + const sapHanaUrl = url.match(/^jdbc:(sap):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?([^]+)?(.*)/i); + if (sapHanaUrl) { + return { + host: sapHanaUrl[5], + port: sapHanaUrl[7] === 'port' ? '' : sapHanaUrl[7], + databaseName: '', + urlInfo: sapHanaUrl[9], + }; + } + // 处理oracle的RAC方式 if (/^jdbc:oracle:thin:([0-9a-zA-Z/]*)?@\(DESCRIPTION/i.test(url)) { const host = url.match(/\(HOST\s*=\s*([0-9a-zA-Z_\\.-]+)\)/i); From 566b8b9ed64372dcfb32c68bc2e33a2ae79495e7 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 24 Oct 2022 14:55:01 +0800 Subject: [PATCH 041/116] =?UTF-8?q?REPORT-82479=20feat:=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=B6=85=E6=97=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 4 +- src/modules/app.ts | 24 +++++++ src/modules/crud/decision.api.ts | 8 +++ src/modules/pages/setting/setting.ts | 94 ++++++++++++++++++++++++++++ src/modules/title/title.ts | 8 +++ 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 src/modules/pages/setting/setting.ts diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 3170f13..7e5e8a1 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -311,4 +311,6 @@ Dec-Dcm_Connection_Value_Out_Range=数值超出范围 Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突 Dec-Dcm_Connection_File_Upload_ErrorTip1= 参考 Dec-Dcm_Connection_File_Upload_ErrorTip2= kerberos配置 -Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 \ No newline at end of file +Dec-Dcm_Connection_File_Upload_ErrorTip3= 获取帮助或联系技术支持 +Dec-Dcm_Connection_Timeout_Detection=数据连接超时检测 +Dec-Dcm_Connection_Timeout_Millisecond=毫秒(ms) \ No newline at end of file diff --git a/src/modules/app.ts b/src/modules/app.ts index c347927..5155f5b 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -7,6 +7,7 @@ import { Tab } from '@fui/core'; import { Datebase } from './pages/database/database'; import { Maintain } from './pages/maintain/maintain'; import { ConnectionPool } from './pages/connection_pool/connection_pool'; +import { TimeOutSetting } from './pages/setting/setting'; import './app.provider'; import '../less/index.less'; @@ -38,6 +39,12 @@ export class App extends BI.Widget { el: { type: Title.xtype, cls: 'bi-border-bottom', + listeners: [{ + eventName: 'EVENT_CLICK_SETTING', + action:() => { + this._setting(); + }, + }] }, height: 40, }, @@ -84,4 +91,21 @@ export class App extends BI.Widget { ], }; } + + private _setting() { + const settingLayerId = BI.UUID(); + BI.Layers.create(settingLayerId, null, { + container: this, + render: { + type: TimeOutSetting.xtype, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + BI.Layers.remove(settingLayerId); + }, + }], + }, + }, this); + BI.Layers.show(settingLayerId); + } } diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index d399399..3ad6470 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -128,6 +128,14 @@ export class DecisionApi implements Api { return requestGet(`/principals?keytabPath=${keytab}`, {}); } + getTimeOut(): Promise<{ data?: any }> { + return requestGet('kdc/timeout', {}); + } + + putTimeOut(value: number) { + return requestPut(`kdc/timeout?timeout=${value}`, {}) + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts new file mode 100644 index 0000000..eaddc96 --- /dev/null +++ b/src/modules/pages/setting/setting.ts @@ -0,0 +1,94 @@ +import { shortcut } from '@core/core'; +import { ApiFactory } from 'src/modules/crud/apiFactory'; + +const api = new ApiFactory().create(); + +@shortcut() +export class TimeOutSetting extends BI.Widget { + public static xtype = 'dec.dcm.page.timeout.setting'; + + public props = { + value: 0, + }; + + beforeRender(cb: Function) { + const self = this; + api.getTimeOut().then(res => { + self.props.value = res.data.count; + cb(); + }); + } + + public render() { + const { value } = this.props; + const self = this; + + return { + type: 'bi.vtape', + cls: 'bi-background', + items: [{ + type: 'dec.setting.header', + height: 40, + listeners: [{ + eventName: 'EVENT_CANCEL', + action: function () { + self.fireEvent('EVENT_CHANGE'); + }, + }, { + eventName: 'EVENT_SAVE', + action: function () { + api.putTimeOut(Number(self.editor.getValue())); + self.fireEvent('EVENT_CHANGE'); + }, + }], + }, { + type: 'bi.vertical', + cls: 'bi-card', + hgap: 10, + vgap: 10, + items: [ + { + type: 'bi.vertical_adapt', + cls: 'bi-border-bottom', + height: 32, + items: [{ + type: 'bi.label', + textAlign: 'left', + width: 120, + cls: 'dec-font-weight-bold', + text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), + }] + }, + { + type: 'bi.vertical_adapt', + items: [{ + type: 'dec.label.editor.item', + text: BI.i18nText('Dec-Over_Time'), + textWidth: 100, + editorWidth: 80, + allowBlank: false, + value: value, + validationChecker: function(v) { + return BI.isPositiveInteger(v); + }, + errorText: BI.i18nText('BI-Please_Input_Positive_Integer'), + ref: function (_ref) { + self.editor = _ref; + }, + }, { + el: { + type: 'bi.label', + text: BI.i18nText('Dec-Dcm_Connection_Timeout_Millisecond'), + }, + lgap: 10, + }] + + }, + ] + }], + ref: function (_ref) { + self.setting = _ref; + }, + }; + } +} \ No newline at end of file diff --git a/src/modules/title/title.ts b/src/modules/title/title.ts index dc85b0f..73d936b 100644 --- a/src/modules/title/title.ts +++ b/src/modules/title/title.ts @@ -31,6 +31,14 @@ export class Title extends BI.Widget { type: BI.LeftRightVerticalAdaptLayout.xtype, items: { left: [ + { + type: 'bi.icon_button', + cls: 'setting-font', + _lgap: 15, + handler: () => { + this.fireEvent('EVENT_CLICK_SETTING'); + }, + }, { type: BI.LinearSegment.xtype, cls: 'bi-font-bold', From d79323b53c190664ce040d1b9e2267b2ce83070b Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 4 Nov 2022 16:31:20 +0800 Subject: [PATCH 042/116] =?UTF-8?q?REPORT-83276=20fix:=E4=BF=AE=E5=A4=8DFi?= =?UTF-8?q?leUpload=E7=BB=84=E4=BB=B6errorInfo=E6=9C=AA=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_upload/file_upload.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 9a6b406..01892c0 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -157,8 +157,6 @@ export class FileUpload extends BI.Widget { handler: function () { NProgress.set(0.0); self.xhr.abort(); - self.uploadButton.setEnable(true); - self.fileInfo.setVisible(false); self.store.setFileName(''); self.clearInfo(); self.fireEvent(FileUpload.EVENT_CLEAR_FILE); @@ -308,6 +306,7 @@ export class FileUpload extends BI.Widget { public clearInfo() { this.uploadButton.setEnable(true); this.fileInfo.setVisible(false); + this.errorInfo.setVisible(false); this.textEditor.setValue(''); this.options.attachId = ''; } From 5dd6a58ef965f17c352ef05356fe7d350aa48cd1 Mon Sep 17 00:00:00 2001 From: "Kevin.King" Date: Mon, 7 Nov 2022 10:37:39 +0800 Subject: [PATCH 043/116] =?UTF-8?q?BI-116671=20fix:=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=AE=A1=E7=90=86-=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=95=8C=E9=9D=A2=E5=9C=A8?= =?UTF-8?q?IE=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=8B=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=9C=80=E5=8F=B3=E4=BE=A7=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=92=8C=E4=BF=9D=E5=AD=98=E9=83=A8=E5=88=86=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/title/title.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/title/title.ts b/src/modules/title/title.ts index 73d936b..687e2e8 100644 --- a/src/modules/title/title.ts +++ b/src/modules/title/title.ts @@ -78,6 +78,7 @@ export class Title extends BI.Widget { type: BI.Tab.xtype, height: 40, showIndex: this.model.pageIndex, + width:200, ref: (_ref: Tab) => { this.tab = _ref; }, From e7a20272cfd045a4b82b3901f6d9df035210d944 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 24 Nov 2022 16:50:45 +0800 Subject: [PATCH 044/116] =?UTF-8?q?REPORT-85441=20fix:clickhouse=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5url=E6=B7=BB=E5=8A=A0database?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 48b7ded..9f5f5b0 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -279,7 +279,7 @@ export const DATA_BASE_TYPES = [ text: 'ClickHouse', databaseType: 'clickhouse', driver: 'ru.yandex.clickhouse.ClickHouseDriver', - url: 'jdbc:clickhouse://hostname:port', + url: 'jdbc:clickhouse://hostname:port/database', commonly: false, internal: true, type: 'jdbc', From 75c06d9318e3d9872a2ee20d2c31f9b14d7d50c2 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 25 Nov 2022 14:15:27 +0800 Subject: [PATCH 045/116] =?UTF-8?q?REPORT-85619=20feat:=20=E6=8B=93?= =?UTF-8?q?=E5=B1=95=E4=B8=8B=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index f3e9a60..791d2be 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -1,10 +1,11 @@ import { CONSTANT_PLUGIN_TYPES } from './app.constant'; +import { DATA_BASE_TYPES } from '@constants/constant'; -BI.provider('dec.connection.provider.datebase', function() { +BI.provider('dec.connection.provider.datebase', function () { this.resolves = {}; // 原service中resolveUrlInfo方法 - function jdbcResolve (url: string) { + function jdbcResolve(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); if (oracleUlr) { @@ -68,14 +69,35 @@ BI.provider('dec.connection.provider.datebase', function() { }; } + function coverBaseDatabase(config) { + const baseDataBase = DATA_BASE_TYPES.find(item => item.text === config.text); + if (BI.isNotNull(baseDataBase)) { + // 覆盖基础配置 + Object.assign(baseDataBase, config); + + return true; + } + + return false; + } + this.registerDatabaseType = (config: any) => { + if (coverBaseDatabase(config)) return; + BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); }; this.registerJdbcDatabase = (config: any, resolve?: Function) => { - BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, { ...config, type: 'jdbc' })); + config = { + ...config, + type: 'jdbc', + }; BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); + + if (coverBaseDatabase(config)) return; + + BI.config(CONSTANT_PLUGIN_TYPES, connections => BI.concat(connections, config)); }; this.$get = () => BI.inherit(BI.OB, { From bd0a0f0e17e609afa433d52bc596e0d8e7710cda Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 25 Nov 2022 14:57:12 +0800 Subject: [PATCH 046/116] =?UTF-8?q?REPORT-85200=20fix:=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=8C=E5=88=9D=E5=A7=8B=E5=8C=96=E8=BF=9E=E6=8E=A5=E6=95=B0?= =?UTF-8?q?=E3=80=8D=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 3 ++- 1 file changed, 2 insertions(+), 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 277f1a7..90ea1b2 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1001,7 +1001,8 @@ export class FormJdbc extends BI.Widget { { el: { type: BI.VerticalLayout.xtype, - bgap: vgap, + vgap: vgap, + top: -15, invisible: true, ref: (_ref: VerticalLayout) => { this.advancedSet = _ref; From 7f467dab3437d3a4464f5eb49c1365a1f7efb8bf Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 5 Jan 2023 19:11:15 +0800 Subject: [PATCH 047/116] =?UTF-8?q?REPORT-86591=20fix:tdsql=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E6=9B=B4=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 9f5f5b0..0baab99 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -704,7 +704,7 @@ export const DATA_BASE_TYPES = [ kerberos: false, }, { - text: BI.i18nText('Dec-Dcm_Connection_TDSQL'), + text: 'TDSQL', databaseType: 'tdsql', driver: 'org.postgresql.Driver', url: 'jdbc:postgresql://hostname:port/database', From 9f5eb9077d661a8c563bf262c27dfca2c3213de2 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 6 Jan 2023 16:14:51 +0800 Subject: [PATCH 048/116] =?UTF-8?q?REPORT-87662=20feat:=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.typings.d.ts | 6 +- src/modules/components/collapse/collapse.ts | 4 + .../connection_jdbc/connection_jdbc.ts | 22 +++-- .../driverselector/driverselector.model.ts | 14 +++- .../driverselector/driverselector.ts | 11 +++ .../maintain/forms/components/form.jdbc.ts | 84 ++++++++++++++----- 6 files changed, 109 insertions(+), 32 deletions(-) diff --git a/src/modules/app.typings.d.ts b/src/modules/app.typings.d.ts index 67a5665..f4d0fda 100644 --- a/src/modules/app.typings.d.ts +++ b/src/modules/app.typings.d.ts @@ -8,9 +8,13 @@ export interface DatabaseType { internal: boolean; type: string; hasSchema?: boolean; + hasSchemas?: { + [key: string]: boolean; + }; kerberos?: boolean; iconUrl?: string; + versions?: string[]; urls?: { [key: string]: string; - } + }; } diff --git a/src/modules/components/collapse/collapse.ts b/src/modules/components/collapse/collapse.ts index 58e8db1..edaa9e5 100644 --- a/src/modules/components/collapse/collapse.ts +++ b/src/modules/components/collapse/collapse.ts @@ -64,4 +64,8 @@ export class Collapse extends BI.BasicButton { doClick() { this.store.setCollapse(!this.model.isCollapse); } + + setCollapse(v: boolean) { + this.store.setCollapse(v); + } } diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index dd6f50a..9651233 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -52,7 +52,8 @@ export class ConnectionJdbc extends BI.Widget { sslClientCertificate, } = connectionData; const databaseType = getJdbcDatabaseType(database, driver); - const { host, port, databaseName } = resolveUrlInfo(url, database); + const { host, port, databaseName, version } = resolveUrlInfo(url, database); + this.version = !BI.isUndefined(databaseType.versions) ? (version ?? databaseType.versions[0]) : version; const { hgap, vgap } = CONNECTION_LAYOUT; return { @@ -62,6 +63,13 @@ export class ConnectionJdbc extends BI.Widget { items: [ { type: FormItem.xtype, + name: BI.i18nText('Dec-Basic_Version'), + invisible: BI.isUndefined(this.version), + value: BI.i18nText('Dec-Migration_Database_Version', this.version), + }, + { + type: FormItem.xtype, + _tgap: BI.isUndefined(this.version) ? vgap : 0, name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, }, @@ -82,13 +90,13 @@ export class ConnectionJdbc extends BI.Widget { }, authType ? { - type: FormItem.xtype, - name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), - value: authType, - } + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_AuthType'), + value: authType, + } : { - type: BI.Layout.xtype, - }, + type: BI.Layout.xtype, + }, { type: FormItem.xtype, name: authType ? BI.i18nText('Dec-Dcm_Connection_Form_Principal') : BI.i18nText('Dec-Dcm_Connection_Form_UserName'), diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts index 382f439..15b164e 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts @@ -87,6 +87,12 @@ export class DriverSelectorModel extends Model { changeDriverSource: driverTypeComboValue => { this.model.driverSource = driverTypeComboValue === 'default' ? '' : this.model.driverSource; }, + + setDefaultDrivers: version => { + const defaultDrivers = this.getDrivers(version); + this.model.defaultDrivers = defaultDrivers; + this.changeDefaultDriver(defaultDrivers[0]?.value); + } }; private resolveSelectedDriverType = () => { @@ -97,11 +103,12 @@ export class DriverSelectorModel extends Model { return [this.options.driverSource, this.options.driver]; }; - private getDrivers = () => { + private getDrivers = (version?: string) => { const connectionData = this.options.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); + const selectedVersion = version ?? this.options.version; const drivers = connectionType.drivers ? - connectionType.drivers.map(item => { + (BI.isUndefined(connectionType.versions) ? connectionType.drivers : connectionType.drivers[selectedVersion]).map(item => { return { text: item, value: item, @@ -111,8 +118,7 @@ export class DriverSelectorModel extends Model { text: connectionType.driver, value: connectionType.driver, }]; - - if (!drivers.some(item => item.text === connectionData.driver)) { + if (BI.isUndefined(connectionType.versions) && !drivers.some(item => item.text === connectionData.driver)) { return [ { text: connectionData.driver, diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 7eac368..8408e05 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -24,6 +24,7 @@ export class DriverSelector extends BI.Widget { driver: '', driverSource: '', connectionData: {} as ConnectionJDBC, + version: '', }; defaultDrivers: EditorIconCheckCombo = null; @@ -43,6 +44,12 @@ export class DriverSelector extends BI.Widget { driverManageEntryVisible: b => { this.driverManageEntry.setVisible(b); }, + + defaultDrivers: items => { + this.defaultDrivers.populate(items); + this.defaultDrivers.setValue(this.model.defaultDriver.driver); + this.fireEvent('EVENT_CHANGE'); + } }; private driverManageEntry = null; @@ -182,4 +189,8 @@ export class DriverSelector extends BI.Widget { driver: this.model.driverSource === '' ? this.model.defaultDriver.driver : this.model.customDriver.driver, }; } + + setDefaultDrivers(version: string) { + this.store.setDefaultDrivers(version); + } } diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 90ea1b2..9cf4aad 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -40,9 +40,11 @@ export class FormJdbc extends BI.Widget { formKeyPath: FormItem; formKrb5File: FormItem; labelTips: Label; + schemaForm: FormItem; form = { connectionName: null, + version: null, driver: null, database: null, host: null, @@ -138,8 +140,8 @@ export class FormJdbc extends BI.Widget { } = connectionPoolAttr as ConnectionPoolJDBC; const databaseType = getJdbcDatabaseType(database, driver); this.databaseType = databaseType; - - const { host, port, databaseName } = resolveUrlInfo(url, database); + const { host, port, databaseName, version } = resolveUrlInfo(url, database); + this.version = !BI.isUndefined(databaseType.versions) ? (version ?? databaseType.versions[0]) : version; const { hgap, vgap } = CONNECTION_LAYOUT; const valueRangeConfig = { @@ -171,6 +173,41 @@ export class FormJdbc extends BI.Widget { }, ], }, + // 版本 + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Basic_Version'), + invisible: BI.isUndefined(databaseType.versions), + forms: [ + { + type: BI.TextValueCombo.xtype, + width: 300, + value: this.version, + items: () => databaseType.versions.map(item => { + return { + text: BI.i18nText('Dec-Migration_Database_Version', item), + value: item, + } + }), + ref: (_ref: TextValueCombo) => { + this.form.version = _ref; + }, + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: () => { + const version = this.form.version.getValue()[0]; + this.version = version; + this.sslCollapse.setCollapse(true); + this.sslCollapse.setVisible(this.getSslSetEnabled()); + !BI.isUndefined(databaseType.hasSchemas) && this.schemaForm.setVisible(databaseType.hasSchemas[version]); + this.form.driver.setDefaultDrivers(version); + }, + }, + ], + }, + ], + }, // 驱动 { type: FormItem.xtype, @@ -184,6 +221,7 @@ export class FormJdbc extends BI.Widget { driver, driverSource, connectionData, + version: this.version, listeners: [ { eventName: 'EVENT_CHANGE', @@ -405,7 +443,7 @@ export class FormJdbc extends BI.Widget { { eventName: FileUpload.EVENT_CHECK_SUCCESS, action: (value) => { - const principalsItems = BI.map(value.principals, function(index, item) { + const principalsItems = BI.map(value.principals, function (index, item) { return { text: item, value: item @@ -485,7 +523,7 @@ export class FormJdbc extends BI.Widget { action: () => { this.setKerberos(); }, - } + } ] } ] @@ -510,7 +548,7 @@ export class FormJdbc extends BI.Widget { // 模式 { type: FormItem.xtype, - invisible: !databaseType.hasSchema, + invisible: BI.isUndefined(databaseType.hasSchemas) ? !databaseType.hasSchema : !databaseType.hasSchemas[this.version], height: 64, name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), forms: [ @@ -551,6 +589,9 @@ export class FormJdbc extends BI.Widget { ], }, ], + ref: (_ref: FormItem) => { + this.schemaForm = _ref; + }, }, // 分隔线 { @@ -866,6 +907,9 @@ export class FormJdbc extends BI.Widget { width: 100, name: BI.i18nText('Dec-Dcm_Connection_Setting', 'SSL'), invisible: !this.getSslSetEnabled(), + ref: (_ref: Collapse) => { + this.sslCollapse = _ref; + }, listeners: [ { eventName: EVENT_CHANGE, @@ -1252,17 +1296,17 @@ export class FormJdbc extends BI.Widget { const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); const drivers = connectionType.drivers ? connectionType.drivers.map((item) => { - return { - text: item, - value: item, - }; - }) + return { + text: item, + value: item, + }; + }) : [ - { - text: connectionType.driver, - value: connectionType.driver, - }, - ]; + { + text: connectionType.driver, + value: connectionType.driver, + }, + ]; if (!drivers.some((item) => item.text === connectionData.driver)) { return [ @@ -1309,7 +1353,7 @@ export class FormJdbc extends BI.Widget { private getSslSetEnabled(): boolean { const { databaseType } = this.databaseType; - return databaseType === 'mysql'; + return databaseType === 'mysql' || this.version === 'mysql'; } public setSchemas(schemas: string[]) { @@ -1329,7 +1373,7 @@ export class FormJdbc extends BI.Widget { } public setKerberos() { - const KerberosParams = BI.extend({},{ + const KerberosParams = BI.extend({}, { keytabPath: this.form.keyPath.getValue(), krb5ConfPath: this.form.krb5Path.getValue(), principal: this.form.principal.getValue()[0] @@ -1341,7 +1385,7 @@ export class FormJdbc extends BI.Widget { public initPrincipals(keyPath, principal) { let self = this; api.getPrincipals(keyPath).then(res => { - const principalsItems = BI.map(res.data, function(index, item) { + const principalsItems = BI.map(res.data, function (index, item) { return { text: item, value: item @@ -1354,12 +1398,12 @@ export class FormJdbc extends BI.Widget { public changePrincipal() { let self = this; - const KerberosParams = BI.extend({},{ + const KerberosParams = BI.extend({}, { keytabPath: this.form.keyPath.getValue(), krb5ConfPath: this.form.krb5Path.getValue(), principal: this.form.principal.getValue()[0] }); - api.changePrincipal(KerberosParams).then(res =>{ + api.changePrincipal(KerberosParams).then(res => { self.form.keyPath.setValue(res.data.keytabPath); self.form.krb5Path.setValue(res.data.krb5ConfPath); }); From 8ed653f04445209261c2d73db6b6bf400dadc442 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 6 Jan 2023 16:15:28 +0800 Subject: [PATCH 049/116] =?UTF-8?q?REPORT-87662=20feat:tbase=E9=80=82?= =?UTF-8?q?=E9=85=8Dtdsql=E7=9A=84=E6=9B=B4=E6=94=B9?= 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 0baab99..65df36e 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -708,6 +708,7 @@ export const DATA_BASE_TYPES = [ databaseType: 'tdsql', driver: 'org.postgresql.Driver', url: 'jdbc:postgresql://hostname:port/database', + versions: ['pgsql'], commonly: false, internal: true, type: 'jdbc', From 1cfe9d2ddba0908aee62c6fa43a659068e027347 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 1 Feb 2023 14:57:51 +0800 Subject: [PATCH 050/116] =?UTF-8?q?REPORT-86413=20feat:=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=80=82=E9=85=8D=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=8A=A0=E8=A7=A3=E5=AF=86=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/decision.api.ts | 6 ++---- types/globals.d.ts | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 3ad6470..5249552 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -107,13 +107,11 @@ export class DecisionApi implements Api { } getCipher(password: string) { - return BI.Providers.getProvider('dec.provider.cipher') - .getCipher(password); + return Dec.Utils['getTransCipherText'](password); } getPlain(cipher: string) { - return BI.Providers.getProvider('dec.provider.cipher') - .getPlain(cipher); + return Dec.Utils['getPlainText'](cipher); } getHyperlink(name: string) { diff --git a/types/globals.d.ts b/types/globals.d.ts index 4d1c456..f936556 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -13,6 +13,7 @@ declare const Dec: { connected: boolean; }; system: {}; + Utils: {}, personal: { username: string; }; From 06835d70a5d5d023cc532b4ab3dfd2150f5799da Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 7 Feb 2023 10:24:22 +0800 Subject: [PATCH 051/116] =?UTF-8?q?REPORT-89173=20fix:=20JNDI=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 18 +++++++-------- src/modules/crud/api.ts | 10 ++++----- src/modules/crud/decision.api.ts | 7 +++++- src/modules/crud/design.api.ts | 4 ++++ src/modules/pages/database/database.model.ts | 23 ++++++++++++++++---- src/modules/pages/database/database.ts | 13 ++++++++++- 6 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index e35475f..7b0983f 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -1,7 +1,7 @@ import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant'; import { DatabaseType } from './app.typings'; import { Connection } from './crud/crud.typings'; -export function getAllDatabaseTypes():DatabaseType[] { +export function getAllDatabaseTypes(): DatabaseType[] { return [ ...DATA_BASE_TYPES, ...BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType.map(item => { @@ -45,11 +45,11 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT if (!databaseType) { return DATA_BASE_TYPES_OTHER; } - + return databaseType; } -export function resolveUrlInfo (url: string, database?: string) { +export function resolveUrlInfo(url: string, database?: string) { if (BI.isNull(url)) return {}; return BI.Providers.getProvider('dec.connection.provider.datebase').getJdbcResolveByType(database)(url) || { @@ -70,11 +70,11 @@ export function splitUrl(host: string, port: string, database: string, baseUrl: // https://work.fineres.com/browse/REPORT-72078 if (baseUrl.startsWith('jdbc:informix-sqli')) { return baseUrl.replace('hostname', host) - .replace(':port', port ? `:${port}` : '') - .replace('database', database) - .replace(':INFORMIXSERVER={server}',''); + .replace(':port', port ? `:${port}` : '') + .replace('database', database) + .replace(':INFORMIXSERVER={server}', ''); } - + return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('database', database) .replace('dbname', database); @@ -85,13 +85,13 @@ export function connectionCanEdit(connection: Connection) { // privilegeType === 4 代表编辑权限,privilegeValue === 2 代表有权限 return connection.privilegeDetailBeanList.some(item => item.privilegeType === 4 && item.privilegeValue === 2); } - + return true; } export function getTextByDatabaseType(databaseType: string) { const database = getAllDatabaseTypes().find(item => item.databaseType === databaseType); - + return database ? database.text : ''; } diff --git a/src/modules/crud/api.ts b/src/modules/crud/api.ts index 12d4f0c..32fa735 100644 --- a/src/modules/crud/api.ts +++ b/src/modules/crud/api.ts @@ -52,11 +52,6 @@ export interface Api { */ getConnectionPool(name: string): Promise<{ data?: ConnectionPoolType }>; - /** - * 获取自定义驱动列表 - */ - getSimpleDriverList(): Promise<{ data?: any[] }>; - /** * 获取连接状态 * @param name @@ -93,4 +88,9 @@ export interface Api { * 获取外链 */ getHyperlink(name: string): string; + + /** + * 获取JNDI数据库类型可用状态 + */ + getJNDIDatabaseStatus(): Promise<{ data?: boolean }>; } diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 5249552..782779d 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -129,11 +129,16 @@ export class DecisionApi implements Api { getTimeOut(): Promise<{ data?: any }> { return requestGet('kdc/timeout', {}); } - + putTimeOut(value: number) { return requestPut(`kdc/timeout?timeout=${value}`, {}) } + // 获取当前lic是否可以使用JNDI数据库类型 + getJNDIDatabaseStatus(): Promise<{ data?: boolean }> { + return requestGet('databasetype/limit', {}); + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/crud/design.api.ts b/src/modules/crud/design.api.ts index f010918..643ad8e 100644 --- a/src/modules/crud/design.api.ts +++ b/src/modules/crud/design.api.ts @@ -88,4 +88,8 @@ export class DesignApi implements Api { // 设计器获取超链 return ''; } + + getJNDIDatabaseStatus() { + return Promise.resolve({ data: true }); + } } diff --git a/src/modules/pages/database/database.model.ts b/src/modules/pages/database/database.model.ts index 44109ea..0de45eb 100644 --- a/src/modules/pages/database/database.model.ts +++ b/src/modules/pages/database/database.model.ts @@ -2,10 +2,12 @@ import { model, Model } from '@core/core'; import { AppModel } from 'src/modules/app.model'; import { getAllDatabaseTypes } from '../../app.service'; import { DatabaseType } from '../../app.typings'; +import { connectionType } from '@constants/env'; +import { OTHER_JDBC } from '@constants/constant'; @model() export class DatebaseModel extends Model<{ - types : { + types: { filter: AppModel['TYPE']['filter']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; }, @@ -20,20 +22,30 @@ export class DatebaseModel extends Model<{ isInternal: true, isPlugin: true, datebaseTypes: getAllDatabaseTypes().filter(item => item.commonly), + isJNDILimit: false, }; } + + computed = { + otherDatabases: () => { + return this.model.isJNDILimit + ? [OTHER_JDBC] + : [OTHER_JDBC, connectionType.JNDI]; + } + } + actions = { - setSearch:(search: string) => { + setSearch: (search: string) => { this.model.search = search; }, - setFilter:(filter: string) => { + setFilter: (filter: string) => { this.model.filter = filter; }, setDatebaseTypes: (datebaseTypes: DatabaseType[]) => { this.model.datebaseTypes = datebaseTypes; this.model.datebaseTypeSelected = ''; }, - setInternal:(isInternal: boolean) => { + setInternal: (isInternal: boolean) => { this.model.isInternal = isInternal; }, setPlugin: (isPlugin: boolean) => { @@ -42,5 +54,8 @@ export class DatebaseModel extends Model<{ setDatebaseTypeSelected(datebaseType: string) { this.model.datebaseTypeSelected = datebaseType; }, + setJNDILimit: (v: boolean) => { + this.model.isJNDILimit = v; + }, } } diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index 93b32ae..7779006 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -6,6 +6,10 @@ import { connectionType } from '@constants/env'; import { DatebaseType } from './database_type/database_type'; import { getAllDatabaseTypes } from '../../app.service'; import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core'; +import { ApiFactory } from 'src/modules/crud/apiFactory'; + +const api = new ApiFactory().create(); + @shortcut() @store(DatebaseModel) export class Datebase extends BI.Widget { @@ -65,6 +69,7 @@ export class Datebase extends BI.Widget { mounted() { this.store.setFilter(DATEBASE_FILTER_TYPE.COMMONLY); this.store.setDatebaseTypeSelected(''); + this.getDatabaseTypeLimit(); } render() { @@ -250,11 +255,17 @@ export class Datebase extends BI.Widget { this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.commonly)); break; case DATEBASE_FILTER_TYPE.OTHER: - this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type === connectionType.JNDI || item.type === OTHER_JDBC)); + this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => this.model.otherDatabases.includes(item.type))); break; default: this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC)); break; } } + + // 获取JNDI + private async getDatabaseTypeLimit() { + const result = await api.getJNDIDatabaseStatus(); + this.store.setJNDILimit(result); + } } From 49779bdcbd5e26f106848b9e968e6fb3628c8f48 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 7 Feb 2023 10:31:35 +0800 Subject: [PATCH 052/116] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E5=A4=84=E7=90=86=E4=B8=8B=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/api.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/crud/api.ts b/src/modules/crud/api.ts index 32fa735..daa9e4d 100644 --- a/src/modules/crud/api.ts +++ b/src/modules/crud/api.ts @@ -52,6 +52,11 @@ export interface Api { */ getConnectionPool(name: string): Promise<{ data?: ConnectionPoolType }>; + /** + * 获取自定义驱动列表 + */ + getSimpleDriverList(): Promise<{ data?: any[] }>; + /** * 获取连接状态 * @param name From 1665e6ebcaa5395159461da873c6ae4ca491d75f Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 8 Feb 2023 11:43:55 +0800 Subject: [PATCH 053/116] =?UTF-8?q?REPORT-89173=20fix:=20=E9=80=82?= =?UTF-8?q?=E9=85=8D=E4=B8=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/database/database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index 7779006..b955b64 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -266,6 +266,6 @@ export class Datebase extends BI.Widget { // 获取JNDI private async getDatabaseTypeLimit() { const result = await api.getJNDIDatabaseStatus(); - this.store.setJNDILimit(result); + this.store.setJNDILimit(result.data); } } From 057f9d804c23daf9bbb64daff0aff31ac760f537 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 10 Feb 2023 11:40:11 +0800 Subject: [PATCH 054/116] =?UTF-8?q?Revert=20"REPORT-86413=20feat:=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=80=82=E9=85=8D=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=8A=A0=E8=A7=A3=E5=AF=86=E6=94=B9=E9=80=A0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1cfe9d2ddba0908aee62c6fa43a659068e027347. --- src/modules/crud/decision.api.ts | 6 ++++-- types/globals.d.ts | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 782779d..b23c31b 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -107,11 +107,13 @@ export class DecisionApi implements Api { } getCipher(password: string) { - return Dec.Utils['getTransCipherText'](password); + return BI.Providers.getProvider('dec.provider.cipher') + .getCipher(password); } getPlain(cipher: string) { - return Dec.Utils['getPlainText'](cipher); + return BI.Providers.getProvider('dec.provider.cipher') + .getPlain(cipher); } getHyperlink(name: string) { diff --git a/types/globals.d.ts b/types/globals.d.ts index f936556..4d1c456 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -13,7 +13,6 @@ declare const Dec: { connected: boolean; }; system: {}; - Utils: {}, personal: { username: string; }; From 13bd0bc9c4fd0a32be7e7d1ba899898b9d0d76f1 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 24 Feb 2023 10:47:46 +0800 Subject: [PATCH 055/116] =?UTF-8?q?REPORT-88994=20feat:=E9=80=82=E9=85=8DK?= =?UTF-8?q?ingbase8.0=E7=89=88=E6=9C=AC?= 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 65df36e..fe49fc0 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -459,6 +459,7 @@ export const DATA_BASE_TYPES = [ text: 'KINGBASE', databaseType: 'kingbase', driver: 'com.kingbase.Driver', + versions: ['KingbaseES 7.0'], url: 'jdbc:kingbase://hostname:port/database', commonly: false, internal: true, From 7a6261949dbf13d679f9a91857b47fe8453e872b Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 24 Feb 2023 14:09:19 +0800 Subject: [PATCH 056/116] =?UTF-8?q?REPORT-88759=20feat:=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=80=82=E9=85=8DFDL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/collapse/collapse.ts | 2 + .../components/tips_combo/tips_combo.ts | 41 +++ src/modules/constants/constant.ts | 11 + src/modules/crud/crud.typings.d.ts | 40 ++- .../connection_jdbc/connection_jdbc.ts | 58 ++++ .../maintain/forms/components/form.jdbc.ts | 294 ++++++++++++++++-- src/modules/pages/maintain/forms/form.ts | 17 +- 7 files changed, 422 insertions(+), 41 deletions(-) create mode 100644 src/modules/components/tips_combo/tips_combo.ts diff --git a/src/modules/components/collapse/collapse.ts b/src/modules/components/collapse/collapse.ts index edaa9e5..de2c51d 100644 --- a/src/modules/components/collapse/collapse.ts +++ b/src/modules/components/collapse/collapse.ts @@ -12,6 +12,7 @@ export class Collapse extends BI.BasicButton { name: '', isCollapse: true, $testId: 'dec-dcm-components-collapse', + el: {}, } rightFont: IconLabel; @@ -57,6 +58,7 @@ export class Collapse extends BI.BasicButton { lgap: 2, text: this.options.name, }, + this.options.el, ], }; } diff --git a/src/modules/components/tips_combo/tips_combo.ts b/src/modules/components/tips_combo/tips_combo.ts new file mode 100644 index 0000000..c1b049a --- /dev/null +++ b/src/modules/components/tips_combo/tips_combo.ts @@ -0,0 +1,41 @@ +import { shortcut } from '@core/core'; +import { BubbleCombo, BubblePopupView, IconButton } from '@fui/core'; + +@shortcut() +export class TipsCombo extends BI.Widget { + public static xtype = 'dec.dcm.tips.combo'; + + public props: BubblePopupView['props'] & IconButton['props'] = { + trigger: 'hover', + direction: 'top' + }; + + private bubbleCombo: BubbleCombo; + + private bubbleComboPopup: BubblePopupView; + + public render() { + const { direction, trigger, el } = this.options; + + return { + type: BI.BubbleCombo.xtype, + trigger, + direction, + el: { + type: BI.IconButton.xtype, + cls: "detail-font", + }, + popup: { + type: BI.BubblePopupView.xtype, + ref: (_ref: BubblePopupView) => { + this.bubbleComboPopup = _ref; + }, + el, + }, + listeners: [], + ref: (_ref: BubbleCombo) => { + this.bubbleCombo = _ref; + } + } + } +} \ No newline at end of file diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 65df36e..da1fc48 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -867,3 +867,14 @@ export const JNDI_FACTORYS = [ export const PAGE_SIZE = 50; export const INT_MAX_VALUE = 2147483647; export const INT_MIN_VALUE = -2147483648; + +export const YES_OR_NO = [ + { + text: BI.i18nText('Dec-Basic_Yes'), + value: 1, + }, + { + text: BI.i18nText('Dec-Basic_No'), + value: 0, + } +] \ No newline at end of file diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 339f02a..74d05d9 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -110,7 +110,7 @@ export interface ConnectionPoolJDBC { minEvictableIdleTimeMillis?: number; } -export type ConnectionJDBC ={ +export type ConnectionJDBC = { /** * 数据库名称 */ @@ -206,8 +206,42 @@ export type ConnectionJDBC ={ identity?: string; connectionPoolAttr: ConnectionPoolJDBC; -}& ConnectionDataOfSSH & -ConnectionDataOfSSL + /** + * 并行装载 + */ + parallelLoad?: { + /** + * 服务器地址 + */ + serverAddress?: string; + /** + * 服务器地址选项 + */ + serverAddressItems?: string[]; + /** + * 复用临时表 + */ + reuseTemporaryTable?: string; + /** + * 临时文件条数限制 + */ + filePiecesLimit?: string; + /** + * 临时文件大小限制 + */ + fileSizeLimit?: string + }; + /** + * HDFS + */ + hdfs?: { + /** + * HDFS地址 + */ + hdfsAddress?: string; + }; +} & ConnectionDataOfSSH & + ConnectionDataOfSSL export interface ContextHashtable { 'java.naming.factory.initial': string; diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 9651233..817b50d 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -21,6 +21,7 @@ export class ConnectionJdbc extends BI.Widget { sshSet: VerticalLayout; sslSet: VerticalLayout; advancedSet: VerticalLayout; + parallelLoadSet: VerticalLayout; render() { const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; @@ -50,6 +51,10 @@ export class ConnectionJdbc extends BI.Widget { verifyCa, sslClientPrivateKey, sslClientCertificate, + // 并行装载 + parallelLoad, + // HDFS + hdfs, } = connectionData; const databaseType = getJdbcDatabaseType(database, driver); const { host, port, databaseName, version } = resolveUrlInfo(url, database); @@ -112,6 +117,59 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), value: originalCharsetName ? originalCharsetName : BI.i18nText('Dec-Dcm_Connection_Form_Default'), }, + // HDFS设置 + { + type: FormItem.xtype, + invisible: BI.isNull(hdfs), + name: BI.i18nText('Dec-Dcm_Connection_Address', 'HDFS'), + value: hdfs?.hdfsAddress, + }, + // 并行装载设置 + { + type: Collapse.xtype, + invisible: BI.isNull(parallelLoad), + name: BI.i18nText('Dec-Dcm_Connection_Setting', BI.i18nText('Dec-Dcm_Connection_Parallel_Load')), + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.parallelLoadSet.setVisible(!isCollapse); + }, + }, + ], + }, + { + type: BI.VerticalLayout.xtype, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.parallelLoadSet = _ref; + }, + items: [ + { + type: FormItem.xtype, + _bgap: vgap, + name: `${BI.i18nText('Dec-Dcm_Connection_Server_Address')}-${BI.i18nText('Dec-Memory_Detection_Server_Cluster_Node', '1')}`, + value: parallelLoad?.serverAddress, + }, + { + type: FormItem.xtype, + _bgap: vgap, + name: BI.i18nText('Dec-Dcm_Connection_Reuse_Temporary_Table'), + value: parallelLoad?.reuseTemporaryTable, + }, + { + type: FormItem.xtype, + _bgap: vgap, + name: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Pieces_Limit'), + value: parallelLoad?.filePiecesLimit, + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Size_Limit'), + value: parallelLoad?.fileSizeLimit, + }, + ], + }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 9cf4aad..869f63d 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -3,7 +3,7 @@ import { Collapse, EVENT_CHANGE } from 'src/modules/components/collapse/collapse import { FormItem } 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, INT_MAX_VALUE, INT_MIN_VALUE, CONNECT_SSH_TYPE, CONNECT_SSL_TYPE } from '@constants/constant'; +import { CONNECT_CHARSET, CONNECTION_LAYOUT, INT_MAX_VALUE, INT_MIN_VALUE, CONNECT_SSH_TYPE, CONNECT_SSL_TYPE, YES_OR_NO } from '@constants/constant'; import { getAllDatabaseTypes, getJdbcDatabaseType, resolveUrlInfo, splitUrl } from '../../../../app.service'; import { DatabaseType } from 'src/modules/app.typings'; import { TextChecker } from '../../../../components/text_checker/text_checker'; @@ -12,9 +12,12 @@ import { ApiFactory } from 'src/modules/crud/apiFactory'; import { Editor, Label, TextAreaEditor, TextEditor, TextValueCombo, VerticalLayout, MultiSelectItem } from '@fui/core'; import { DriverSelector } from '../../components/driverselector/driverselector'; import { FileUpload } from '../../../../components/file_upload/file_upload'; +import { TipsCombo } from '../../../../components/tips_combo/tips_combo'; const api = new ApiFactory().create(); +const EDITOR_WIDTH = 300, EDITOR_HEIGHT = 20; + @shortcut() export class FormJdbc extends BI.Widget { static xtype = 'dec.dcm.maintain.form.jdbc'; @@ -29,6 +32,8 @@ export class FormJdbc extends BI.Widget { databaseType: DatabaseType; allDatabaseTypes = getAllDatabaseTypes(); + parallelLoadSet: VerticalLayout; + hdfsSet: VerticalLayout; sshSet: VerticalLayout; sshForm: VerticalLayout; sslSet: VerticalLayout; @@ -87,6 +92,17 @@ export class FormJdbc extends BI.Widget { minIdle: null, minEvictableIdleTimeMillis: null, fetchSize: null, + // 并行装载 + parallelLoad: { + serverAddress: '', + isReuseTemporaryTable: 0, + filePiecesLimit: null, + fileSizeLimit: null, + }, + // HDFS + hdfs: { + hdfsAddress: null, + } }; render() { @@ -120,6 +136,10 @@ export class FormJdbc extends BI.Widget { verifyCa = false, sslClientPrivateKey = '', sslClientCertificate = '', + // 并行装载 + parallelLoad, + // HDFS + hdfs, } = connectionData as ConnectionJDBC; this.oldPassword = password; this.oldSshSecret = sshSecret; @@ -163,7 +183,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'connection-name', - width: 300, + width: EDITOR_WIDTH, value: connectionName, allowBlank: true, ref: (_ref: TextChecker) => { @@ -181,7 +201,7 @@ export class FormJdbc extends BI.Widget { forms: [ { type: BI.TextValueCombo.xtype, - width: 300, + width: EDITOR_WIDTH, value: this.version, items: () => databaseType.versions.map(item => { return { @@ -250,7 +270,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextEditor.xtype, $value: 'database-name', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), value: databaseName, @@ -276,7 +296,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextEditor.xtype, $value: 'database-host', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: host, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), @@ -302,7 +322,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'database-port', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: port, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), @@ -337,7 +357,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'auth-type', - width: 300, + width: EDITOR_WIDTH, value: authType, ref: (_ref: TextValueCombo) => { this.form.authType = _ref; @@ -381,7 +401,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextEditor.xtype, $value: 'username', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: user, watermark: BI.i18nText('Dec-Dcm_Connection_Form_UserName'), @@ -404,8 +424,8 @@ export class FormJdbc extends BI.Widget { type: BI.Editor.xtype, $value: 'password', cls: 'bi-border bi-border-radius', - width: 300, - height: 20, + width: EDITOR_WIDTH, + height: EDITOR_HEIGHT, allowBlank: true, value: password, inputType: 'password', @@ -478,7 +498,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'principal', - width: 300, + width: EDITOR_WIDTH, value: principal, ref: (_ref: TextEditor) => { this.form.principal = _ref; @@ -536,7 +556,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'original-charset-name', - width: 300, + width: EDITOR_WIDTH, value: originalCharsetName ? originalCharsetName : '', items: CONNECT_CHARSET, ref: (_ref: TextValueCombo) => { @@ -549,7 +569,6 @@ export class FormJdbc extends BI.Widget { { type: FormItem.xtype, invisible: BI.isUndefined(databaseType.hasSchemas) ? !databaseType.hasSchema : !databaseType.hasSchemas[this.version], - height: 64, name: BI.i18nText('Dec-Dcm_Connection_Form_Pattern'), forms: [ { @@ -577,8 +596,8 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'schema', - width: 300, - vgap: 15, + width: EDITOR_WIDTH, + tgap: 15, disabled: true, value: schema, items: schema ? [{ text: schema, value: schema }] : [], @@ -593,6 +612,209 @@ export class FormJdbc extends BI.Widget { this.schemaForm = _ref; }, }, + // 并行装载设置 + { + type: Collapse.xtype, + invisible: BI.isNull(parallelLoad), + name: BI.i18nText('Dec-Dcm_Connection_Setting', BI.i18nText('Dec-Dcm_Connection_Parallel_Load')), + el: { + type: TipsCombo.xtype, + _lgap: 6, + el: { + type: BI.CenterAdaptLayout.xtype, + innerHgap: 15, + innerVgap: 10, + items: [ + { + type: BI.Label.xtype, + text: BI.i18nText('Dec-Dcm_Connection_Setting_Tips', BI.i18nText('Dec-Dcm_Connection_Parallel_Load')), + }, + /** + * FIXME: 帮助链接待提供 + */ + { + type: BI.A.xtype, + href: '', + el: { + type: BI.Label.xtype, + text: BI.i18nText('Dec-BI_Help_Paper'), + } + } + ] + } + }, + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.parallelLoadSet.setVisible(!isCollapse); + } + } + ] + }, + { + type: BI.VerticalLayout.xtype, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.parallelLoadSet = _ref; + }, + items: [ + { + // 服务器地址-节点1 + type: FormItem.xtype, + name: `${BI.i18nText('Dec-Dcm_Connection_Server_Address')}-${BI.i18nText('Dec-Memory_Detection_Server_Cluster_Node', '1')}`, + _bgap: vgap, + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'server-cluster-node', + width: EDITOR_WIDTH, + value: parallelLoad?.serverAddress ?? '', + items: parallelLoad?.serverAddressItems || [], + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: (value: string) => { + this.form.parallelLoad.serverAddress = value; + } + } + ] + }, + ], + }, + { + // 复用临时表 + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Reuse_Temporary_Table'), + _bgap: vgap, + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'reuse-temporary-table', + width: EDITOR_WIDTH, + value: parallelLoad?.reuseTemporaryTable ?? 0, + items: YES_OR_NO, + watermark: BI.i18nText('Dec-Dcm_Connection_Reuse_Temporary_Table'), + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: (value: number) => { + this.form.parallelLoad.isReuseTemporaryTable = value; + } + } + ] + }, + ], + }, + { + // 临时文件条数限制 + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Pieces_Limit'), + _bgap: vgap, + forms: [ + { + type: BI.Editor.xtype, + $value: 'temporary-file-pieces-limit', + cls: 'bi-border bi-border-radius', + width: EDITOR_WIDTH, + height: EDITOR_HEIGHT, + allowBlank: true, + value: parallelLoad?.filePiecesLimit ?? '', + watermark: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Pieces_Limit'), + ref: (_ref: Editor) => { + this.form.parallelLoad.filePiecesLimit = _ref; + }, + }, + ], + }, + { + // 临时文件大小限制(MB) + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Size_Limit'), + forms: [ + { + type: BI.Editor.xtype, + $value: 'temporary-file-size-limit', + cls: 'bi-border bi-border-radius', + width: EDITOR_WIDTH, + height: EDITOR_HEIGHT, + allowBlank: true, + value: parallelLoad?.fileSizeLimit ?? '', + watermark: BI.i18nText('Dec-Dcm_Connection_Temporary_File_Size_Limit'), + ref: (_ref: Editor) => { + this.form.parallelLoad.fileSizeLimit = _ref; + }, + }, + ], + }, + ] + }, + // HDFS设置 + { + type: Collapse.xtype, + invisible: BI.isNull(hdfs), + name: BI.i18nText('Dec-Dcm_Connection_Setting', 'HDFS'), + el: { + type: TipsCombo.xtype, + _lgap: 6, + el: { + type: BI.CenterAdaptLayout.xtype, + innerHgap: 15, + innerVgap: 10, + items: [ + { + type: BI.Label.xtype, + text: BI.i18nText('Dec-Dcm_Connection_Setting_Tips', 'HDFS'), + }, + { + type: BI.A.xtype, + href: '', + el: { + type: BI.Label.xtype, + text: BI.i18nText('Dec-BI_Help_Paper'), + } + } + ] + } + }, + listeners: [ + { + eventName: EVENT_CHANGE, + action: (isCollapse: boolean) => { + this.hdfsSet.setVisible(!isCollapse); + } + } + ] + }, + { + type: BI.VerticalLayout.xtype, + invisible: true, + ref: (_ref: VerticalLayout) => { + this.hdfsSet = _ref; + }, + items: [ + { + // HDFS地址 + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Address', 'HDFS'), + forms: [ + { + type: BI.Editor.xtype, + $value: 'hdfs-connection-address', + cls: 'bi-border bi-border-radius', + width: EDITOR_WIDTH, + height: EDITOR_HEIGHT, + allowBlank: true, + value: hdfs?.hdfsAddress ?? '', + watermark: BI.i18nText('Dec-Dcm_Connection_Address', 'HDFS'), + ref: (_ref: Editor) => { + this.form.hdfs.hdfsAddress = _ref; + }, + }, + ], + } + ] + }, // 分隔线 { type: BI.Layout.xtype, @@ -607,7 +829,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextEditor.xtype, $value: 'database-url', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: url, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_URL'), @@ -636,7 +858,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'max-active', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: maxActive, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), @@ -662,7 +884,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'check', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: testOnBorrow, items: this.getBooleanItem(), @@ -685,7 +907,7 @@ export class FormJdbc extends BI.Widget { allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query_Watermark'), value: api.getPlain(validationQuery || ''), - width: 300, + width: EDITOR_WIDTH, height: 100, ref: (_ref: TextAreaEditor) => { this.form.validationQuery = _ref; @@ -701,7 +923,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'max-wait', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: maxWait, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), @@ -842,7 +1064,7 @@ export class FormJdbc extends BI.Widget { ref: (_ref: TextValueCombo) => { this.form.sshType = _ref; }, - width: 300, + width: EDITOR_WIDTH, watermark: BI.i18nText('Dec-Dcm_Connection_Form_VerifyType'), items: CONNECT_SSH_TYPE, value: sshType, @@ -985,7 +1207,7 @@ export class FormJdbc extends BI.Widget { ref: (_ref: TextValueCombo) => { this.form.verifyCa = _ref; }, - width: 300, + width: EDITOR_WIDTH, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Verify_CA_Certificate'), items: this.getBooleanItem(), value: verifyCa, @@ -1059,7 +1281,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'initial-size', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: initialSize, validationChecker: [ @@ -1084,7 +1306,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'min-idle', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: minIdle, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), @@ -1109,7 +1331,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'test-on-return', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: testOnReturn, items: this.getBooleanItem(), @@ -1127,7 +1349,7 @@ export class FormJdbc extends BI.Widget { { type: BI.TextValueCombo.xtype, $value: 'test-while-idle', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: testWhileIdle, items: this.getBooleanItem(), @@ -1145,7 +1367,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'test-between-evicition-millis', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: timeBetweenEvictionRunsMillis, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), @@ -1176,7 +1398,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'test-pereviction-run-num', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: numTestsPerEvictionRun, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), @@ -1201,7 +1423,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'min-evictable-idle-time-millis', - width: 300, + width: EDITOR_WIDTH, allowBlank: false, value: minEvictableIdleTimeMillis, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), @@ -1239,7 +1461,7 @@ export class FormJdbc extends BI.Widget { { type: TextChecker.xtype, $value: 'fetch-size', - width: 300, + width: EDITOR_WIDTH, allowBlank: true, value: fetchSize === -2 ? '' : fetchSize, watermark: 'Fetchsize', @@ -1422,6 +1644,7 @@ export class FormJdbc extends BI.Widget { const connectionPoolAttr = connectionData.connectionPoolAttr; const originalCharsetName = this.form.originalCharsetName.getValue()[0] || ''; // TODO 获取表单数据这里待优化 + const { parallelLoad, hdfs } = this.form; return { connectionType: connectionType.JDBC, @@ -1478,6 +1701,17 @@ export class FormJdbc extends BI.Widget { numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), }, + // 并行装载 + parallelLoad: { + serverAddress: parallelLoad.serverAddress, + isReuseTemporaryTable: parallelLoad.isReuseTemporaryTable, + filePiecesLimit: parallelLoad.filePiecesLimit.getValue(), + fileSizeLimit: parallelLoad.fileSizeLimit.getValue(), + }, + hdfs: { + hdfsAddress: hdfs.hdfsAddress.getValue(), + } + // HDFS }), }; } diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 9ac3908..609b880 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -38,8 +38,8 @@ export class MaintainForm extends BI.Widget { value.creator = BI.get(this.getFormData(), 'creator'); this.store.updateConnection(this.connectionName, value).then(result => { if (result.errorCode) { - if(result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ - BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"),{ + if (result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED) { + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), { level: "error", }); } @@ -121,15 +121,16 @@ export class MaintainForm extends BI.Widget { let editConnection: Connection; let connectionData: ConnectionJDBC; if (this.model.datebaseTypeSelected) { + const { databaseType: database, fetchSize } = this.model.datebaseTypeSelectedOne; + connectionData = { - driver: this.model.datebaseTypeSelectedOne.driver, - url: this.model.datebaseTypeSelectedOne.url, - database: this.model.datebaseTypeSelectedOne.databaseType, + ...this.model.datebaseTypeSelectedOne, + database, connectionName, connectionPoolAttr: DEFAULT_JDBC_POOL, port: '', host: 'localhost', - fetchSize: this.model.datebaseTypeSelectedOne.fetchSize ?? -1, + fetchSize: fetchSize ?? -1, identity: BI.UUID(), }; editConnection = { @@ -258,8 +259,8 @@ export class MaintainForm extends BI.Widget { private addConnection(form: Connection) { this.store.addConnection(form).then(result => { if (result.errorCode) { - if(result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ - BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"),{ + if (result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED) { + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), { level: "error", }); } From b4e6752f7b47ce11ce121af5de1657dfd4a9f202 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 24 Feb 2023 14:14:32 +0800 Subject: [PATCH 057/116] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=B8=8B=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/crud.typings.d.ts | 74 ++++++++++++++++-------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 74d05d9..0193583 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -35,17 +35,17 @@ type ConnectionDataOfSSH = { sshTimeOut: number; sshKeepAlive: number; } & ( - | { - sshType: 'NORMAL'; // 验证方法:密码 - sshPrivateKeyPath: ''; // 没啥意义,该验证方法下为空字符串 - sshSecret: string; // 密码 - } - | { - sshType: 'KEY'; // 验证方法:公钥 - sshPrivateKeyPath: string; // 私钥 - sshSecret: string; // 密码短语 - } -); + | { + sshType: 'NORMAL'; // 验证方法:密码 + sshPrivateKeyPath: ''; // 没啥意义,该验证方法下为空字符串 + sshSecret: string; // 密码 + } + | { + sshType: 'KEY'; // 验证方法:公钥 + sshPrivateKeyPath: string; // 私钥 + sshSecret: string; // 密码短语 + } + ); type ConnectionDataOfSSL = { usingSsl: boolean; // 使用SSL通道 @@ -209,28 +209,7 @@ export type ConnectionJDBC = { /** * 并行装载 */ - parallelLoad?: { - /** - * 服务器地址 - */ - serverAddress?: string; - /** - * 服务器地址选项 - */ - serverAddressItems?: string[]; - /** - * 复用临时表 - */ - reuseTemporaryTable?: string; - /** - * 临时文件条数限制 - */ - filePiecesLimit?: string; - /** - * 临时文件大小限制 - */ - fileSizeLimit?: string - }; + parallelLoad?: IParallelLoad; /** * HDFS */ @@ -240,8 +219,33 @@ export type ConnectionJDBC = { */ hdfsAddress?: string; }; -} & ConnectionDataOfSSH & - ConnectionDataOfSSL +} & ConnectionDataOfSSH & ConnectionDataOfSSL; + +/** + * 并行装载 + */ +export interface IParallelLoad { + /** + * 服务器地址 + */ + serverAddress?: string; + /** + * 服务器地址选项 + */ + serverAddressItems?: string[]; + /** + * 复用临时表 + */ + reuseTemporaryTable?: string; + /** + * 临时文件条数限制 + */ + filePiecesLimit?: string; + /** + * 临时文件大小限制 + */ + fileSizeLimit?: string +} export interface ContextHashtable { 'java.naming.factory.initial': string; From 60f23068a1d91bd3b0d0557e945bdd5700e4ede0 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 1 Mar 2023 17:05:21 +0800 Subject: [PATCH 058/116] =?UTF-8?q?REPORT-90807=20fix:=20=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=8A=A0=E8=A7=A3=E5=AF=86=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/crud.service.ts | 6 +++--- src/modules/crud/decision.api.ts | 4 ++-- types/globals.d.ts | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/crud/crud.service.ts b/src/modules/crud/crud.service.ts index 19297e7..71c9604 100644 --- a/src/modules/crud/crud.service.ts +++ b/src/modules/crud/crud.service.ts @@ -15,7 +15,7 @@ export function requestGet(url: string, data?: any): Promise { export function requestPost(url: string, data = {}): Promise { return new Promise(resolve => { - Dec.reqPost(getFullUrl(url), data, re => { + Dec.reqByEncrypt("POST", getFullUrl(url), data, re => { resolve(re); }); }); @@ -23,7 +23,7 @@ export function requestPost(url: string, data = {}): Promise { export function requestDelete(url: string, data = {}) { return new Promise(resolve => { - Dec.reqDelete(getFullUrl(url), data, re => { + Dec.reqByEncrypt("DELETE", getFullUrl(url), data, re => { resolve(re); }); }); @@ -31,7 +31,7 @@ export function requestDelete(url: string, data = {}) { export function requestPut(url: string, data = {}) { return new Promise(resolve => { - Dec.reqPut(getFullUrl(url), data, re => { + Dec.reqByEncrypt("PUT", getFullUrl(url), data, re => { resolve(re); }); }); diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index b23c31b..a77f406 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -108,12 +108,12 @@ export class DecisionApi implements Api { getCipher(password: string) { return BI.Providers.getProvider('dec.provider.cipher') - .getCipher(password); + .getCompleteCipher(password); } getPlain(cipher: string) { return BI.Providers.getProvider('dec.provider.cipher') - .getPlain(cipher); + .getCompletePlain(cipher); } getHyperlink(name: string) { diff --git a/types/globals.d.ts b/types/globals.d.ts index 4d1c456..01b04b0 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -16,6 +16,7 @@ declare const Dec: { personal: { username: string; }; + reqByEncrypt: (method: string, url: string, data?: any, config?: Obj) => {}, socketEmit: (type: string, name: string, callback: (re: any) => void) => void; // req reqGet: RequestFunction; From 3b6e365777af6b14246d0c6bf4c558fb59b60a94 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 1 Mar 2023 17:13:33 +0800 Subject: [PATCH 059/116] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E4=B8=8B=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- types/globals.d.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5431bfb..6d411c8 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@types/jest": "24.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", - "axios": "0.18.0", + "axios": "^0.24.0", "babel-loader": "8.0.6", "body-parser": "1.18.3", "chokidar": "2.1.5", diff --git a/types/globals.d.ts b/types/globals.d.ts index 01b04b0..6dcba21 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -1,3 +1,4 @@ +import type { Method, AxiosRequestConfig } from 'axios'; interface Obj { [key: string]: any; } @@ -16,7 +17,7 @@ declare const Dec: { personal: { username: string; }; - reqByEncrypt: (method: string, url: string, data?: any, config?: Obj) => {}, + reqByEncrypt: (method: Method, url: string, data?: any, config?: AxiosRequestConfig) => {}, socketEmit: (type: string, name: string, callback: (re: any) => void) => void; // req reqGet: RequestFunction; From fd698f5970ffe0b3e60e53e80a4b15e84932e4da Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Fri, 3 Mar 2023 10:00:38 +0800 Subject: [PATCH 060/116] =?UTF-8?q?REPORT-90864=20fix:=E6=8B=BC=E6=8E=A5ur?= =?UTF-8?q?l=E7=B2=BE=E5=87=86=E5=8C=B9=E9=85=8D/database?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index e35475f..bc8dc60 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -76,7 +76,7 @@ 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); } From 6cbfe979123a08eafda150cbbc8efc54ea138262 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 9 Mar 2023 10:02:02 +0800 Subject: [PATCH 061/116] =?UTF-8?q?REPORT-91396=20fix:=E6=8B=BC=E6=8E=A5ur?= =?UTF-8?q?l=E7=B2=BE=E5=87=86=E5=8C=B9=E9=85=8D:database?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 0464611..af79ad0 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -51,7 +51,7 @@ export function getJdbcDatabaseType(database: string, driver: string): DatabaseT export function resolveUrlInfo(url: string, database?: string) { if (BI.isNull(url)) return {}; - + return BI.Providers.getProvider('dec.connection.provider.datebase').getJdbcResolveByType(database)(url) || { host: '', port: '', @@ -77,6 +77,7 @@ 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); } From 75bd5a8a89eb80f39b0e7e067f963337e9576bf1 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 9 Mar 2023 10:32:39 +0800 Subject: [PATCH 062/116] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tsconfig.json | 26 ++++++++++++++++++-------- types/globals.d.ts | 3 +-- types/request.d.ts | 9 +++++++++ 3 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 types/request.d.ts diff --git a/tsconfig.json b/tsconfig.json index 0506075..bac5abb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,8 +5,8 @@ "module": "es2015", "moduleResolution": "node", "lib": [ - "es2017", - "dom" + "es2017", + "dom" ], "declaration": true, "experimentalDecorators": true, @@ -21,11 +21,21 @@ "noFallthroughCasesInSwitch": true, "skipLibCheck": false, "paths": { - "ui": ["./src/ui"], - "ReportCst": ["./private/constants"], - "types": ["./types/index.d.ts"], - "@core/*": ["./src/modules/core/*"], - "@constants/*": ["./src/modules/constants/*"] + "ui": [ + "./src/ui" + ], + "ReportCst": [ + "./private/constants" + ], + "types": [ + "./types/index.d.ts" + ], + "@core/*": [ + "./src/modules/core/*" + ], + "@constants/*": [ + "./src/modules/constants/*" + ] } }, "include": [ @@ -33,6 +43,6 @@ "src/**/*.ts", "private/*.ts", "private/**/*.ts", - "types/globals.d.ts" + "types" ] } \ No newline at end of file diff --git a/types/globals.d.ts b/types/globals.d.ts index 6dcba21..f868d4b 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -1,4 +1,3 @@ -import type { Method, AxiosRequestConfig } from 'axios'; interface Obj { [key: string]: any; } @@ -17,7 +16,7 @@ declare const Dec: { personal: { username: string; }; - reqByEncrypt: (method: Method, url: string, data?: any, config?: AxiosRequestConfig) => {}, + reqByEncrypt: (method: AxiosType.X_Method, url: string, data?: any, config?: AxiosType.X_AxiosRequestConfig) => {}, socketEmit: (type: string, name: string, callback: (re: any) => void) => void; // req reqGet: RequestFunction; diff --git a/types/request.d.ts b/types/request.d.ts new file mode 100644 index 0000000..4042317 --- /dev/null +++ b/types/request.d.ts @@ -0,0 +1,9 @@ +import { Method, AxiosRequestConfig } from 'axios'; + +declare namespace AxiosType { + type X_Method = Method + interface X_AxiosRequestConfig extends AxiosRequestConfig { } +} + +export = AxiosType; +export as namespace AxiosType; \ No newline at end of file From 8bcdadec6db465a73f03cbfbcb69e1a48a127672 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Thu, 9 Mar 2023 10:37:48 +0800 Subject: [PATCH 063/116] =?UTF-8?q?REPORT-91394=20fix:jdbcResolve=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=80=82=E9=85=8Dsyabse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 791d2be..6ce5bce 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -26,7 +26,7 @@ BI.provider('dec.connection.provider.datebase', function () { urlInfo: greenplumUrl[9], }; } - const result = url.match(/^jdbc:(mysql|sqlserver|db2|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse|trino):(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|dm|impala|kylin|phoenix|derby|gbase|gbasedbt-sqli|informix-sqli|h2|postgresql|hive2|vertica|kingbase|presto|redshift|postgresql|clickhouse|trino|sybase:Tds):(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 4f09f02a5d928e66696b0cf3f0565d0c29903766 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 17 Mar 2023 15:13:51 +0800 Subject: [PATCH 064/116] =?UTF-8?q?REPORT-90357=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BB=E6=9C=BA=E3=80=81=E7=AB=AF=E5=8F=A3=E5=90=8E?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/maintain/forms/components/form.jdbc.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 869f63d..7db6718 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1015,6 +1015,14 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), allowBlank: false, value: sshIp || 'hostname', + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.form.sshSecret.setValue(""); + } + } + ] }, ], }, @@ -1038,6 +1046,14 @@ export class FormJdbc extends BI.Widget { valueRangeConfig, ], value: String(sshPort || 22), + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + this.form.sshSecret.setValue(""); + } + } + ] }, ], }, From af72fa4a51436027f6cbedf46f492979cd8fc641 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Mon, 20 Mar 2023 16:36:31 +0800 Subject: [PATCH 065/116] =?UTF-8?q?REPORT-90545:=20=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=B9=B3=E5=8F=B0=E5=89=8D=E7=AB=AF=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/test_status/test_status.ts | 36 +++++++++--- src/modules/crud/api.ts | 12 ++++ src/modules/crud/crud.typings.d.ts | 9 ++- src/modules/crud/decision.api.ts | 23 +++++++- src/modules/crud/design.api.ts | 23 +++++++- .../pages/maintain/forms/form.server.ts | 58 ++++++++++++++++++- types/globals.d.ts | 1 + 7 files changed, 148 insertions(+), 14 deletions(-) diff --git a/src/modules/components/test_status/test_status.ts b/src/modules/components/test_status/test_status.ts index 8929f7d..c9c6bf0 100644 --- a/src/modules/components/test_status/test_status.ts +++ b/src/modules/components/test_status/test_status.ts @@ -29,7 +29,9 @@ export class TestStatus extends BI.Widget { failDriverMessage: Label; driverLink: FloatLeftLayout; detail: VerticalLayout; - failMaskers:any; + failMaskers: any; + + extraContainer: VerticalLayout; watch = { status: (status: string) => { @@ -38,8 +40,9 @@ export class TestStatus extends BI.Widget { } render() { + const LAYOUT_WIDTH = 400; const { loadingCls, loadingText, successCls, successText, failCls, failText, retryText } = this.options; - var self=this; + var self = this; return { type: BI.CenterAdaptLayout.xtype, cls: 'bi-z-index-mask', @@ -71,10 +74,10 @@ export class TestStatus extends BI.Widget { tipCls: failCls, tipText: failText, retryText, - ref:(_ref:any)=>{ - self.failMaskers=_ref; - if(this.failMessage.getText()===''){ - this.failMaskers.populateFail(BI.i18nText("Dec-Conn-ect-Failed"),false); + ref: (_ref: TipFail) => { + this.failMaskers = _ref; + if (BI.isEmptyString(this.failMessage.getText())) { + this.failMaskers.populateFail(BI.i18nText('Dec-Conn-ect-Failed'), false); } }, listeners: [ @@ -123,10 +126,17 @@ export class TestStatus extends BI.Widget { scrolly: true, height: 75, items: [ + { + type: BI.VerticalLayout.xtype, + width: LAYOUT_WIDTH, + ref: (_ref: VerticalLayout) => { + this.extraContainer = _ref; + } + }, { type: BI.Label.xtype, whiteSpace: 'normal', - width: 400, + width: LAYOUT_WIDTH, textAlign: 'left', text: '', ref: (_ref: Label) => { @@ -175,7 +185,7 @@ export class TestStatus extends BI.Widget { this.store.setStatus(TEST_STATUS.SUCCESS); } - setFail(message: string='', driver = '', link = '') { + setFail(message: string = '', driver = '', link = '') { this.store.setStatus(TEST_STATUS.FAIL); this.failMessage.setText(message); this.failDriverMessage.setVisible(!!driver); @@ -189,4 +199,14 @@ export class TestStatus extends BI.Widget { setLoading() { this.store.setStatus(TEST_STATUS.LOADING); } + + /** + * 设置报错弹窗自定义展示内容 + */ + setExtraContainer(container: Obj) { + BI.createWidget({ + ...container, + element: this.extraContainer, + }); + } } diff --git a/src/modules/crud/api.ts b/src/modules/crud/api.ts index daa9e4d..01ed8dd 100644 --- a/src/modules/crud/api.ts +++ b/src/modules/crud/api.ts @@ -5,6 +5,7 @@ import { ConnectionPoolType, SocketResult, ResultType, + checkDriverStatusParams, } from './crud.typings'; export interface Api { @@ -46,6 +47,17 @@ export interface Api { */ testConnection(data: Connection): Promise; + /** + * 获取驱动加载路径 + */ + getDriverLoadPath(data: Connection): Promise>; + + /** + * 检测驱动冲突状态 + * @param data 驱动路径 + */ + checkDriverStatus(data: checkDriverStatusParams): Promise>; + /** * 获取连接池数据 * @param name diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 0193583..f9baae9 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -306,8 +306,13 @@ export interface SocketResult { errorMsg?: string; } -export interface ResultType { - data?: any; +export interface ResultType { + data?: T; errorCode?: string; errorMsg?: string; } + +export type checkDriverStatusParams = { + path: string; + driver: ConnectionJDBC['driver'] +} \ No newline at end of file diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index a77f406..54bbc9e 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -1,5 +1,5 @@ import { Api } from './api'; -import { Connection, TestRequest, ConnectionPoolType, SocketResult, ConnectionLicInfo } from './crud.typings'; +import { Connection, TestRequest, ConnectionPoolType, SocketResult, ConnectionLicInfo, ResultType, checkDriverStatusParams } from './crud.typings'; import { requestGet, requestDelete, requestPost, requestPut } from './crud.service'; import { editStatusEvent, errorCode } from '@constants/env'; @@ -48,6 +48,27 @@ export class DecisionApi implements Api { return requestPost('test', form); } + /** + * 获取驱动加载路径 + * @returns + */ + getDriverLoadPath(data: Connection): Promise> { + const form = { + ...data, + connectionData: JSON.stringify(data.connectionData), + } + + return requestPost('driver/path', form); + } + + /** + * 检测驱动冲突状态 + * @param data 驱动路径 + */ + checkDriverStatus(data: checkDriverStatusParams): Promise> { + return requestGet(Dec.Utils.getEncodeURL('test/driver/conflict', '', data)); + } + getConnectionPool(name: string): Promise<{ data?: ConnectionPoolType }> { return requestGet(`pool/info?connectionName=${encodeURIComponent(name)}`, {}); } diff --git a/src/modules/crud/design.api.ts b/src/modules/crud/design.api.ts index 643ad8e..b1e3d2d 100644 --- a/src/modules/crud/design.api.ts +++ b/src/modules/crud/design.api.ts @@ -1,5 +1,5 @@ import { Api } from './api'; -import { Connection, TestRequest, ConnectionPoolType, SocketResult, ConnectionLicInfo } from './crud.typings'; +import { Connection, TestRequest, ConnectionPoolType, SocketResult, ConnectionLicInfo, ResultType, ConnectionJDBC, checkDriverStatusParams } from './crud.typings'; import { requestGet } from './crud.service'; // TODO: 此页面的接口等待设计器提供相应的方法 @@ -39,6 +39,27 @@ export class DesignApi implements Api { }); } + /** + * 获取驱动加载路径 + * @param name + * @returns + */ + getDriverLoadPath(data: Connection): Promise> { + return new Promise(resolve => { + resolve({ data: '' }); + }); + } + + /** + * 检测驱动冲突状态 + * @param data 驱动路径 + */ + checkDriverStatus(data: checkDriverStatusParams): Promise> { + return new Promise(resolve => { + resolve({ data: false }); + }) + } + getConnectionPool(name: string): Promise<{ data: ConnectionPoolType }> { return new Promise(resolve => { resolve({ diff --git a/src/modules/pages/maintain/forms/form.server.ts b/src/modules/pages/maintain/forms/form.server.ts index 67647fc..2098ac1 100644 --- a/src/modules/pages/maintain/forms/form.server.ts +++ b/src/modules/pages/maintain/forms/form.server.ts @@ -5,6 +5,7 @@ import { TestStatus } from '../../../components/test_status/test_status'; import { getJdbcDatabaseType } from '../../../app.service'; import { ApiFactory } from '../../../crud/apiFactory'; const api = new ApiFactory().create(); + export function testConnection(value: Connection): Promise { return new Promise(resolve => { let testStatus = null; @@ -15,16 +16,18 @@ export function testConnection(value: Connection): Promise { return false; } + const id = BI.UUID(); const testConnection = () => { const formValue = value; + api.testConnection(formValue).then(re => { if (re && re.errorCode) { - if(re.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED){ + if (re.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED) { testStatus.setFail(); return; } - // 判断是否是缺少驱动,如果缺少驱动则显示下载驱动的连接 + // 判断是否是缺少驱动,如果缺少驱动则显示下载驱动的连接 if (api.isDriverError(re.errorCode)) { if (formValue.connectionType === connectionType.JDBC) { const driver = (formValue.connectionData as ConnectionJDBC).driver; @@ -44,7 +47,11 @@ export function testConnection(value: Connection): Promise { } else if (re.errorCode === errorCode.DUPLICATE_NAMES) { testStatus.setFail(BI.i18nText(re.errorMsg)); } else { + // 不缺少驱动,但连接失败,打印出当前驱动加载路径,并显示检测驱动按钮 testStatus.setFail(re.errorMsg); + api.getDriverLoadPath(formValue).then(res => { + testStatus.setExtraContainer(createDriverTestContainer(res.data)); + }) } } else if (re.data) { testStatus.setSuccess(); @@ -59,7 +66,54 @@ export function testConnection(value: Connection): Promise { BI.Maskers.remove(id); } }); + + /** + * 驱动及冲突检测内容,补充到报错弹窗里 + */ + function createDriverTestContainer(path: string) { + return { + type: BI.VerticalLayout.xtype, + vgap: 5, + items: [ + { + type: BI.Label.xtype, + text: BI.i18nText('Dec-Connection_Driver_Current_Load_Path', path), + textAlign: 'left', + whiteSpace: 'normal', + }, + { + type: BI.TextButton.xtype, + cls: 'bi-high-light', + text: BI.i18nText('Dec-Connection_Driver_Check'), + textAlign: 'left', + handler: () => { + api.checkDriverStatus({ + driver: (formValue.connectionData as ConnectionJDBC).driver, + path, + }).then(res => { + const isDriverConflict = res.data; + + testStatus.setExtraContainer({ + type: BI.VerticalLayout.xtype, + items: [ + { + type: BI.Label.xtype, + textAlign: 'left', + text: isDriverConflict + ? BI.i18nText('Dec-Connection_Driver_Has_Confilt_Tip') + : BI.i18nText('Dec-Connection_Driver_No_Confilt_Tip'), + cls: isDriverConflict ? 'bi-error' : '', + } + ] + }) + }); + } + } + ] + } + } }; + BI.Maskers.create(id, null, { render: { type: TestStatus.xtype, diff --git a/types/globals.d.ts b/types/globals.d.ts index f868d4b..0eb147e 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -16,6 +16,7 @@ declare const Dec: { personal: { username: string; }; + Utils: Obj; reqByEncrypt: (method: AxiosType.X_Method, url: string, data?: any, config?: AxiosType.X_AxiosRequestConfig) => {}, socketEmit: (type: string, name: string, callback: (re: any) => void) => void; // req From 68aef91840844073d5ed770b71dd5f79e31840ab Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Mon, 20 Mar 2023 16:43:29 +0800 Subject: [PATCH 066/116] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/test_status/test_status.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/components/test_status/test_status.ts b/src/modules/components/test_status/test_status.ts index c9c6bf0..a055e6e 100644 --- a/src/modules/components/test_status/test_status.ts +++ b/src/modules/components/test_status/test_status.ts @@ -42,7 +42,7 @@ export class TestStatus extends BI.Widget { render() { const LAYOUT_WIDTH = 400; const { loadingCls, loadingText, successCls, successText, failCls, failText, retryText } = this.options; - var self = this; + return { type: BI.CenterAdaptLayout.xtype, cls: 'bi-z-index-mask', From a39db945c754cd0c3e8700bdc3238afed9375a18 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Mon, 20 Mar 2023 16:54:24 +0800 Subject: [PATCH 067/116] =?UTF-8?q?=E6=97=A0JIRA=EF=BC=8C=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=B8=8B=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/crud.typings.d.ts | 2 +- src/modules/crud/decision.api.ts | 2 +- src/modules/crud/design.api.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index f9baae9..8a5c8b9 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -314,5 +314,5 @@ export interface ResultType { export type checkDriverStatusParams = { path: string; - driver: ConnectionJDBC['driver'] + driver: ConnectionJDBC['driver']; } \ No newline at end of file diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 54bbc9e..dbcf141 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -56,7 +56,7 @@ export class DecisionApi implements Api { const form = { ...data, connectionData: JSON.stringify(data.connectionData), - } + }; return requestPost('driver/path', form); } diff --git a/src/modules/crud/design.api.ts b/src/modules/crud/design.api.ts index b1e3d2d..d629b16 100644 --- a/src/modules/crud/design.api.ts +++ b/src/modules/crud/design.api.ts @@ -57,7 +57,7 @@ export class DesignApi implements Api { checkDriverStatus(data: checkDriverStatusParams): Promise> { return new Promise(resolve => { resolve({ data: false }); - }) + }); } getConnectionPool(name: string): Promise<{ data: ConnectionPoolType }> { From 2a69cb9907a7c53520b47563c689f2a7aa6d5702 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Mon, 20 Mar 2023 16:54:28 +0800 Subject: [PATCH 068/116] =?UTF-8?q?KERNEL-10281=20docs:=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cca899a..50cd82d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## 开始 安装依赖 ``` -yarn +yarn install ``` 开始开发 @@ -15,6 +15,104 @@ yarn yarn dev ``` +## 决策平台开发: + +### A.项目运行 + +#### 1. 工程`decision-webui-dev`添加代理(可跳过) +```js + webpack/webpack.config + "/plugin/dcm": { + pathRewrite: { "^/plugin/dcm": "" }, + target: "http://localhost:10002", + }, +``` +#### 2. 工程`decision-webui-dev`引入 + fr环境:`templates/bundle.report.html` bi环境:`templates/bundle.bi.html` + +```html + // css 文件: + + + + + + // js 文件 + +``` + 若未设1,将`/plugin/dcm`替换成`http://localhost:10002`亦可 +#### 3. 启动工程[decision-webui-dev]以及数据连接[desicion-webui-dcm]工程 + +#### 4. 此时工程`decision-webui-dev`的`http://localhost:9002/#management/connnection`数据连接模块已替换成该工程 + +### B.插件形式添加数据连接-数据库 + +#### 1. 以多版本的tdsql为例 单一版本数据库不需drivers,versions,hasSchemas + +```js +BI.config("dec.connection.provider.datebase", function (provider) { + BI.isFunction(provider.registerJdbcDatabase) && provider.registerJdbcDatabase({ + text: 'TDSQL', // 数据库名称 + databaseType: 'tdsql', // 数据库key + driver: 'org.postgresql.Driver', // 默认驱动 + drivers: { + "pgsql": ["org.postgresql.Driver"], + "mysql": ["com.mysql.jdbc.Driver"] + }, // 驱动可选项,version: array[driver],[0]为该版本的默认驱动 + versions: ["pgsql", "mysql"], // array[version] + urls: { + "org.postgresql.Driver": "jdbc:postgresql://hostname:port/database?finedbType=tdsql-pgsql", + "com.mysql.jdbc.Driver": "jdbc:mysql://hostname:port/database?finedbType=tdsql-mysql" + }, // urlkey : url 一个驱动对应一个url + url: 'jdbc:postgresql://hostname:port/database?finedbType=tdsql-pgsql', + commonly: false, + internal: true, + type: 'jdbc', 数据库类型 + hasSchema: true, // 默认是否支持模式 + hasSchemas: { + "pgsql": true, + "mysql": false, + },是否支持模式 version: boolean + kerberos: false, // 是否添加kerberos认证方式 + }, function (url) { + var result = url.match(/^jdbc:(mysql|postgresql):\/\/([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?\/([0-9a-zA-Z_\\.]+)(.*)finedbType=([^&]+)(|(&.*))/i); // 匹配正则 + if (result) { + return { + host: result[2], //主机 + port: result[4] === "port" ? "" : result[4], // 端口 + databaseName: result[5], // 数据库名称 + version: result[7].split('-')[1] ?? "pgsql", // 版本 单版本不要返回这个 + }; + } +//适配原先tbase的url + result = url.match(/^jdbc:postgresql:\/\/([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?\/([0-9a-zA-Z_\\.]+)(.*)/i); + if (result) { + return { + host: result[1], + port: result[3] === "port" ? "" : result[3], + databaseName: result[4], + version: "pgsql", + }; + } + + }); + }); +``` + +### C 工程开发 + +#### 1. 图片资源添加 + 工程`decision-webui-dev` + decision-webui/dist/images/1x/icon/database + decision-webui/dist/images/2x/icon/database + +#### 2. 国际化添加 + 工程`decision-webui-dev` + decision-i18n/decision-main-i18n/src/main/resources/com/fr/decision/web/i18n + +#### 3. 版本控制 + 版本和平台保持一致 + ## 接口文档: ### 增加数据连接类型 使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.types`,值为连接的名称 From 6efad99c382b76b62ca0251dca88de54df16b890 Mon Sep 17 00:00:00 2001 From: "Aries.lsy" <”Aries.lsy@fanruan.com“> Date: Wed, 22 Mar 2023 11:34:31 +0800 Subject: [PATCH 069/116] =?UTF-8?q?REPORT-92280=20fix:timeBetweenEvictionR?= =?UTF-8?q?unsMillis=E9=BB=98=E8=AE=A4=E5=80=BC=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/constants/constant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index dbf1b28..fa34f1f 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -831,7 +831,7 @@ export const DEFAULT_JDBC_POOL = { testOnBorrow: true, testOnReturn: false, testWhileIdle: false, - timeBetweenEvictionRunsMillis: -1, + timeBetweenEvictionRunsMillis: 60000, numTestsPerEvictionRun: 3, minEvictableIdleTimeMillis: 1800, }; From 04a10740ec7ebc06c3006160af3d668eeb4176ea Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 22 Mar 2023 15:25:29 +0800 Subject: [PATCH 070/116] =?UTF-8?q?REPORT-91742=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=BF=9E=E6=8E=A5=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/connection/list/list_item/list_item.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 58537d7..a3c9f2c 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -6,6 +6,9 @@ import { hasRegistered } from '../list.service'; import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../../../app.service'; import { testConnection } from '../../../maintain/forms/form.server'; import { DownListCombo, Label, SignEditor } from '@fui/core'; +import { ApiFactory } from '../../../../crud/apiFactory'; + +const api = new ApiFactory().create(); @shortcut() @store(ListItemModel) @@ -206,8 +209,17 @@ export class ListItem extends BI.BasicButton { } private testConnectionAction() { - const { name } = this.options; - testConnection(this.model.connections.find(item => item.connectionName === name)); + // 接口返回的内容是对称加密的,前端要先解密再用新加密传回去 + const connection = this.model.connections + .find(item => item.connectionName === this.options.name) || {}; + + if (BI.isNull(connection)) return; + + const validationQuery = connection?.connectionData?.connectionPoolAttr?.validationQuery; + + BI.set(connection, 'connectionData.connectionPoolAttr.validationQuery', api.getCipher(api.getPlain(validationQuery))); + + testConnection(connection); } private itemActionCalculate() { From ad38c145260f0e8909616eef5abe586ac84c5e10 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 22 Mar 2023 15:29:13 +0800 Subject: [PATCH 071/116] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/list/list_item/list_item.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index a3c9f2c..63e186c 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -211,7 +211,7 @@ export class ListItem extends BI.BasicButton { private testConnectionAction() { // 接口返回的内容是对称加密的,前端要先解密再用新加密传回去 const connection = this.model.connections - .find(item => item.connectionName === this.options.name) || {}; + .find(item => item.connectionName === this.options.name); if (BI.isNull(connection)) return; From 9fa393d58399b94d24ad38decf9820dc12e1132c Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 22 Mar 2023 15:57:20 +0800 Subject: [PATCH 072/116] =?UTF-8?q?REPORT-91742=20fix:=20=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E4=B8=8B=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/list/list_item/list_item.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 63e186c..60736d3 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -215,7 +215,7 @@ export class ListItem extends BI.BasicButton { if (BI.isNull(connection)) return; - const validationQuery = connection?.connectionData?.connectionPoolAttr?.validationQuery; + const validationQuery = connection?.connectionData?.connectionPoolAttr?.validationQuery || ''; BI.set(connection, 'connectionData.connectionPoolAttr.validationQuery', api.getCipher(api.getPlain(validationQuery))); From 9662daabda7970fca695dcad51759ccb984204e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Thu, 6 Apr 2023 17:11:47 +0800 Subject: [PATCH 073/116] =?UTF-8?q?REPORT-91727=20=E5=AF=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=BE=93=E5=85=A5=E7=9A=84=E5=8F=82=E6=95=B0=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=BB=9F=E4=B8=80=E6=A0=A1=E9=AA=8C=20feat=EF=BC=9Adc?= =?UTF-8?q?m=E4=BB=93=E5=BA=93=E9=87=8C=E9=9D=A2=E6=9C=89=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E5=9C=BA=E6=99=AF=EF=BC=8C=E8=BF=99=E9=87=8C=E5=BC=95?= =?UTF-8?q?=E5=85=A5=E8=BF=9B=E6=9D=A5=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkIllegalStrings.ts | 44 +++++++++++++++++++ .../core/checkIllegalStrings/constant.ts | 15 +++++++ src/modules/core/index.ts | 1 + .../connection/list/list_item/list_item.ts | 12 +++++ src/modules/pages/maintain/forms/form.ts | 7 +++ 5 files changed, 79 insertions(+) create mode 100644 src/modules/core/checkIllegalStrings/checkIllegalStrings.ts create mode 100644 src/modules/core/checkIllegalStrings/constant.ts create mode 100644 src/modules/core/index.ts diff --git a/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts b/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts new file mode 100644 index 0000000..696d8fb --- /dev/null +++ b/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts @@ -0,0 +1,44 @@ +/* + https://work.fineres.com/browse/REPORT-91724 用于参数统一校验 + */ +import { ILLEGAL_STRINGS } from "./constant"; +export type CheckResult = { + legal: boolean, + errorMsg: string, +} +export const CHECK_CORRECT: CheckResult = { + legal: true, + errorMsg: "", +}; + +/** + * 检测非法字符,返回错误提示 + * @param value 要校验的字符串 + */ +export function checkIllegalStrings(value: string): CheckResult { + // 后端传入的校验开关,如果没传,那也默认开启 + const enabled = Dec.system.enableParameterVerify ?? true; + if (enabled) { + const illegalStringIndex = ILLEGAL_STRINGS.findIndex(s => value.includes(s)); + if (illegalStringIndex === -1) { + return CHECK_CORRECT; + } + + return { + legal: false, + errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${ILLEGAL_STRINGS[illegalStringIndex]}`, + }; + } + + return CHECK_CORRECT; +} + +export function checkIllegalStringsInWidgetAndShowError(widget: any) { + const value = widget.getValue(); + const result = checkIllegalStrings(value); + if (!result.legal) { + widget.showError(result.errorMsg); + } + + return result.legal; +} diff --git a/src/modules/core/checkIllegalStrings/constant.ts b/src/modules/core/checkIllegalStrings/constant.ts new file mode 100644 index 0000000..a034a3f --- /dev/null +++ b/src/modules/core/checkIllegalStrings/constant.ts @@ -0,0 +1,15 @@ +/** + * 参数检验的非法字符数组 + */ +export const ILLEGAL_STRINGS = [ + "\"", + "<", + ">", + "&", + "/script", + "javascript:", + "onblur", + "getRuntime", + "ProcessBuilder", + "java.lang.ProcessImpl", +]; diff --git a/src/modules/core/index.ts b/src/modules/core/index.ts new file mode 100644 index 0000000..efe056c --- /dev/null +++ b/src/modules/core/index.ts @@ -0,0 +1 @@ +export { checkIllegalStringsInWidgetAndShowError, checkIllegalStrings } from "./checkIllegalStrings/checkIllegalStrings" diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 60736d3..e61114c 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -7,6 +7,7 @@ import { connectionCanEdit, getTextByDatabaseType, getChartLength } from '../../ import { testConnection } from '../../../maintain/forms/form.server'; import { DownListCombo, Label, SignEditor } from '@fui/core'; import { ApiFactory } from '../../../../crud/apiFactory'; +import { checkIllegalStrings } from "@core/index"; const api = new ApiFactory().create(); @@ -89,6 +90,17 @@ export class ListItem extends BI.BasicButton { return; } + const result = checkIllegalStrings(newName); + if (!result.legal) { + BI.Msg.toast(result.errorMsg, { + level: 'error', + }); + this.store.setIsEdit(false, name); + this.nameLabel.setText(name); + this.nameEditor.setValue(name); + + return; + } this.store.changeName(name, newName).then(re => { this.store.setIsEdit(false, name); if (re.errorCode) { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 609b880..4039f81 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -8,6 +8,7 @@ import { ConnectionJDBC, Connection, ResultType } from 'src/modules/crud/crud.ty 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'; +import { checkIllegalStrings } from "@core/index"; @shortcut() @store(MaintainFormModel) @@ -209,6 +210,12 @@ export class MaintainForm extends BI.Widget { if (this.form.validation && !this.form.validation()) { return false; } + const result = checkIllegalStrings(value.connectionName); + if (!result.legal) { + this.setFromError(result.errorMsg); + + return false; + } return true; } From ae629c949614ee40b6231521463763ccf6074527 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 11 Apr 2023 14:39:07 +0800 Subject: [PATCH 074/116] =?UTF-8?q?REPORT-93513=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=95=BF=E6=96=87=E6=9C=AC=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/database/database.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index b955b64..f905765 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -147,20 +147,18 @@ export class Datebase extends BI.Widget { items: [ { el: { - type: BI.HTapeLayout.xtype, + type: BI.VerticalAdaptLayout.xtype, hgap: 20, invisible: true, items: [ { type: BI.Label.xtype, - width: 70, textAlign: 'left', text: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), title: BI.i18nText('Dec-Dcm_Connection_Type_Filter'), }, { type: BI.MultiSelectItem.xtype, - width: 80, selected: this.model.isInternal, text: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), title: BI.i18nText('Dec-Dcm_Connection_Support_Inner'), @@ -173,7 +171,6 @@ export class Datebase extends BI.Widget { }, { type: BI.MultiSelectItem.xtype, - width: 80, selected: this.model.isPlugin, text: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), title: BI.i18nText('Dec-Dcm_Connection_Support_Plugin'), From 93f297c6143b970f247c39f83cd96915843893eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Tue, 11 Apr 2023 15:43:53 +0800 Subject: [PATCH 075/116] =?UTF-8?q?REPORT-93628=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E5=B9=B3=E5=8F=B0=E8=A7=86=E8=A7=89=E9=80=82?= =?UTF-8?q?=E9=85=8D=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E4=BF=AE=E6=94=B9=E4=B8=8B=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=A4=84=E7=9A=84=E8=A7=86=E8=A7=89=E5=B1=95=E7=A4=BA=20fix:?= =?UTF-8?q?=20=E5=85=B6=E5=AE=9E=E9=80=82=E9=85=8D6.0=E7=9A=84=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E4=B8=8D=E6=B6=89=E5=8F=8A=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E9=83=A8=E5=88=86=E3=80=82=20=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E4=B8=BB=E9=A3=8E=E6=A0=BC=E6=94=B9=E4=B8=BA=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86border-bottom=E9=A3=8E=E6=A0=BC=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E9=82=A3=E4=B9=88=E8=BF=99=E9=87=8C=E4=B9=9F=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=94=B9=E4=B8=80=E4=B8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 7db6718..5f88a0f 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -423,7 +423,7 @@ export class FormJdbc extends BI.Widget { { type: BI.Editor.xtype, $value: 'password', - cls: 'bi-border bi-border-radius', + cls: 'bi-border-bottom', width: EDITOR_WIDTH, height: EDITOR_HEIGHT, allowBlank: true, @@ -715,7 +715,7 @@ export class FormJdbc extends BI.Widget { { type: BI.Editor.xtype, $value: 'temporary-file-pieces-limit', - cls: 'bi-border bi-border-radius', + cls: 'bi-border-bottom', width: EDITOR_WIDTH, height: EDITOR_HEIGHT, allowBlank: true, @@ -735,7 +735,7 @@ export class FormJdbc extends BI.Widget { { type: BI.Editor.xtype, $value: 'temporary-file-size-limit', - cls: 'bi-border bi-border-radius', + cls: 'bi-border-bottom', width: EDITOR_WIDTH, height: EDITOR_HEIGHT, allowBlank: true, @@ -801,7 +801,7 @@ export class FormJdbc extends BI.Widget { { type: BI.Editor.xtype, $value: 'hdfs-connection-address', - cls: 'bi-border bi-border-radius', + cls: 'bi-border-bottom', width: EDITOR_WIDTH, height: EDITOR_HEIGHT, allowBlank: true, From 7e3dabb31659f4eee6c3d06982fdcc1f88bfd13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Tue, 11 Apr 2023 16:12:39 +0800 Subject: [PATCH 076/116] =?UTF-8?q?REPORT-93627=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E5=B9=B3=E5=8F=B0=E8=A7=86=E8=A7=89=E9=80=82?= =?UTF-8?q?=E9=85=8D=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E6=A8=A1=E5=BC=8F=E9=80=89=E6=8B=A9=E5=A4=84?= =?UTF-8?q?=E6=9C=89=E6=BB=9A=E5=8A=A8=E6=9D=A1=20fix:=20=E5=B9=B6?= =?UTF-8?q?=E9=9D=9E=E8=BF=99=E6=AC=A1=E8=BF=AD=E4=BB=A3=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E4=B9=8B=E5=89=8D=E5=B0=B1=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82=20=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B=E9=97=B4?= =?UTF-8?q?=E8=B7=9D=E7=9A=84=E8=AE=BE=E7=BD=AE=E5=A4=A7=E5=B0=8F=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=8C=A4=E5=87=BA=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 3 ++- 1 file changed, 2 insertions(+), 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 5f88a0f..28aa75f 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -573,6 +573,7 @@ export class FormJdbc extends BI.Widget { forms: [ { type: BI.VerticalLayout.xtype, + height: 55, items: [ { type: BI.FloatLeftLayout.xtype, @@ -595,9 +596,9 @@ export class FormJdbc extends BI.Widget { }, { type: BI.TextValueCombo.xtype, + _tgap: 15, $value: 'schema', width: EDITOR_WIDTH, - tgap: 15, disabled: true, value: schema, items: schema ? [{ text: schema, value: schema }] : [], From 23b901b251afc5eaf5f8f12e7b08115c47d703fe Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 11 Apr 2023 17:32:58 +0800 Subject: [PATCH 077/116] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E9=A1=BA=E5=B8=A6=E5=A4=84=E7=90=86=E4=B8=8B=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/test_status/tip_icon/tip_fail.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modules/components/test_status/tip_icon/tip_fail.ts b/src/modules/components/test_status/tip_icon/tip_fail.ts index f8a77f3..c943248 100644 --- a/src/modules/components/test_status/tip_icon/tip_fail.ts +++ b/src/modules/components/test_status/tip_icon/tip_fail.ts @@ -54,8 +54,7 @@ export class TipFail extends BI.Widget { }], }, { type: BI.Label.xtype, - height: 14, - bgap: 10, + _bgap: 10, text: tipText, ref:(_ref:Label)=>{ this.failText=_ref; @@ -63,12 +62,12 @@ export class TipFail extends BI.Widget { }, { type: BI.VerticalAdaptLayout.xtype, - hgap: 5, + _hgap: 12, items: [ { type: BI.Button.xtype, text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), - level: 'ignore', + clear: true, ref: (_ref: Button) => { this.detailButton = _ref; }, @@ -79,8 +78,8 @@ export class TipFail extends BI.Widget { }, { type: BI.Button.xtype, + light: true, text: BI.i18nText('Dec-Dcm_Back'), - level: 'ignore', handler: () => { this.fireEvent(TipFail.EVENT_CLOSE); }, From b44835ef906bf44999f9a9d8c0b7c6bb539f9ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Wed, 12 Apr 2023 10:37:01 +0800 Subject: [PATCH 078/116] =?UTF-8?q?REPORT-93628=20fix=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=8B=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/file_chooser/file_chooser.ts | 2 +- src/modules/components/file_upload/file_upload.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/components/file_chooser/file_chooser.ts b/src/modules/components/file_chooser/file_chooser.ts index 634cfdb..dc430d1 100644 --- a/src/modules/components/file_chooser/file_chooser.ts +++ b/src/modules/components/file_chooser/file_chooser.ts @@ -41,7 +41,7 @@ export class FileChooser extends BI.Widget { items: [ { type: BI.SignEditor.xtype, - cls: 'bi-border bi-focus-shadow', + cls: 'bi-border-bottom bi-focus-shadow', width, height: 22, watermark, diff --git a/src/modules/components/file_upload/file_upload.ts b/src/modules/components/file_upload/file_upload.ts index 01892c0..9a4f62f 100644 --- a/src/modules/components/file_upload/file_upload.ts +++ b/src/modules/components/file_upload/file_upload.ts @@ -59,7 +59,7 @@ export class FileUpload extends BI.Widget { items: [ { type: BI.SignEditor.xtype, - cls: 'bi-border bi-focus-shadow', + cls: 'bi-border-bottom bi-focus-shadow', width: 300, height: 22, watermark, @@ -144,9 +144,9 @@ export class FileUpload extends BI.Widget { this.fileModified = _ref; }, }] - + }], - + }, tgap: 14, lgap: 4, @@ -155,7 +155,7 @@ export class FileUpload extends BI.Widget { type: BI.IconButton.xtype, cls: "default-delete-font", handler: function () { - NProgress.set(0.0); + NProgress.set(0.0); self.xhr.abort(); self.store.setFileName(''); self.clearInfo(); From f89124a76dc9f847150d4d656d59c3d9daae0dae Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 13 Apr 2023 15:16:12 +0800 Subject: [PATCH 079/116] =?UTF-8?q?REPORT-93847=20fix=EF=BC=9A=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/test_status/tip_icon/tip_fail.ts | 2 +- src/modules/pages/connection/connection.ts | 1 - src/modules/title/title_database/title_datebase.ts | 5 +++-- src/modules/title/title_maintain/title_maintain.ts | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/components/test_status/tip_icon/tip_fail.ts b/src/modules/components/test_status/tip_icon/tip_fail.ts index c943248..576580e 100644 --- a/src/modules/components/test_status/tip_icon/tip_fail.ts +++ b/src/modules/components/test_status/tip_icon/tip_fail.ts @@ -62,7 +62,7 @@ export class TipFail extends BI.Widget { }, { type: BI.VerticalAdaptLayout.xtype, - _hgap: 12, + hgap: 12, items: [ { type: BI.Button.xtype, diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 90f5ba1..881759d 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -143,7 +143,6 @@ export class Connection extends BI.Widget { }, }], }, - width: 90, }, ], }, diff --git a/src/modules/title/title_database/title_datebase.ts b/src/modules/title/title_database/title_datebase.ts index 1441d75..6541237 100644 --- a/src/modules/title/title_database/title_datebase.ts +++ b/src/modules/title/title_database/title_datebase.ts @@ -25,13 +25,13 @@ export class TitleDatabase extends BI.Widget { items: [{ type: BI.VerticalAdaptLayout.xtype, height: 40, - rgap: 5, + rgap: 16, items: [ { type: BI.Button.xtype, $value: 'title-database-cancel', text: BI.i18nText('BI-Basic_Cancel'), - level: 'ignore', + light: true, handler: () => { this.store.setPageIndex(PAGE_INDEX.CONNECTION); }, @@ -49,6 +49,7 @@ export class TitleDatabase extends BI.Widget { }, }, ], + _rgap: -16, }], }; } diff --git a/src/modules/title/title_maintain/title_maintain.ts b/src/modules/title/title_maintain/title_maintain.ts index 18fdc2c..9eed070 100644 --- a/src/modules/title/title_maintain/title_maintain.ts +++ b/src/modules/title/title_maintain/title_maintain.ts @@ -15,13 +15,13 @@ export class TitleMaintain extends BI.Widget { items: [{ type: BI.VerticalAdaptLayout.xtype, height: 40, - rgap: 5, + hgap: 16, items: [ { type: BI.Button.xtype, $value: 'title-maintain-cancel', text: BI.i18nText('BI-Basic_Cancel'), - level: 'ignore', + clear: true, handler: () => { this.store.setIsCopy(false); this.store.setPageIndex(PAGE_INDEX.CONNECTION); @@ -32,7 +32,7 @@ export class TitleMaintain extends BI.Widget { type: BI.Button.xtype, $value: 'title-maintain-connection-test', text: BI.i18nText('Dec-Dcm_Connection_Test'), - level: 'ignore', + light: true, handler: () => { this.store.setTestEvent(); }, @@ -47,6 +47,7 @@ export class TitleMaintain extends BI.Widget { }, }, ], + _hgap: -16, }], }; } From 18539944944b9ddb5b5e072b169803b8e5f0aa43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Tue, 18 Apr 2023 14:11:09 +0800 Subject: [PATCH 080/116] =?UTF-8?q?REPORT-91727=20=E5=AF=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=BE=93=E5=85=A5=E7=9A=84=E5=8F=82=E6=95=B0=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E7=BB=9F=E4=B8=80=E6=A0=A1=E9=AA=8C=20DCM=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E4=B9=9F=E8=A6=81=E6=94=B9=E4=B8=8B=20feat=EF=BC=9A?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E9=80=BB=E8=BE=91=E5=8F=98=E6=9B=B4=EF=BC=8C?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E5=85=B3=E9=94=AE=E5=AD=97=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=B8=8D=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkIllegalStrings.ts | 26 ++++++++++++------- .../core/checkIllegalStrings/constant.ts | 8 +++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts b/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts index 696d8fb..ddc4f99 100644 --- a/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts +++ b/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts @@ -18,19 +18,27 @@ export const CHECK_CORRECT: CheckResult = { export function checkIllegalStrings(value: string): CheckResult { // 后端传入的校验开关,如果没传,那也默认开启 const enabled = Dec.system.enableParameterVerify ?? true; + let result = CHECK_CORRECT; if (enabled) { - const illegalStringIndex = ILLEGAL_STRINGS.findIndex(s => value.includes(s)); - if (illegalStringIndex === -1) { - return CHECK_CORRECT; - } + // 关键字不区分大小写 + ILLEGAL_STRINGS.every(s => { + const sIndex = value.toLowerCase().indexOf(s); + if (sIndex !== -1) { + result = { + legal: false, + errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${value.substr(sIndex, s.length)}`, + }; - return { - legal: false, - errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${ILLEGAL_STRINGS[illegalStringIndex]}`, - }; + return false; + } + + return true; + }); + + return result; } - return CHECK_CORRECT; + return result; } export function checkIllegalStringsInWidgetAndShowError(widget: any) { diff --git a/src/modules/core/checkIllegalStrings/constant.ts b/src/modules/core/checkIllegalStrings/constant.ts index a034a3f..351c185 100644 --- a/src/modules/core/checkIllegalStrings/constant.ts +++ b/src/modules/core/checkIllegalStrings/constant.ts @@ -1,5 +1,5 @@ /** - * 参数检验的非法字符数组 + * 参数检验的非法字符数组,由于不区分大小写,统一用小写 */ export const ILLEGAL_STRINGS = [ "\"", @@ -9,7 +9,7 @@ export const ILLEGAL_STRINGS = [ "/script", "javascript:", "onblur", - "getRuntime", - "ProcessBuilder", - "java.lang.ProcessImpl", + "getruntime", + "processbuilder", + "java.lang.processimpl", ]; From eb6b5e6cffc817f239857d0556c24017b0785ab4 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Sun, 23 Apr 2023 11:54:55 +0800 Subject: [PATCH 081/116] =?UTF-8?q?REPORT-93097=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=A4=9A=E6=AC=A1?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/list/list_item/list_item.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index e61114c..6723947 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -222,8 +222,8 @@ export class ListItem extends BI.BasicButton { private testConnectionAction() { // 接口返回的内容是对称加密的,前端要先解密再用新加密传回去 - const connection = this.model.connections - .find(item => item.connectionName === this.options.name); + const connection = BI.cloneDeep(this.model.connections + .find(item => item.connectionName === this.options.name)); if (BI.isNull(connection)) return; From 60c5ecf23e108c779e01515e46788533d52adcfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Mon, 24 Apr 2023 19:46:26 +0800 Subject: [PATCH 082/116] =?UTF-8?q?REPORT-94752=E3=80=90=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=20fix=EF=BC=9A=20=E8=A7=86=E8=A7=89=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.ts | 9 ++++----- src/modules/title/title.ts | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/app.ts b/src/modules/app.ts index 5155f5b..d909040 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -38,7 +38,6 @@ export class App extends BI.Widget { { el: { type: Title.xtype, - cls: 'bi-border-bottom', listeners: [{ eventName: 'EVENT_CLICK_SETTING', action:() => { @@ -82,10 +81,10 @@ export class App extends BI.Widget { } }, }, - left: 10, - top: 10, - right: 10, - bottom: 10, + left: 0, + top: 0, + right: 0, + bottom: 0, }], }, ], diff --git a/src/modules/title/title.ts b/src/modules/title/title.ts index 687e2e8..28858fb 100644 --- a/src/modules/title/title.ts +++ b/src/modules/title/title.ts @@ -11,7 +11,7 @@ export class Title extends BI.Widget { static xtype = 'dec.dcm.title'; props = { - baseCls: 'bi-card', + baseCls: '', } tab: Tab; linearSegment: LinearSegment; From 2b1cea4686513774d3745ded363e6b95c8f885f5 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 25 Apr 2023 15:37:48 +0800 Subject: [PATCH 083/116] =?UTF-8?q?REPORT-94654=20fix=EF=BC=9A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=BC=82=E5=B8=B8=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/components/test_status/tip_icon/tip_fail.ts | 1 + src/modules/pages/maintain/maintain.ts | 2 +- src/modules/pages/setting/setting.ts | 3 ++- src/modules/title/title_maintain/title_maintain.ts | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/components/test_status/tip_icon/tip_fail.ts b/src/modules/components/test_status/tip_icon/tip_fail.ts index 576580e..a12f157 100644 --- a/src/modules/components/test_status/tip_icon/tip_fail.ts +++ b/src/modules/components/test_status/tip_icon/tip_fail.ts @@ -88,6 +88,7 @@ export class TipFail extends BI.Widget { type: BI.Button.xtype, text: retryText, handler: () => { + this.store.setIsCollapse(false); this.fireEvent(TipFail.EVENT_RELOAD); }, }, diff --git a/src/modules/pages/maintain/maintain.ts b/src/modules/pages/maintain/maintain.ts index 28b47b9..1f6f221 100644 --- a/src/modules/pages/maintain/maintain.ts +++ b/src/modules/pages/maintain/maintain.ts @@ -28,7 +28,7 @@ export class Maintain extends BI.Widget { return { type: BI.VTapeLayout.xtype, - hgap: 5, + hgap: 16, items: [ { type: BI.VerticalAdaptLayout.xtype, diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts index eaddc96..29d3166 100644 --- a/src/modules/pages/setting/setting.ts +++ b/src/modules/pages/setting/setting.ts @@ -44,11 +44,11 @@ export class TimeOutSetting extends BI.Widget { }, { type: 'bi.vertical', cls: 'bi-card', - hgap: 10, vgap: 10, items: [ { type: 'bi.vertical_adapt', + hgap: 16, cls: 'bi-border-bottom', height: 32, items: [{ @@ -61,6 +61,7 @@ export class TimeOutSetting extends BI.Widget { }, { type: 'bi.vertical_adapt', + hgap: 16, items: [{ type: 'dec.label.editor.item', text: BI.i18nText('Dec-Over_Time'), diff --git a/src/modules/title/title_maintain/title_maintain.ts b/src/modules/title/title_maintain/title_maintain.ts index 9eed070..b121cf1 100644 --- a/src/modules/title/title_maintain/title_maintain.ts +++ b/src/modules/title/title_maintain/title_maintain.ts @@ -15,13 +15,13 @@ export class TitleMaintain extends BI.Widget { items: [{ type: BI.VerticalAdaptLayout.xtype, height: 40, - hgap: 16, items: [ { type: BI.Button.xtype, $value: 'title-maintain-cancel', text: BI.i18nText('BI-Basic_Cancel'), clear: true, + _rgap: 16, handler: () => { this.store.setIsCopy(false); this.store.setPageIndex(PAGE_INDEX.CONNECTION); @@ -30,6 +30,7 @@ export class TitleMaintain extends BI.Widget { }, { type: BI.Button.xtype, + _rgap: 16, $value: 'title-maintain-connection-test', text: BI.i18nText('Dec-Dcm_Connection_Test'), light: true, @@ -39,6 +40,7 @@ export class TitleMaintain extends BI.Widget { }, { type: BI.Button.xtype, + _rgap: 16, $value: 'title-maintain-save', text: BI.i18nText('BI-Basic_Save'), handler: () => { @@ -47,7 +49,6 @@ export class TitleMaintain extends BI.Widget { }, }, ], - _hgap: -16, }], }; } From 06f1ea79a57dcb74d2c7adac4089f1dd790c53e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Tue, 25 Apr 2023 19:44:46 +0800 Subject: [PATCH 084/116] =?UTF-8?q?REPORT-94752=E3=80=90=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=20fix:=E4=BF=AE=E5=A4=8D=E8=A7=86=E8=A7=89=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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index fa34f1f..7b698a0 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -703,7 +703,7 @@ export const DATA_BASE_TYPES = [ type: 'jdbc', hasSchema: true, kerberos: false, - }, + }, { text: 'TDSQL', databaseType: 'tdsql', @@ -837,7 +837,7 @@ export const DEFAULT_JDBC_POOL = { }; export const CONNECTION_LAYOUT = { - hgap: 5, + hgap: 10, vgap: 15, labelHeight: 24, }; @@ -878,4 +878,4 @@ export const YES_OR_NO = [ text: BI.i18nText('Dec-Basic_No'), value: 0, } -] \ No newline at end of file +] From c3dc7734174a7d117a9e42d4533bd095fc911539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Wed, 26 Apr 2023 11:42:10 +0800 Subject: [PATCH 085/116] =?UTF-8?q?REPORT-94752=E3=80=90=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=20fix:=E4=BF=AE=E5=A4=8D=E8=A7=86=E8=A7=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/setting/setting.ts | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts index 29d3166..e46f471 100644 --- a/src/modules/pages/setting/setting.ts +++ b/src/modules/pages/setting/setting.ts @@ -47,17 +47,20 @@ export class TimeOutSetting extends BI.Widget { vgap: 10, items: [ { - type: 'bi.vertical_adapt', - hgap: 16, - cls: 'bi-border-bottom', - height: 32, - items: [{ - type: 'bi.label', - textAlign: 'left', - width: 120, - cls: 'dec-font-weight-bold', - text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), - }] + el: { + type: 'bi.vertical_adapt', + hgap: 16, + cls: 'bi-border-bottom', + height: 40, + items: [{ + type: 'bi.label', + textAlign: 'left', + width: 120, + cls: 'dec-font-weight-bold', + text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), + }], + } + ,tgap: -10, }, { type: 'bi.vertical_adapt', @@ -84,7 +87,7 @@ export class TimeOutSetting extends BI.Widget { lgap: 10, }] - }, + }, ] }], ref: function (_ref) { @@ -92,4 +95,4 @@ export class TimeOutSetting extends BI.Widget { }, }; } -} \ No newline at end of file +} From 88f9e5fb54b55d86aa230817338915d1a6bb31b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Wed, 26 Apr 2023 11:44:56 +0800 Subject: [PATCH 086/116] =?UTF-8?q?REPORT-94752=E3=80=90=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=20fix:=E4=BF=AE=E5=A4=8D=E8=A7=86=E8=A7=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/setting/setting.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts index 29d3166..d196730 100644 --- a/src/modules/pages/setting/setting.ts +++ b/src/modules/pages/setting/setting.ts @@ -47,17 +47,18 @@ export class TimeOutSetting extends BI.Widget { vgap: 10, items: [ { - type: 'bi.vertical_adapt', - hgap: 16, - cls: 'bi-border-bottom', - height: 32, - items: [{ - type: 'bi.label', - textAlign: 'left', - width: 120, - cls: 'dec-font-weight-bold', - text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), - }] + el:{ + type: 'bi.vertical_adapt', + cls: 'bi-border-bottom', + height: 40, + items: [{ + type: 'bi.label', + textAlign: 'left', + width: 120, + cls: 'dec-font-weight-bold', + text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), + }] + }, tgap: -10, hgap: 16, }, { type: 'bi.vertical_adapt', @@ -84,7 +85,7 @@ export class TimeOutSetting extends BI.Widget { lgap: 10, }] - }, + }, ] }], ref: function (_ref) { @@ -92,4 +93,4 @@ export class TimeOutSetting extends BI.Widget { }, }; } -} \ No newline at end of file +} From 4dd665d539daeb5abd5cfd8c0c3cd58d721fbcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=AD=E6=97=AD?= Date: Tue, 11 Jul 2023 15:21:09 +0800 Subject: [PATCH 087/116] =?UTF-8?q?REPORT-96835=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5JDBC=5FURL=E8=A7=A3=E6=9E=90=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20fix=EF=BC=9A=E8=A7=A3=E6=9E=90=E5=87=BA=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84database?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 41 ++++++++++++++++++++++++++-- src/modules/pages/setting/setting.ts | 4 +-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 6ce5bce..846d138 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -4,9 +4,39 @@ import { DATA_BASE_TYPES } from '@constants/constant'; BI.provider('dec.connection.provider.datebase', function () { this.resolves = {}; + function starRocksResolve(url: string) { + // 处理starRocks数据连接常规模式 + const result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i); + if (result) { + return { + host: result[1], + port: result[2] === 'port' ? '' : result[2], + databaseName: result[4] || '', + urlInfo: result[0], + }; + } + // 处理starRocks数据连接负载均衡模式 + const loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i); + if (loadBalance){ + const database: string = loadBalance[2]; + return { + host: '', + port: '', + databaseName: database, + urlInfo: loadBalance[0], + } + } + return { + host: '', + port: '', + databaseName: '', + urlInfo: '', + }; + } // 原service中resolveUrlInfo方法 function jdbcResolve(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); if (oracleUlr) { return { @@ -60,7 +90,6 @@ BI.provider('dec.connection.provider.datebase', function () { urlInfo: '', }; } - return { host: '', port: '', @@ -92,7 +121,6 @@ BI.provider('dec.connection.provider.datebase', function () { ...config, type: 'jdbc', }; - BI.isFunction(resolve) && (this.resolves[config.databaseType] = resolve); if (coverBaseDatabase(config)) return; @@ -101,7 +129,14 @@ BI.provider('dec.connection.provider.datebase', function () { }; this.$get = () => BI.inherit(BI.OB, { - getJdbcResolveByType: (type: string) => this.resolves[type] || jdbcResolve, + getJdbcResolveByType: (type: string) => { + // starRocks特殊处理 + // todo: 后面有专门的迭代系统处理,这里先临时解决下bug + if (type === "starrocks"){ + return starRocksResolve + } + return this.resolves[type] || jdbcResolve + }, customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES), }); }); diff --git a/src/modules/pages/setting/setting.ts b/src/modules/pages/setting/setting.ts index d196730..d788cb5 100644 --- a/src/modules/pages/setting/setting.ts +++ b/src/modules/pages/setting/setting.ts @@ -47,7 +47,7 @@ export class TimeOutSetting extends BI.Widget { vgap: 10, items: [ { - el:{ + el: { type: 'bi.vertical_adapt', cls: 'bi-border-bottom', height: 40, @@ -58,7 +58,7 @@ export class TimeOutSetting extends BI.Widget { cls: 'dec-font-weight-bold', text: BI.i18nText('Dec-Dcm_Connection_Timeout_Detection'), }] - }, tgap: -10, hgap: 16, + }, tgap: -10, hgap: 16, }, { type: 'bi.vertical_adapt', From 604fce515e00d7dcc16e9c4d4edc44634510f432 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 16 Aug 2023 13:54:17 +0800 Subject: [PATCH 088/116] =?UTF-8?q?BI-131621=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 881759d..f2eb329 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -71,6 +71,8 @@ export class Connection extends BI.Widget { { type: BI.Button.xtype, text: BI.i18nText('Dec-Dcm_Connection_New'), + minWidth: 0, + width: 98, handler: () => { this.store.createNewConnection(); }, From 7e2c8773b641518756d312902b61950b0f9cb10c Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 23 Aug 2023 10:09:44 +0800 Subject: [PATCH 089/116] =?UTF-8?q?BI-131621=20fix:=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E8=A1=A5=E5=85=85title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index f2eb329..048eb6d 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -71,6 +71,7 @@ export class Connection extends BI.Widget { { type: BI.Button.xtype, text: BI.i18nText('Dec-Dcm_Connection_New'), + title: BI.i18nText('Dec-Dcm_Connection_New'), minWidth: 0, width: 98, handler: () => { From 1bcfada0497f421d7b1f5943c2f55f246b36d703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=2EKing-=E7=8E=8B=E5=87=AF=E5=A3=AE?= Date: Fri, 8 Sep 2023 19:05:26 +0800 Subject: [PATCH 090/116] =?UTF-8?q?REPORT-102763=20fix:=E3=80=90=E5=BC=80?= =?UTF-8?q?=E4=B8=AA=E6=8E=A5=E5=8F=A3=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=94=AF=E6=8C=81=E5=AF=B9=E6=8E=A5=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 67 +++++++++++++-- src/modules/app.model.ts | 3 +- src/modules/app.typings.d.ts | 1 + .../pages/connection/connection.model.ts | 3 + src/modules/pages/connection/connection.ts | 10 ++- .../pages/connection/list/list.constant.ts | 1 + .../pages/connection/list/list.model.ts | 4 +- src/modules/pages/connection/list/list.ts | 2 + .../connection/list/list_item/list_item.ts | 5 +- .../pages/database/database.constant.ts | 18 +++++ src/modules/pages/database/database.ts | 28 +++---- .../database/database_type/database_type.ts | 3 + .../maintain/forms/components/form.plugin.ts | 16 ++++ .../pages/maintain/forms/form.model.ts | 1 + src/modules/pages/maintain/forms/form.ts | 81 +++++++++++++------ src/modules/title/title.model.ts | 3 +- .../title_maintain/title_maintain.model.ts | 3 +- .../title/title_maintain/title_maintain.ts | 13 +++ 18 files changed, 200 insertions(+), 62 deletions(-) create mode 100644 src/modules/pages/connection/list/list.constant.ts create mode 100644 src/modules/pages/database/database.constant.ts diff --git a/README.md b/README.md index 50cd82d..5f46124 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,8 @@ BI.config("dec.connection.provider.datebase", function (provider) { 版本和平台保持一致 ## 接口文档: -### 增加数据连接类型 +### A 增加数据连接类型 +#### 1. 增加数据连接类型 使用`BI.config`,ConstantName名称为`dec.constant.database.conf.connect.types`,值为连接的名称 例如增加`Redis`的连接: @@ -128,25 +129,25 @@ BI.config(ConstantPluginTyps, (datas: string[]) => [...datas, { }]); ``` -### 数据连接填写页面 +#### 2. 数据连接填写页面 edit属性值为填写组件shortcut的名称 -### 数据连接展示页面 +#### 3. 数据连接展示页面 show属性值为组件shortcut的名称 -### 示例 -``` +#### 4. 示例 +```js const DataBaseConfigProvider = 'dec.connection.provider.datebase'; const RedisShowName = 'dec.dcm.connection.plugin.redis.show'; const RedisEditName = 'dec.dcm.connection.plugin.redis.edit'; BI.config(DataBaseConfigProvider, function (provider) { - provider.registerDatabaseType({ + provider.registerDatabaseType([{ text: "Redis", databaseType: "Redis", edit: "dec.dcm.connection.plugin.demo.edit", show: "dec.dcm.connection.plugin.demo.show", - }); + }]); }); const RedisShow = BI.inherit(BI.Widget, { @@ -214,7 +215,22 @@ const RedisShow = BI.inherit(BI.Widget, { ], }, ], - }; + }, + mounted() { + this.fireEvent('EVENT_HIDE_TEST_CONNECTION', true);//可以触发隐藏测试按钮 + }, + //可以触发组件的数据save方法,不需要则可不写 + async save() { + let result = 0; + await Promise.resolve().then(() => {result = 1}); + //要求返回是否成功的boolean变量 + return result; + }, + //可以阻止触发平台保存数据的方法 + preventParentSave() { + return true; + } + }, }); BI.shortcut(RedisShowName, RedisShow); @@ -313,3 +329,38 @@ const RedisEdit = BI.inherit(BI.Widget, { BI.shortcut(RedisEditName, RedisEdit); ``` +### B 添加数据连接实例 +#### 1. 增加数据连接 +```js +BI.config('dec.constant.connection.list', function (value) { + const result = [{ + "connectionType": "Redis",//和databaseType一致 + "connectionName": "CHART",//类似于id,唯一性 + "pluginConnection": true,//表示是外来添加的插件 + "connectionData": { + //表单保存数据 + }, + "connectionId": null, + }]; + return value.concat(result); + }) +``` +### C 添加数据连接类型分类 +#### 1. 添加分类DEMO +```js +BI.config('dec.constant.database.filter.type', (value) => { + value.push({text:"DEMO", value:"DEMO_VALUE"});return value; + }); +``` +#### 2. 添加数据连接类型进DEMO +```js + BI.config('dec.connection.provider.datebase', function (provider) { + text: "Redis",//必填 + databaseType: "Redis",//唯一值 + marker: 'DEMO_VALUE',//marker对标dec.constant.database.filter.type常量item的value,用于过滤 + iconUrl:'https://work.fineres.com/secure/projectavatar?pid=10301&avatarId=10011', + driver: 'com.amazon.redshift.jdbc41.Driver', + drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], + url: 'jdbc:redshift://endpoint:port/database', + } +``` diff --git a/src/modules/app.model.ts b/src/modules/app.model.ts index 200800c..01b74b5 100644 --- a/src/modules/app.model.ts +++ b/src/modules/app.model.ts @@ -7,7 +7,7 @@ import { getAllDatabaseTypes } from './app.service'; export class AppModel extends Model { static xtype = 'dec.dcm.model.main'; - childContext = ['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'filter', 'connections', 'connectionSelected', 'connectionSelectedOne', 'saveEvent', 'testEvent', 'isCopy', 'connectionLicInfo']; + childContext = ['pageIndex', 'datebaseTypeSelected', 'datebaseTypeSelectedOne', 'filter', 'connections', 'connectionSelected', 'connectionSelectedOne', 'saveEvent', 'testEvent', 'isCopy', 'connectionLicInfo', 'noTestConnection']; state() { return { @@ -23,6 +23,7 @@ export class AppModel extends Model { currentConnectionNum: 0, maxConnectionNum: 0, }, + noTestConnection: false, }; } diff --git a/src/modules/app.typings.d.ts b/src/modules/app.typings.d.ts index f4d0fda..c0c9320 100644 --- a/src/modules/app.typings.d.ts +++ b/src/modules/app.typings.d.ts @@ -17,4 +17,5 @@ export interface DatabaseType { urls?: { [key: string]: string; }; + marker?: string; } diff --git a/src/modules/pages/connection/connection.model.ts b/src/modules/pages/connection/connection.model.ts index f037865..ea7db71 100644 --- a/src/modules/pages/connection/connection.model.ts +++ b/src/modules/pages/connection/connection.model.ts @@ -53,6 +53,9 @@ export class ConnectionModel extends Model<{ this.model.connectionSelected = name; }, getConnectionStatus() { + if (this.model.connectionSelectedOne.pluginConnection) { + return Promise.resolve(); + } return api.getConnectionStatus(this.model.connectionSelected); }, checkConnectionLic() { diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 048eb6d..d540199 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -137,9 +137,8 @@ export class Connection extends BI.Widget { }, handler: () => { this.store.getConnectionStatus() - .then(re => { - this.store.setPageIndex(PAGE_INDEX.MAINTAIN); - this.store.setDatebaseTypeSelected(''); + .then(() => { + this.setMaintainPage(); }) .catch(() => { }); @@ -239,4 +238,9 @@ export class Connection extends BI.Widget { return databaseType; } + + private setMaintainPage() { + this.store.setPageIndex(PAGE_INDEX.MAINTAIN); + this.store.setDatebaseTypeSelected(''); + } } diff --git a/src/modules/pages/connection/list/list.constant.ts b/src/modules/pages/connection/list/list.constant.ts new file mode 100644 index 0000000..fa5112c --- /dev/null +++ b/src/modules/pages/connection/list/list.constant.ts @@ -0,0 +1 @@ +BI.constant('dec.constant.connection.list', []); \ No newline at end of file diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index 5d650e9..60f3fa6 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -21,10 +21,10 @@ export class ConnectionListModel extends Model<{ actions = { setConnections: ():Promise => api.getConnectionList().then(data => { if (BI.size(data.data) > 0) { - this.model.connections = data.data; + this.model.connections = data.data.concat(BI.Constants.getConstant('dec.constant.connection.list')); this.model.connections.forEach(item => { // 后端传过来的是字符串,转为对象 - item.connectionData = JSON.parse(item.connectionData as string); + BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string)); }); this.model.connectionSelected = data.data[0].connectionName; } else { diff --git a/src/modules/pages/connection/list/list.ts b/src/modules/pages/connection/list/list.ts index f674dab..8ffa81c 100644 --- a/src/modules/pages/connection/list/list.ts +++ b/src/modules/pages/connection/list/list.ts @@ -3,6 +3,7 @@ import { ListItem } from './list_item/list_item'; import { ConnectionListModel } from './list.model'; import { getDatabaseType } from './list.service'; import { Tab } from '@fui/core'; +import './list.constant' @shortcut() @store(ConnectionListModel) @@ -91,6 +92,7 @@ export class ConnectionList extends BI.Pane { creator: item.creator, databaseType: getDatabaseType(item), selected: this.model.connectionSelected ? this.model.connectionSelected === item.connectionName : index === 0, + pluginConnection: item.pluginConnection, }; }); } diff --git a/src/modules/pages/connection/list/list_item/list_item.ts b/src/modules/pages/connection/list/list_item/list_item.ts index 6723947..2d1fc0f 100644 --- a/src/modules/pages/connection/list/list_item/list_item.ts +++ b/src/modules/pages/connection/list/list_item/list_item.ts @@ -20,6 +20,7 @@ export class ListItem extends BI.BasicButton { name: '', creator: '', databaseType: '', + pluginConnection: false, height: 25, baseCls: 'dec-dcm-connection-list-item bi-list-item-active2', $testId: 'dec-dcm-connection-list-item', @@ -43,7 +44,7 @@ export class ListItem extends BI.BasicButton { }; render() { - const { name, databaseType } = this.options; + const { name, databaseType, pluginConnection } = this.options; return { type: BI.HTapeLayout.xtype, @@ -118,7 +119,7 @@ export class ListItem extends BI.BasicButton { }, ], }, { - el: databaseType ? { + el: databaseType && !pluginConnection ? { type: BI.DownListCombo.xtype, cls: 'link-item-icon', stopPropagation: true, diff --git a/src/modules/pages/database/database.constant.ts b/src/modules/pages/database/database.constant.ts new file mode 100644 index 0000000..0926244 --- /dev/null +++ b/src/modules/pages/database/database.constant.ts @@ -0,0 +1,18 @@ +import { DATEBASE_FILTER_TYPE } from "@constants/constant"; + +console.log('contant'); +BI.constant('dec.constant.database.filter.type', [ + { + text: BI.i18nText('Dec-Dcm_Connection_Commonly'), + value: DATEBASE_FILTER_TYPE.COMMONLY, + selected: true, + }, + { + text: BI.i18nText('Dec-Dcm_Connection_All'), + value: DATEBASE_FILTER_TYPE.ALL, + }, + { + text: BI.i18nText('Dec-Dcm_Connection_Other'), + value: DATEBASE_FILTER_TYPE.OTHER, + }, +]); \ No newline at end of file diff --git a/src/modules/pages/database/database.ts b/src/modules/pages/database/database.ts index f905765..85a4a3b 100644 --- a/src/modules/pages/database/database.ts +++ b/src/modules/pages/database/database.ts @@ -7,6 +7,7 @@ import { DatebaseType } from './database_type/database_type'; import { getAllDatabaseTypes } from '../../app.service'; import { ButtonGroup, MultiSelectItem, SearchEditor } from '@fui/core'; import { ApiFactory } from 'src/modules/crud/apiFactory'; +import './database.constant' const api = new ApiFactory().create(); @@ -121,24 +122,12 @@ export class Datebase extends BI.Widget { ref: (_ref: ButtonGroup) => { this.filter = _ref; }, - items: [ - { + items: () => BI.map(BI.Constants.getConstant('dec.constant.database.filter.type'), (_, value) => { + return { type: Filter.xtype, - text: BI.i18nText('Dec-Dcm_Connection_Commonly'), - value: DATEBASE_FILTER_TYPE.COMMONLY, - selected: true, - }, - { - type: Filter.xtype, - text: BI.i18nText('Dec-Dcm_Connection_All'), - value: DATEBASE_FILTER_TYPE.ALL, - }, - { - type: Filter.xtype, - text: BI.i18nText('Dec-Dcm_Connection_Other'), - value: DATEBASE_FILTER_TYPE.OTHER, - }, - ], + ...value, + } + }), }, width: 200, }, @@ -254,9 +243,12 @@ export class Datebase extends BI.Widget { case DATEBASE_FILTER_TYPE.OTHER: this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => this.model.otherDatabases.includes(item.type))); break; - default: + case DATEBASE_FILTER_TYPE.ALL: this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.type !== connectionType.JNDI && item.type !== OTHER_JDBC)); break; + default: + this.store.setDatebaseTypes(this.allDatabaseTypes.filter(item => item.marker && (item.marker === filter))); + break; } } diff --git a/src/modules/pages/database/database_type/database_type.ts b/src/modules/pages/database/database_type/database_type.ts index 6778564..3170b3b 100644 --- a/src/modules/pages/database/database_type/database_type.ts +++ b/src/modules/pages/database/database_type/database_type.ts @@ -88,6 +88,9 @@ export class DatebaseType extends BI.BasicButton { if (url.startsWith('/')) { return `${PluginImgPrefix}${url}`; } + if (url.startsWith('http')) { + return url; + } return `${PluginImgPrefix}/${url}`; } diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index 6282203..b3eba0c 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/src/modules/pages/maintain/forms/components/form.plugin.ts @@ -5,6 +5,8 @@ import { getPluginWidgetEdit } from '../../../../app.service'; @shortcut() export class FormPlugin extends BI.Widget { static xtype = 'dec.dcm.maintain_plugin'; + static EVENTNOTEST = 'EVENT_HIDE_TEST_CONNECTION'; + static PREVENTPARENTSAVE = 'EVENT_PREVENT_PARENT_SAVE'; props = { formData: {} as Connection, }; @@ -24,6 +26,12 @@ export class FormPlugin extends BI.Widget { connectionId, connectionType, connectionName, + listeners: [{ + eventName: FormPlugin.EVENTNOTEST, + action: (value: boolean) => { + this.fireEvent(FormPlugin.EVENTNOTEST, value); + } + }] }; } @@ -37,4 +45,12 @@ export class FormPlugin extends BI.Widget { connectionData: BI.extend({}, connectionData, this.plugin.getValue()), }; } + + public save() { + return this.plugin.save; + } + + public preventParentSave() { + return this.plugin.preventParentSave ? this.plugin.preventParentSave() : false; + } } diff --git a/src/modules/pages/maintain/forms/form.model.ts b/src/modules/pages/maintain/forms/form.model.ts index 3bbc66e..ec76932 100644 --- a/src/modules/pages/maintain/forms/form.model.ts +++ b/src/modules/pages/maintain/forms/form.model.ts @@ -31,6 +31,7 @@ export class MaintainFormModel extends Model<{ 'testEvent', 'connections', 'isCopy', + 'noTestConnection', ]; actions = { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 4039f81..a48bfc5 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -14,6 +14,8 @@ import { checkIllegalStrings } from "@core/index"; @store(MaintainFormModel) export class MaintainForm extends BI.Widget { static xtype = 'dec.dcm.maintain.form'; + static TESTCONNECTION = 'EVENT_TEST_CONNECTION'; + static EVENTNOTEST = 'EVENT_HIDE_TEST_CONNECTION'; props = { connectionType: '', @@ -29,34 +31,25 @@ export class MaintainForm extends BI.Widget { watch = { saveEvent: () => { - if (!this.testValue()) { - return; - } - if (this.connectionName && !this.model.isCopy) { - const value = this.form.getSubmitValue(); - (value.connectionData as ConnectionJDBC).creator = BI.get(this.getFormData(), 'creator'); - // DEC-10155 为了适配插件的数据连接,在外层也加一个creator字段 - value.creator = BI.get(this.getFormData(), 'creator'); - this.store.updateConnection(this.connectionName, value).then(result => { - if (result.errorCode) { - if (result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED) { - BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), { - level: "error", - }); - } - this.showError(result); - - return; + const sonSave = this.form.save?.(); + if (sonSave) { + sonSave().then((success: Boolean) => { + if (success) { + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Success"), { + level: "success", + }); + } else { + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), { + level: "error", + }); } - this.store.goFirstPage(); }); - } else { - const form = this.form.getSubmitValue(); - form.connectionId = this.connectionName; - // DEC-10155 为了适配插件的数据连接,在外层也加一个creator字段 - form.creator = Dec ? Dec.personal.username : ''; - this.addConnection(form); + + if (this.form.preventParentSave()) { + return; + } } + this.save(); }, testEvent: () => { this.testConnection(); @@ -77,10 +70,15 @@ export class MaintainForm extends BI.Widget { this.form = _ref; }, listeners: [{ - eventName: 'EVENT_TEST_CONNECTION', + eventName: MaintainForm.TESTCONNECTION, action: () => { this.testConnection(); }, + }, { + eventName: MaintainForm.EVENTNOTEST, + action: (value: boolean) => { + this.model.noTestConnection = value; + } }], }; } @@ -295,4 +293,35 @@ export class MaintainForm extends BI.Widget { this.store.setIsCopy(false); }); } + + private save() { + if (!this.testValue()) { + return; + } + if (this.connectionName && !this.model.isCopy) { + const value = this.form.getSubmitValue(); + (value.connectionData as ConnectionJDBC).creator = BI.get(this.getFormData(), 'creator'); + // DEC-10155 为了适配插件的数据连接,在外层也加一个creator字段 + value.creator = BI.get(this.getFormData(), 'creator'); + this.store.updateConnection(this.connectionName, value).then(result => { + if (result.errorCode) { + if (result.errorCode === DecCst.ErrorCode.NO_IP_AUTHORIZED) { + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), { + level: "error", + }); + } + this.showError(result); + + return; + } + this.store.goFirstPage(); + }); + } else { + const form = this.form.getSubmitValue(); + form.connectionId = this.connectionName; + // DEC-10155 为了适配插件的数据连接,在外层也加一个creator字段 + form.creator = Dec ? Dec.personal.username : ''; + this.addConnection(form); + } + } } diff --git a/src/modules/title/title.model.ts b/src/modules/title/title.model.ts index 737c324..6cb2fe8 100644 --- a/src/modules/title/title.model.ts +++ b/src/modules/title/title.model.ts @@ -6,12 +6,13 @@ export class TitleModel extends Model<{ types: { pageIndex: AppModel['TYPE']['pageIndex']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; + noTestConnection: AppModel['TYPE']['noTestConnection']; }, context: TitleModel['context']; }> { static xtype = 'dec.dcm.model.title'; - context = ['pageIndex', 'datebaseTypeSelected'] + context = ['pageIndex', 'datebaseTypeSelected', 'noTestConnection'] actions = { setPageIndex: (index: string) => { diff --git a/src/modules/title/title_maintain/title_maintain.model.ts b/src/modules/title/title_maintain/title_maintain.model.ts index 21fd87a..c3bc416 100644 --- a/src/modules/title/title_maintain/title_maintain.model.ts +++ b/src/modules/title/title_maintain/title_maintain.model.ts @@ -11,12 +11,13 @@ export class TitleMaintainModel extends Model<{ connectionSelected: AppModel['TYPE']['connectionSelected']; testEvent: AppModel['TYPE']['testEvent']; isCopy: AppModel['TYPE']['isCopy']; + noTestConnection: AppModel['TYPE']['noTestConnection']; }, context: TitleMaintainModel['context']; }> { static xtype = 'dec.dcm.model.title_maintain'; - context = ['pageIndex', 'saveEvent', 'testEvent', 'connectionSelected', 'isCopy']; + context = ['pageIndex', 'saveEvent', 'testEvent', 'connectionSelected', 'isCopy', 'noTestConnection']; actions = { setPageIndex: (index: string) => { diff --git a/src/modules/title/title_maintain/title_maintain.ts b/src/modules/title/title_maintain/title_maintain.ts index b121cf1..7107fe9 100644 --- a/src/modules/title/title_maintain/title_maintain.ts +++ b/src/modules/title/title_maintain/title_maintain.ts @@ -1,6 +1,7 @@ import { shortcut, store } from '@core/core'; import { TitleMaintainModel } from './title_maintain.model'; import { PAGE_INDEX } from '@constants/constant'; +import { Button } from '@fui/core'; @shortcut() @store(TitleMaintainModel) @@ -9,6 +10,14 @@ export class TitleMaintain extends BI.Widget { store: TitleMaintainModel['store']; model: TitleMaintainModel['model']; + testConnectionBtn: Button; + + watch = { + noTestConnection: function (value) { + this.testConnectionBtn.setVisible(!value); + } + } + render() { return { type: BI.FloatRightLayout.xtype, @@ -30,6 +39,9 @@ export class TitleMaintain extends BI.Widget { }, { type: BI.Button.xtype, + ref: (_ref) => { + this.testConnectionBtn = _ref; + }, _rgap: 16, $value: 'title-maintain-connection-test', text: BI.i18nText('Dec-Dcm_Connection_Test'), @@ -57,5 +69,6 @@ export class TitleMaintain extends BI.Widget { window.onunload = () => { this.store.shutdownConnectionStatus(); }; + this.testConnectionBtn.setVisible(!this.model.noTestConnection); } } From 3b71fdbdea7a78c67d64ab6e48e88582b175d59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=2EKing-=E7=8E=8B=E5=87=AF=E5=A3=AE?= Date: Mon, 11 Sep 2023 14:38:40 +0800 Subject: [PATCH 091/116] =?UTF-8?q?REPORT-102763=20fix:=E3=80=90=E5=BC=80?= =?UTF-8?q?=E4=B8=AA=E6=8E=A5=E5=8F=A3=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=94=AF=E6=8C=81=E5=AF=B9=E6=8E=A5=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F-=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 +++++++++--------- .../pages/connection/connection.model.ts | 6 +++- src/modules/pages/connection/connection.ts | 3 ++ .../pages/database/database.constant.ts | 1 - .../database_type/database_type.model.ts | 7 ++++- .../database/database_type/database_type.ts | 1 + .../maintain/forms/components/form.plugin.ts | 14 +-------- .../pages/maintain/forms/form.model.ts | 1 - src/modules/pages/maintain/forms/form.ts | 31 +++++++++++-------- src/modules/title/title.model.ts | 3 +- .../title/title_maintain/title_maintain.ts | 9 +----- 11 files changed, 50 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 5f46124..ac03007 100644 --- a/README.md +++ b/README.md @@ -216,21 +216,6 @@ const RedisShow = BI.inherit(BI.Widget, { }, ], }, - mounted() { - this.fireEvent('EVENT_HIDE_TEST_CONNECTION', true);//可以触发隐藏测试按钮 - }, - //可以触发组件的数据save方法,不需要则可不写 - async save() { - let result = 0; - await Promise.resolve().then(() => {result = 1}); - //要求返回是否成功的boolean变量 - return result; - }, - //可以阻止触发平台保存数据的方法 - preventParentSave() { - return true; - } - }, }); BI.shortcut(RedisShowName, RedisShow); @@ -325,6 +310,13 @@ const RedisEdit = BI.inherit(BI.Widget, { password: this.password.getValue(), }; }, + //可以触发组件的数据save方法,不需要则可不写 + async save() { + let result = false; + await Promise.resolve().then(() => {result = true}); + //要求返回是否成功的boolean变量 + return result; + }, }); BI.shortcut(RedisEditName, RedisEdit); @@ -349,7 +341,11 @@ BI.config('dec.constant.connection.list', function (value) { #### 1. 添加分类DEMO ```js BI.config('dec.constant.database.filter.type', (value) => { - value.push({text:"DEMO", value:"DEMO_VALUE"});return value; + value.push({ + text:"DEMO", + value:"DEMO_VALUE" + }); + return value; }); ``` #### 2. 添加数据连接类型进DEMO @@ -358,6 +354,8 @@ BI.config('dec.constant.database.filter.type', (value) => { text: "Redis",//必填 databaseType: "Redis",//唯一值 marker: 'DEMO_VALUE',//marker对标dec.constant.database.filter.type常量item的value,用于过滤 + isHideConnection: true, //是否隐藏测试连接按钮 + isNoSave: true,//是否不执行平台的保存逻辑 iconUrl:'https://work.fineres.com/secure/projectavatar?pid=10301&avatarId=10011', driver: 'com.amazon.redshift.jdbc41.Driver', drivers: ['com.amazon.redshift.jdbc4.Driver', 'com.amazon.redshift.jdbc41.Driver'], diff --git a/src/modules/pages/connection/connection.model.ts b/src/modules/pages/connection/connection.model.ts index ea7db71..97daf69 100644 --- a/src/modules/pages/connection/connection.model.ts +++ b/src/modules/pages/connection/connection.model.ts @@ -13,13 +13,14 @@ export class ConnectionModel extends Model<{ connectionSelected: AppModel['TYPE']['connectionSelected']; connectionSelectedOne: AppModel['TYPE']['connectionSelectedOne']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; + noTestConnection: AppModel['TYPE']['noTestConnection']; }, childContext: ConnectionModel['childContext']; context: ConnectionModel['context']; }> { static xtype = 'dec.dcm.model.connection'; - context = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected', 'connectionLicInfo']; + context = ['pageIndex', 'connectionSelected', 'connectionSelectedOne', 'datebaseTypeSelected', 'connectionLicInfo', 'noTestConnection']; actions = { initConnectionLicInfo: (cb: Function) => { @@ -58,6 +59,9 @@ export class ConnectionModel extends Model<{ } return api.getConnectionStatus(this.model.connectionSelected); }, + setNoTestConnection(value: boolean) { + this.model.noTestConnection = value; + }, checkConnectionLic() { return this.model.connectionLicInfo.currentConnectionNum > this.model.connectionLicInfo.maxConnectionNum; }, diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index d540199..6b1094c 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -138,7 +138,10 @@ export class Connection extends BI.Widget { handler: () => { this.store.getConnectionStatus() .then(() => { + const databaseType = this.model.connectionSelectedOne.connectionType; + const database = BI.find(getAllDatabaseTypes(), (_index, value) => value.databaseType === databaseType); this.setMaintainPage(); + this.store.setNoTestConnection(database.isHideConnection); }) .catch(() => { }); diff --git a/src/modules/pages/database/database.constant.ts b/src/modules/pages/database/database.constant.ts index 0926244..12f2af8 100644 --- a/src/modules/pages/database/database.constant.ts +++ b/src/modules/pages/database/database.constant.ts @@ -1,6 +1,5 @@ import { DATEBASE_FILTER_TYPE } from "@constants/constant"; -console.log('contant'); BI.constant('dec.constant.database.filter.type', [ { text: BI.i18nText('Dec-Dcm_Connection_Commonly'), diff --git a/src/modules/pages/database/database_type/database_type.model.ts b/src/modules/pages/database/database_type/database_type.model.ts index cb51507..483b700 100644 --- a/src/modules/pages/database/database_type/database_type.model.ts +++ b/src/modules/pages/database/database_type/database_type.model.ts @@ -6,11 +6,13 @@ export class DatebaseTypeModel extends Model< types: { datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; pageIndex: AppModel['TYPE']['pageIndex']; + noTestConnection: AppModel['TYPE']['noTestConnection']; + datebaseTypeSelectedOne: AppModel['TYPE']['datebaseTypeSelectedOne']; }, context: DatebaseTypeModel['context']; }> { static xtype = 'dec.dcm.model.datebase.type'; - context = ['datebaseTypeSelected', 'pageIndex']; + context = ['datebaseTypeSelected', 'pageIndex', 'noTestConnection', 'datebaseTypeSelectedOne']; actions = { setDatebaseTypeSelected: (datebaseTypeSelected: string) => { @@ -19,5 +21,8 @@ export class DatebaseTypeModel extends Model< setPageIndex: (index: string) => { this.model.pageIndex = index; }, + setNoTestConnection: (value: boolean) => { + this.model.noTestConnection = value; + } } } diff --git a/src/modules/pages/database/database_type/database_type.ts b/src/modules/pages/database/database_type/database_type.ts index 3170b3b..2741408 100644 --- a/src/modules/pages/database/database_type/database_type.ts +++ b/src/modules/pages/database/database_type/database_type.ts @@ -70,6 +70,7 @@ export class DatebaseType extends BI.BasicButton { const { value } = this.options; this.store.setDatebaseTypeSelected(value); this.store.setPageIndex(PAGE_INDEX.MAINTAIN); + this.store.setNoTestConnection(this.model.datebaseTypeSelectedOne.isHideConnection); } mounted() { diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index b3eba0c..881089a 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/src/modules/pages/maintain/forms/components/form.plugin.ts @@ -5,8 +5,6 @@ import { getPluginWidgetEdit } from '../../../../app.service'; @shortcut() export class FormPlugin extends BI.Widget { static xtype = 'dec.dcm.maintain_plugin'; - static EVENTNOTEST = 'EVENT_HIDE_TEST_CONNECTION'; - static PREVENTPARENTSAVE = 'EVENT_PREVENT_PARENT_SAVE'; props = { formData: {} as Connection, }; @@ -26,12 +24,6 @@ export class FormPlugin extends BI.Widget { connectionId, connectionType, connectionName, - listeners: [{ - eventName: FormPlugin.EVENTNOTEST, - action: (value: boolean) => { - this.fireEvent(FormPlugin.EVENTNOTEST, value); - } - }] }; } @@ -46,11 +38,7 @@ export class FormPlugin extends BI.Widget { }; } - public save() { + public getSaveFn() { return this.plugin.save; } - - public preventParentSave() { - return this.plugin.preventParentSave ? this.plugin.preventParentSave() : false; - } } diff --git a/src/modules/pages/maintain/forms/form.model.ts b/src/modules/pages/maintain/forms/form.model.ts index ec76932..3bbc66e 100644 --- a/src/modules/pages/maintain/forms/form.model.ts +++ b/src/modules/pages/maintain/forms/form.model.ts @@ -31,7 +31,6 @@ export class MaintainFormModel extends Model<{ 'testEvent', 'connections', 'isCopy', - 'noTestConnection', ]; actions = { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index a48bfc5..2740f54 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -6,7 +6,7 @@ import { FormPlugin } from './components/form.plugin'; 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 { getJdbcDatabaseType, getChartLength, getAllDatabaseTypes } from '../../../app.service'; import { NAME_MAX_LENGTH } from '../../../app.constant'; import { checkIllegalStrings } from "@core/index"; @@ -14,8 +14,7 @@ import { checkIllegalStrings } from "@core/index"; @store(MaintainFormModel) export class MaintainForm extends BI.Widget { static xtype = 'dec.dcm.maintain.form'; - static TESTCONNECTION = 'EVENT_TEST_CONNECTION'; - static EVENTNOTEST = 'EVENT_HIDE_TEST_CONNECTION'; + static EVENT_TESTCONNECTION = 'EVENT_TEST_CONNECTION'; props = { connectionType: '', @@ -31,9 +30,9 @@ export class MaintainForm extends BI.Widget { watch = { saveEvent: () => { - const sonSave = this.form.save?.(); + const sonSave = this.form.getSaveFn?.(); if (sonSave) { - sonSave().then((success: Boolean) => { + sonSave().then((success: boolean) => { if (success) { BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Success"), { level: "success", @@ -45,8 +44,19 @@ export class MaintainForm extends BI.Widget { } }); - if (this.form.preventParentSave()) { - return; + + //只有外来插件才可以使用是否不执行平台的保存逻辑 + if (this.model.datebaseTypeSelected) { + const isPluginDatabase = BI.some(BI.Providers.getProvider('dec.connection.provider.datebase').customDatabaseType, (_index, value) => value.databaseType === this.model.datebaseTypeSelected); + if (isPluginDatabase && this.model.datebaseTypeSelectedOne.isNoSave) { + return; + } + } else { + const databaseType = this.model.connectionSelectedOne.connectionType; + const database = BI.find(getAllDatabaseTypes(), (_index, value) => value.databaseType === databaseType); + if (this.model.connectionSelectedOne.pluginConnection && database?.isNoSave) { + return; + } } } this.save(); @@ -70,15 +80,10 @@ export class MaintainForm extends BI.Widget { this.form = _ref; }, listeners: [{ - eventName: MaintainForm.TESTCONNECTION, + eventName: MaintainForm.EVENT_TESTCONNECTION, action: () => { this.testConnection(); }, - }, { - eventName: MaintainForm.EVENTNOTEST, - action: (value: boolean) => { - this.model.noTestConnection = value; - } }], }; } diff --git a/src/modules/title/title.model.ts b/src/modules/title/title.model.ts index 6cb2fe8..737c324 100644 --- a/src/modules/title/title.model.ts +++ b/src/modules/title/title.model.ts @@ -6,13 +6,12 @@ export class TitleModel extends Model<{ types: { pageIndex: AppModel['TYPE']['pageIndex']; datebaseTypeSelected: AppModel['TYPE']['datebaseTypeSelected']; - noTestConnection: AppModel['TYPE']['noTestConnection']; }, context: TitleModel['context']; }> { static xtype = 'dec.dcm.model.title'; - context = ['pageIndex', 'datebaseTypeSelected', 'noTestConnection'] + context = ['pageIndex', 'datebaseTypeSelected'] actions = { setPageIndex: (index: string) => { diff --git a/src/modules/title/title_maintain/title_maintain.ts b/src/modules/title/title_maintain/title_maintain.ts index 7107fe9..2f3c48f 100644 --- a/src/modules/title/title_maintain/title_maintain.ts +++ b/src/modules/title/title_maintain/title_maintain.ts @@ -10,13 +10,6 @@ export class TitleMaintain extends BI.Widget { store: TitleMaintainModel['store']; model: TitleMaintainModel['model']; - testConnectionBtn: Button; - - watch = { - noTestConnection: function (value) { - this.testConnectionBtn.setVisible(!value); - } - } render() { return { @@ -42,6 +35,7 @@ export class TitleMaintain extends BI.Widget { ref: (_ref) => { this.testConnectionBtn = _ref; }, + invisible: () => this.model.noTestConnection, _rgap: 16, $value: 'title-maintain-connection-test', text: BI.i18nText('Dec-Dcm_Connection_Test'), @@ -69,6 +63,5 @@ export class TitleMaintain extends BI.Widget { window.onunload = () => { this.store.shutdownConnectionStatus(); }; - this.testConnectionBtn.setVisible(!this.model.noTestConnection); } } From 7a8404cfc85691e2c791404f60eb5334e13db735 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 15 Sep 2023 11:31:23 +0800 Subject: [PATCH 092/116] =?UTF-8?q?REPORT-105428=20fix:=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=BC=96=E8=BE=91=E5=90=8E=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E4=BC=9A=E6=8A=A5=E6=8E=A5=E5=8F=A3=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=94=99=E8=AF=AF=E7=9A=84=E6=8A=A5=E9=94=99?= 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 28aa75f..0a78633 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1015,7 +1015,7 @@ export class FormJdbc extends BI.Widget { }, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), allowBlank: false, - value: sshIp || 'hostname', + value: sshIp, listeners: [ { eventName: BI.Editor.EVENT_CHANGE, From 9b09472c89a4ca463b2130e5dc08c8040664f8f8 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 22 Sep 2023 10:53:30 +0800 Subject: [PATCH 093/116] =?UTF-8?q?REPORT-105428=20fix:=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4SSH=E4=B8=BB=E6=9C=BA=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 0a78633..a3a2dee 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1014,7 +1014,6 @@ export class FormJdbc extends BI.Widget { this.form.sshIp = _ref; }, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - allowBlank: false, value: sshIp, listeners: [ { @@ -1651,7 +1650,7 @@ export class FormJdbc extends BI.Widget { public validation(): boolean { const driver = this.form.driver.validation(); - const sshSet = !this.form.usingSsh.isSelected() || (this.form.sshIp.getValue() !== '' && this.form.sshPort.getValue() !== ''); + const sshSet = !this.form.usingSsh.isSelected() || BI.isNotEmptyString(this.form.sshPort.getValue()); return driver && sshSet; } From 0a269508c368ba2f2c4921ff94789f4b599ecee2 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 22 Sep 2023 10:53:30 +0800 Subject: [PATCH 094/116] =?UTF-8?q?REPORT-105428=20fix:=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4SSH=E4=B8=BB=E6=9C=BA=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 0a78633..a3a2dee 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1014,7 +1014,6 @@ export class FormJdbc extends BI.Widget { this.form.sshIp = _ref; }, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Host'), - allowBlank: false, value: sshIp, listeners: [ { @@ -1651,7 +1650,7 @@ export class FormJdbc extends BI.Widget { public validation(): boolean { const driver = this.form.driver.validation(); - const sshSet = !this.form.usingSsh.isSelected() || (this.form.sshIp.getValue() !== '' && this.form.sshPort.getValue() !== ''); + const sshSet = !this.form.usingSsh.isSelected() || BI.isNotEmptyString(this.form.sshPort.getValue()); return driver && sshSet; } From f93eb67053357935e887bf1a78f3a1fe754cd1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 19 Oct 2023 14:00:58 +0800 Subject: [PATCH 095/116] =?UTF-8?q?REPORT-99289=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E9=80=82=E9=85=8D=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?catalog=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 7 ++-- src/modules/app.service.ts | 8 ++++- src/modules/constants/constant.ts | 2 +- .../connection_jdbc/connection_jdbc.ts | 8 ++++- .../maintain/forms/components/form.jdbc.ts | 35 +++++++++++++++++-- 5 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 846d138..78a5cbd 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -11,18 +11,19 @@ BI.provider('dec.connection.provider.datebase', function () { return { host: result[1], port: result[2] === 'port' ? '' : result[2], - databaseName: result[4] || '', + catalog: result[3], + databaseName: result[4], urlInfo: result[0], }; } // 处理starRocks数据连接负载均衡模式 const loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i); if (loadBalance){ - const database: string = loadBalance[2]; return { host: '', port: '', - databaseName: database, + catalog: loadBalance[1], + databaseName: loadBalance[2], urlInfo: loadBalance[0], } } diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index af79ad0..d33bb97 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -61,7 +61,7 @@ export function resolveUrlInfo(url: string, database?: string) { } // 拼接url -export function splitUrl(host: string, port: string, database: string, baseUrl: string) { +export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string) { if (baseUrl.startsWith('jdbc:sqlserver')) { return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('=database', `=${database}`); @@ -75,6 +75,12 @@ export function splitUrl(host: string, port: string, database: string, baseUrl: .replace(':INFORMIXSERVER={server}', ''); } + if (catalog) { + return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') + .replace('default_catalog', catalog) + .replace('database', database) + } + return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('/database', `/${database}`) .replace(':database', `:${database}`) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 7b698a0..2e12817 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -722,7 +722,7 @@ export const DATA_BASE_TYPES = [ databaseType: 'starrocks', driver: 'com.mysql.jdbc.Driver', drivers: ['com.mysql.jdbc.Driver'], - url: 'jdbc:mysql://hostname:port/database', + url: 'jdbc:mysql://hostname:port/default_catalog.database', commonly: false, internal: true, type: 'jdbc', diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 817b50d..5a7069d 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -57,7 +57,7 @@ export class ConnectionJdbc extends BI.Widget { hdfs, } = connectionData; const databaseType = getJdbcDatabaseType(database, driver); - const { host, port, databaseName, version } = resolveUrlInfo(url, database); + const { host, port, catalog, databaseName, version } = resolveUrlInfo(url, database); this.version = !BI.isUndefined(databaseType.versions) ? (version ?? databaseType.versions[0]) : version; const { hgap, vgap } = CONNECTION_LAYOUT; @@ -78,6 +78,12 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, }, + { + type: FormItem.xtype, + name: 'catalog', + invisible: database !== 'starrocks', + value: catalog, + }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Name'), diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index a3a2dee..f8f5d22 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -51,6 +51,7 @@ export class FormJdbc extends BI.Widget { connectionName: null, version: null, driver: null, + catalog: null, database: null, host: null, port: null, @@ -160,7 +161,7 @@ export class FormJdbc extends BI.Widget { } = connectionPoolAttr as ConnectionPoolJDBC; const databaseType = getJdbcDatabaseType(database, driver); this.databaseType = databaseType; - const { host, port, databaseName, version } = resolveUrlInfo(url, database); + const { host, port, catalog, databaseName, version } = resolveUrlInfo(url, database); this.version = !BI.isUndefined(databaseType.versions) ? (version ?? databaseType.versions[0]) : version; const { hgap, vgap } = CONNECTION_LAYOUT; @@ -262,6 +263,34 @@ export class FormJdbc extends BI.Widget { }, ], }, + // catalog + { + type: FormItem.xtype, + name: 'catalog', + invisible: database !== 'starrocks', + forms: [ + { + type: BI.TextEditor.xtype, + $value: 'database-catalog', + width: EDITOR_WIDTH, + allowBlank: true, + watermark: 'catalog', + value: catalog, + ref: (_ref: any) => { + this.form.catalog = _ref; + }, + listeners: [ + { + eventName: BI.Editor.EVENT_CHANGE, + action: () => { + debugger; + this.onHostPortChange(databaseType); + }, + }, + ], + }, + ], + }, // 数据库名称 { type: FormItem.xtype, @@ -843,6 +872,7 @@ export class FormJdbc extends BI.Widget { action: () => { const urlInfo = resolveUrlInfo(this.form.url.getValue(), database); this.form.host.setValue(urlInfo.host); + this.form.catalog.setValue(urlInfo.catalog); this.form.database.setValue(urlInfo.databaseName); this.form.port.setValue(urlInfo.port); }, @@ -1578,8 +1608,9 @@ export class FormJdbc extends BI.Widget { const selectUrl = BI.get(urls, driver.driver) || url; const host = this.form.host.getValue(); const port = this.form.port.getValue(); + const catalog = this.form.catalog.getValue(); const database = this.form.database.getValue(); - this.form.url.setValue(splitUrl(host, port, database, selectUrl)); + this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl)); } private onSshTypeChange(sshType) { From 2f42ff94a540c6a44c6c6cf0879632226a2d71a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 19 Oct 2023 14:05:22 +0800 Subject: [PATCH 096/116] =?UTF-8?q?REPORT-99289=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=AD=E7=9A=84debugger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/components/form.jdbc.ts | 1 - 1 file changed, 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 f8f5d22..cb41e3a 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -283,7 +283,6 @@ export class FormJdbc extends BI.Widget { { eventName: BI.Editor.EVENT_CHANGE, action: () => { - debugger; this.onHostPortChange(databaseType); }, }, From a931e29dae6af164580c22dd21697965a04c2c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 31 Oct 2023 18:10:19 +0800 Subject: [PATCH 097/116] =?UTF-8?q?REPORT-108103=20Starrocks=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=A7=A3=E6=9E=90=E4=B8=8D=E5=8C=85?= =?UTF-8?q?=E5=90=ABcatalog=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 78a5cbd..c1b83e2 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -6,7 +6,7 @@ BI.provider('dec.connection.provider.datebase', function () { function starRocksResolve(url: string) { // 处理starRocks数据连接常规模式 - const result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i); + let result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([0-9a-zA-Z_\\.-]+)\.([^]+)(.*)/i); if (result) { return { host: result[1], @@ -15,10 +15,22 @@ BI.provider('dec.connection.provider.datebase', function () { databaseName: result[4], urlInfo: result[0], }; + } else { + // 兼容老数据库里面没有catalog的情况 + result = url.match(/^jdbc:mysql:\/\/([0-9a-zA-Z_\\.-]+):([0-9a-zA-Z_\\.-]+)\/([^]+)(.*)/i); + if (result) { + return { + host: result[1], + port: result[2] === 'port' ? '' : result[2], + catalog: '', + databaseName: result[3], + urlInfo: result[0], + }; + } } // 处理starRocks数据连接负载均衡模式 - const loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i); - if (loadBalance){ + let loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)\.([^/]+)/i); + if (loadBalance) { return { host: '', port: '', @@ -26,6 +38,18 @@ BI.provider('dec.connection.provider.datebase', function () { databaseName: loadBalance[2], urlInfo: loadBalance[0], } + } else { + // 兼容老数据库里面没有catalog的情况 + loadBalance = url.match(/^jdbc:mysql:loadbalance:\/\/[^/]+\/([^/]+)([^/]+)/i); + if (loadBalance) { + return { + host: '', + port: '', + catalog: '', + databaseName: loadBalance[1], + urlInfo: loadBalance[0], + } + } } return { host: '', From 8722392f0d2bfe0d8b81b2e19a846e87d31cd59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 1 Nov 2023 15:28:05 +0800 Subject: [PATCH 098/116] =?UTF-8?q?REPORT-108103=20Starrocks=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=A7=A3=E6=9E=90=E4=B8=8D=E5=8C=85?= =?UTF-8?q?=E5=90=ABcatalog=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 13 +++++++++---- .../pages/maintain/forms/components/form.jdbc.ts | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index d33bb97..d38fdc5 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -61,7 +61,7 @@ export function resolveUrlInfo(url: string, database?: string) { } // 拼接url -export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string) { +export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string, databaseType: string) { if (baseUrl.startsWith('jdbc:sqlserver')) { return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('=database', `=${database}`); @@ -75,10 +75,15 @@ export function splitUrl(host: string, port: string, catalog: string, database: .replace(':INFORMIXSERVER={server}', ''); } - if (catalog) { + if (databaseType === 'starrocks') { + let databaseStr = ''; + if (!catalog || !database) { + databaseStr = catalog + database; + } else { + databaseStr = catalog + '.' + database; + } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') - .replace('default_catalog', catalog) - .replace('database', database) + .replace('default_catalog.database', databaseStr); } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index cb41e3a..20e53cc 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1601,15 +1601,15 @@ export class FormJdbc extends BI.Widget { ]; } - private onHostPortChange(databaseType) { - const { urls, url } = databaseType; + private onHostPortChange(database) { + const { urls, url, databaseType } = database; const driver = this.form.driver.getValue(); const selectUrl = BI.get(urls, driver.driver) || url; const host = this.form.host.getValue(); const port = this.form.port.getValue(); const catalog = this.form.catalog.getValue(); - const database = this.form.database.getValue(); - this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl)); + const databaseName = this.form.database.getValue(); + this.form.url.setValue(splitUrl(host, port, catalog, databaseName, selectUrl, databaseType)); } private onSshTypeChange(sshType) { From 19c5bc82722278d6527fb07725ee1f2767af55e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 1 Nov 2023 15:36:42 +0800 Subject: [PATCH 099/116] =?UTF-8?q?REPORT-108103=20Starrocks=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=A7=A3=E6=9E=90=E4=B8=8D=E5=8C=85?= =?UTF-8?q?=E5=90=ABcatalog=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 13 +++++++++---- .../pages/maintain/forms/components/form.jdbc.ts | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index d33bb97..d38fdc5 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -61,7 +61,7 @@ export function resolveUrlInfo(url: string, database?: string) { } // 拼接url -export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string) { +export function splitUrl(host: string, port: string, catalog: string, database: string, baseUrl: string, databaseType: string) { if (baseUrl.startsWith('jdbc:sqlserver')) { return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('=database', `=${database}`); @@ -75,10 +75,15 @@ export function splitUrl(host: string, port: string, catalog: string, database: .replace(':INFORMIXSERVER={server}', ''); } - if (catalog) { + if (databaseType === 'starrocks') { + let databaseStr = ''; + if (!catalog || !database) { + databaseStr = catalog + database; + } else { + databaseStr = catalog + '.' + database; + } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') - .replace('default_catalog', catalog) - .replace('database', database) + .replace('default_catalog.database', databaseStr); } return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index cb41e3a..20e53cc 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1601,15 +1601,15 @@ export class FormJdbc extends BI.Widget { ]; } - private onHostPortChange(databaseType) { - const { urls, url } = databaseType; + private onHostPortChange(database) { + const { urls, url, databaseType } = database; const driver = this.form.driver.getValue(); const selectUrl = BI.get(urls, driver.driver) || url; const host = this.form.host.getValue(); const port = this.form.port.getValue(); const catalog = this.form.catalog.getValue(); - const database = this.form.database.getValue(); - this.form.url.setValue(splitUrl(host, port, catalog, database, selectUrl)); + const databaseName = this.form.database.getValue(); + this.form.url.setValue(splitUrl(host, port, catalog, databaseName, selectUrl, databaseType)); } private onSshTypeChange(sshType) { From b7060fc6aee893f9d498e113e09a917340a5fc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=2EKing-=E7=8E=8B=E5=87=AF=E5=A3=AE?= Date: Tue, 7 Nov 2023 19:06:45 +0800 Subject: [PATCH 100/116] =?UTF-8?q?REPORT-102763=20fix:=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=94=AF=E6=8C=81=E5=AF=B9=E6=8E=A5=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E7=B3=BB=E7=BB=9F-=E6=8E=A5=E5=8F=A3=E8=A1=A5?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/list/list.model.ts | 3 ++- src/modules/pages/maintain/forms/form.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index 60f3fa6..f00396a 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -20,8 +20,9 @@ export class ConnectionListModel extends Model<{ actions = { setConnections: ():Promise => 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.concat(BI.Constants.getConstant('dec.constant.connection.list')); + this.model.connections = data.data; this.model.connections.forEach(item => { // 后端传过来的是字符串,转为对象 BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string)); diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 2740f54..c989f1c 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -34,6 +34,7 @@ export class MaintainForm extends BI.Widget { if (sonSave) { sonSave().then((success: boolean) => { if (success) { + this.store.goFirstPage(); BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Success"), { level: "success", }); From cf1255a5bb566bad264d9e5b20b194554ad20f77 Mon Sep 17 00:00:00 2001 From: lixing Date: Tue, 14 Nov 2023 15:51:13 +0800 Subject: [PATCH 101/116] =?UTF-8?q?REPORT-107734=E3=80=90=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=89=8D=E7=AB=AF=E9=80=82=E9=85=8D=E3=80=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=A2=9E=E5=8A=A0fetchsize=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/connection/connection_jdbc/connection_jdbc.ts | 3 +-- src/modules/pages/maintain/forms/components/form.jdbc.ts | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 5a7069d..09990ec 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -376,9 +376,8 @@ export class ConnectionJdbc extends BI.Widget { }, { type: FormItem.xtype, - invisible: fetchSize < 0 && fetchSize !== -2, name: 'Fetchsize', - value: fetchSize === -2 ? '' : fetchSize, + value: fetchSize, }, ], }, diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 20e53cc..6a9c097 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -1496,7 +1496,6 @@ export class FormJdbc extends BI.Widget { el: { type: BI.VerticalLayout.xtype, cls: 'bi-border-top', - invisible: fetchSize < 0 && fetchSize !== -2, items: [ { el: { @@ -1508,7 +1507,7 @@ export class FormJdbc extends BI.Widget { $value: 'fetch-size', width: EDITOR_WIDTH, allowBlank: true, - value: fetchSize === -2 ? '' : fetchSize, + value: fetchSize, watermark: 'Fetchsize', validationChecker: [ { @@ -1713,7 +1712,7 @@ export class FormJdbc extends BI.Widget { principal: this.form.principal.getValue()[0], keyPath: this.form.keyPath.getValue(), krb5Path: this.form.krb5Path.getValue(), - fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -2 : BI.parseInt(this.form.fetchSize.getValue()), + fetchSize: BI.isEmptyString(this.form.fetchSize.getValue()) ? -1 : BI.parseInt(this.form.fetchSize.getValue()), // ssh usingSsh: this.form.usingSsh.isSelected(), // redirectPort: 0, From 45e9cbb79283eef7054963d6b6122a18754b261f Mon Sep 17 00:00:00 2001 From: lixing Date: Mon, 27 Nov 2023 15:15:11 +0800 Subject: [PATCH 102/116] =?UTF-8?q?REPORT-107734=20fix:=E3=80=90=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=A2=9E=E5=8A=A0fetchsize=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=E3=80=91tdsql=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.typings.d.ts | 4 ++++ src/modules/pages/maintain/forms/components/form.jdbc.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/src/modules/app.typings.d.ts b/src/modules/app.typings.d.ts index c0c9320..3eda6f3 100644 --- a/src/modules/app.typings.d.ts +++ b/src/modules/app.typings.d.ts @@ -11,6 +11,10 @@ export interface DatabaseType { hasSchemas?: { [key: string]: boolean; }; + fetchSize: number; + versionConfig?: { + [key: string]: DatabaseType; + }, kerberos?: boolean; iconUrl?: string; versions?: string[]; diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 6a9c097..3cdd95b 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -222,6 +222,7 @@ export class FormJdbc extends BI.Widget { this.sslCollapse.setCollapse(true); this.sslCollapse.setVisible(this.getSslSetEnabled()); !BI.isUndefined(databaseType.hasSchemas) && this.schemaForm.setVisible(databaseType.hasSchemas[version]); + !BI.isUndefined(databaseType.versionConfig?.[version]?.fetchSize) && this.form.fetchSize.setValue(databaseType.versionConfig[version].fetchSize); this.form.driver.setDefaultDrivers(version); }, }, From d127e8e25bba1afb4b4c0ddcbabba71a566d96e0 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 30 Nov 2023 11:41:36 +0800 Subject: [PATCH 103/116] =?UTF-8?q?FDL-9101=20fix:=20=E4=BF=AE=E5=A4=8Dsap?= =?UTF-8?q?hana=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.service.ts | 16 ++++++++++++++-- src/modules/constants/constant.ts | 7 ++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index d38fdc5..b236bb2 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -1,4 +1,10 @@ -import { DATA_BASE_TYPES, DATA_BASE_TYPES_OTHER, DESIGN_DRIVER_TYPE, OTHER_JDBC } from '@constants/constant'; +import { + DATA_BASE_TYPES, + DATA_BASE_TYPES_OTHER, + DESIGN_DRIVER_TYPE, + OTHER_JDBC, + DATABASE_TYPE, +} from '@constants/constant'; import { DatabaseType } from './app.typings'; import { Connection } from './crud/crud.typings'; export function getAllDatabaseTypes(): DatabaseType[] { @@ -75,7 +81,7 @@ export function splitUrl(host: string, port: string, catalog: string, database: .replace(':INFORMIXSERVER={server}', ''); } - if (databaseType === 'starrocks') { + if (databaseType === DATABASE_TYPE.STAR_ROCKS) { let databaseStr = ''; if (!catalog || !database) { databaseStr = catalog + database; @@ -86,6 +92,12 @@ export function splitUrl(host: string, port: string, catalog: string, database: .replace('default_catalog.database', databaseStr); } + if (databaseType === DATABASE_TYPE.SAP_HANA) { + return baseUrl.replace('hostname', host) + .replace('port', port || '') + .replace('=database', `=${database}`); + } + return baseUrl.replace('hostname', host).replace(':port', port ? `:${port}` : '') .replace('/database', `/${database}`) .replace(':database', `:${database}`) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 2e12817..7733b95 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -5,6 +5,11 @@ export const PAGE_INDEX = { POOL: 'pool', }; +export const DATABASE_TYPE = { + SAP_HANA: "sap-hana", + STAR_ROCKS :'starrocks', +} + export const OTHER_JDBC = 'otherJDBC'; export const DEFAULT_HELP_LINK = 'databaseHelpLink'; @@ -609,7 +614,7 @@ export const DATA_BASE_TYPES = [ text: 'SAP HANA', databaseType: 'sap-hana', driver: 'com.sap.db.jdbc.Driver', - url: 'jdbc:sap://hostname:port?reconnect=true', + url: 'jdbc:sap://hostname:port?databaseName=database&reconnect=true', commonly: false, internal: true, type: 'jdbc', From 2d61059b6671e971445901e45ba075a880de3097 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 30 Nov 2023 11:44:40 +0800 Subject: [PATCH 104/116] =?UTF-8?q?FDL-9101=20fix:=20=E4=BF=AE=E5=A4=8Dsap?= =?UTF-8?q?hana=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=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 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 7733b95..90c41b8 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -8,7 +8,7 @@ export const PAGE_INDEX = { export const DATABASE_TYPE = { SAP_HANA: "sap-hana", STAR_ROCKS :'starrocks', -} +}; export const OTHER_JDBC = 'otherJDBC'; From 57340b4d112f2aea86d91206e2f4e27696f79dfb Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Wed, 13 Dec 2023 16:27:25 +0800 Subject: [PATCH 105/116] =?UTF-8?q?REPORT-110986=20feat:=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=94=AF=E6=8C=81=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E8=87=B3=E8=AF=A6=E6=83=85&=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/connection/list/list.model.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index f00396a..ebabce6 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/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 => api.getConnectionList().then(data => { + setConnections: (): Promise => 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 = ''; } From 792392ee47dfda7ce6d3942e0cb110188bfcf264 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Fri, 15 Dec 2023 16:04:43 +0800 Subject: [PATCH 106/116] =?UTF-8?q?REPORT-110986=20feat:=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=94=AF=E6=8C=81=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E8=87=B3=E8=AF=A6=E6=83=85&=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 61 +++++++++++-------- .../pages/connection/list/list.model.ts | 11 +++- .../list/list_item/list_item.model.ts | 3 +- .../pages/maintain/forms/form.model.ts | 5 ++ src/modules/pages/maintain/forms/form.ts | 2 + 5 files changed, 52 insertions(+), 30 deletions(-) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 6b1094c..f06dcc5 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -24,24 +24,13 @@ export class Connection extends BI.Widget { title: HTapeLayout; watch = { - connectionSelected: (name: string) => { - if (name) { - const canEdit = connectionCanEdit(this.model.connectionSelectedOne); - const type = this.getSelectConnectionType(); - this.connectionTitleWidget.setText(`${name}(${getTextByDatabaseType(type)})`); - this.connectionEditWidget.setVisible(canEdit); - const hasRegistered = this.hasRegistered(); - this.title.setVisible(hasRegistered); - if (!hasRegistered) { - this.listView.populate(BI.createItems(this.renderNoRegistered())); - } else { - this.listView.populate(BI.createItems(this.renderItems())); - } - } else { - this.listView.populate(BI.createItems(this.renderEmpty())); - this.connectionTitleWidget.setText(''); - this.connectionEditWidget.setVisible(false); - } + connectionSelected: { + immediate: true, + handler: (name: string) => { + BI.nextTick(() => { + name ? this.renderConnectionListView(name) : this.renderEmptyListView(); + }); + }, }, }; @@ -50,8 +39,6 @@ export class Connection extends BI.Widget { } render() { - this.store.setConnectionSelected(''); - return { type: BI.HTapeLayout.xtype, hgap: 10, @@ -214,12 +201,6 @@ export class Connection extends BI.Widget { }]; } - private renderEmpty() { - return [{ - type: BI.Layout.xtype, - }]; - } - private hasRegistered() { const allDatabaseTypes = getAllDatabaseTypes(); switch (this.model.connectionSelectedOne.connectionType) { @@ -246,4 +227,32 @@ export class Connection extends BI.Widget { this.store.setPageIndex(PAGE_INDEX.MAINTAIN); this.store.setDatebaseTypeSelected(''); } + + private renderConnectionListView(name: string) { + const canEdit = connectionCanEdit(this.model.connectionSelectedOne), + type = this.getSelectConnectionType(), + hasRegistered = this.hasRegistered(); + + this.connectionTitleWidget.setText(`${name}(${getTextByDatabaseType(type)})`); + this.connectionEditWidget.setVisible(canEdit); + + this.title.setVisible(hasRegistered); + + hasRegistered + ? this.listView.populate(BI.createItems(this.renderItems())) + : this.listView.populate(BI.createItems(this.renderNoRegistered())); + } + + private renderEmptyListView() { + this.listView.populate( + BI.createItems([ + { + type: BI.Layout.xtype, + } + ]) + ); + + this.connectionTitleWidget.setText(''); + this.connectionEditWidget.setVisible(false); + } } diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index ebabce6..a4bf602 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -38,14 +38,19 @@ export class ConnectionListModel extends Model<{ } }); - this.model.connectionSelected = defaultDatabaseName ?? data.data[0].connectionName; - } else { - this.model.connectionSelected = ''; + // 仅首次进入时从url中读取参数,其他情况保留选中状态 + defaultDatabaseName ||= data.data[0].connectionName; + + this.setSelectedConnection(this.model.connectionSelected || defaultDatabaseName); } return new Promise(resolve => { resolve(); }); }), + + setSelectedConnection(name: string) { + this.model.connectionSelected = name; + } } } 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 f23de66..fa43a36 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 @@ -139,8 +139,9 @@ export class ListItemModel extends Model<{ // 后端传过来的是字符串,转为对象 item.connectionData = JSON.parse(item.connectionData as string); }); + if (name === this.model.connectionSelected) { - this.model.connectionSelected = BI.size(this.model.connections) > 0 ? this.model.connections[0].connectionName : ''; + this.setConnectionSelected(this.model.connections?.[0]?.connectionName || ''); } api.shutdownConnectionStatus(name); }); diff --git a/src/modules/pages/maintain/forms/form.model.ts b/src/modules/pages/maintain/forms/form.model.ts index 3bbc66e..7947b15 100644 --- a/src/modules/pages/maintain/forms/form.model.ts +++ b/src/modules/pages/maintain/forms/form.model.ts @@ -17,6 +17,7 @@ export class MaintainFormModel extends Model<{ pageIndex: AppModel['TYPE']['pageIndex']; connections: AppModel['TYPE']['connections']; isCopy: AppModel['TYPE']['isCopy']; + connectionSelected: AppModel['TYPE']['connectionSelected']; }, context: MaintainFormModel['context']; }> { @@ -31,6 +32,7 @@ export class MaintainFormModel extends Model<{ 'testEvent', 'connections', 'isCopy', + 'connectionSelected', ]; actions = { @@ -51,5 +53,8 @@ export class MaintainFormModel extends Model<{ goFirstPage() { this.model.pageIndex = PAGE_INDEX.CONNECTION; }, + setConnectionSelected(name: string) { + this.model.connectionSelected = name; + } } } diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index c989f1c..2e6248b 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -295,6 +295,8 @@ export class MaintainForm extends BI.Widget { return; } + // 新增之后connections待更新,connectionSelected先置空 + this.store.setConnectionSelected(''); this.store.goFirstPage(); this.store.setIsCopy(false); }); From a26aafbd2369441aaa3947223dea5a495560732a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=2EKing-=E7=8E=8B=E5=87=AF=E5=A3=AE?= Date: Sun, 17 Dec 2023 18:14:58 +0800 Subject: [PATCH 107/116] =?UTF-8?q?REPORT-109671=20feat:druid=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E8=AF=AD=E5=8F=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 8 +- private/i18n.ts | 8 +- src/modules/constants/constant.ts | 3 + src/modules/crud/crud.typings.d.ts | 12 ++ .../connection_jdbc/connection_jdbc.ts | 17 +++ .../maintain/forms/components/form.jdbc.ts | 130 ++++++++++++++++-- 6 files changed, 161 insertions(+), 17 deletions(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index 7e5e8a1..1cb2866 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -85,10 +85,10 @@ Dec-Dcm_Connection_Form_Database_Max_Wait= 最大等待时间 Dec-Dcm_Connection_Form_Database_Validation_Query= SQL验证查询 Dec-Dcm_Connection_Form_Database_Test_On_Borrow= 获取连接前检验 Dec-Dcm_Connection_Form_Database_Test_On_Return= 归还连接前检验 -Dec-Dcm_Connection_Form_Database_Test_While_Idle= 开启空闲回收器检验 -Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis= 空闲连接回收器休眠时间 +Dec-Dcm_Connection_Form_Database_Test_While_Idle= 获取连接时空闲连接可用性校验 +Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis= 空闲连接回收器工作间隔 Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num= 空闲连接回收检查数 -Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis= 保持空闲最小时间值 +Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis= 空闲连接回收时间阈值 Dec-Dcm_Connection_Make_Sure_Delete= 确定删除该数据连接? Dec-Dcm_Connection_ReConnect= 重新连接 Dec-Dcm_Connection_JNDI_Form_ConnectionName= JNDI的名字 @@ -101,7 +101,7 @@ Dec-Dcm_Connection_JNDI= JNDI数据连接 Dec-Dcm_Connection_JNDI_Warning= 注意:需要把包含INTIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下 Dec-Dcm_Connection_Error= 接口访问错误 Dec-Dcm_Connection_Is_Using= 该连接正在被{R1}编辑,请稍后再试 -Dec-Dcm_Connection_Check_Integer= 请输入不小于0的整数 +Dec-Dcm_Connection_Check_Integer= 请输入不小于{}的整数 Dec-Dcm_Connection_Check_Number= 只允许为整数 Dec-Dcm_Connection_JDBC_Other=其他JDBC Dec-Dcm_Connection_JDBC_Warning= 请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录 diff --git a/private/i18n.ts b/private/i18n.ts index 1a530af..eaf7e10 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -84,10 +84,10 @@ export default { 'Dec-Dcm_Connection_Form_Database_Validation_Query': 'SQL验证查询', 'Dec-Dcm_Connection_Form_Database_Test_On_Borrow': '获取连接前检验', 'Dec-Dcm_Connection_Form_Database_Test_On_Return': '归还连接前检验', - 'Dec-Dcm_Connection_Form_Database_Test_While_Idle': '开启空闲回收器检验', - 'Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis': '空闲连接回收器休眠时间', + 'Dec-Dcm_Connection_Form_Database_Test_While_Idle': '获取连接时空闲连接可用性校验', + 'Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis': '空闲连接回收器工作间隔', 'Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num': '空闲连接回收检查数', - 'Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis': '保持空闲最小时间值', + 'Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis': '空闲连接回收时间阈值', 'Dec-Dcm_Connection_Make_Sure_Delete': '确定删除该数据连接?', 'Dec-Dcm_Connection_ReConnect': '重新连接', 'Dec-Dcm_Connection_JNDI_Form_ConnectionName': 'JNDI的名字', @@ -100,7 +100,7 @@ export default { 'Dec-Dcm_Connection_JNDI_Warning': '注意:需要把包含INTIAL_CONTEXT_FACTORY类的.jar文件复制到软件安装目录下的/lib目录下', 'Dec-Dcm_Connection_Error': '接口访问错误', 'Dec-Dcm_Connection_Is_Using': '该连接正在被{R1}编辑,请稍后再试', - 'Dec-Dcm_Connection_Check_Integer': '请输入不小于0的整数', + 'Dec-Dcm_Connection_Check_Integer': '请输入不小于{}的整数', 'Dec-Dcm_Connection_Check_Number': '只允许为整数', 'Dec-Dcm_Connection_JDBC_Other': '其他JDBC', 'Dec-Dcm_Connection_JDBC_Warning': '请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录', diff --git a/src/modules/constants/constant.ts b/src/modules/constants/constant.ts index 90c41b8..e36e16a 100644 --- a/src/modules/constants/constant.ts +++ b/src/modules/constants/constant.ts @@ -834,11 +834,14 @@ export const DEFAULT_JDBC_POOL = { minIdle: 0, maxWait: 10000, testOnBorrow: true, + keepAlive: true, testOnReturn: false, testWhileIdle: false, timeBetweenEvictionRunsMillis: 60000, numTestsPerEvictionRun: 3, minEvictableIdleTimeMillis: 1800, + maxEvictableIdleTimeMillis: 25200, + keepAliveBetweenTimeMillis: 120000, }; export const CONNECTION_LAYOUT = { diff --git a/src/modules/crud/crud.typings.d.ts b/src/modules/crud/crud.typings.d.ts index 8a5c8b9..8bc01bd 100644 --- a/src/modules/crud/crud.typings.d.ts +++ b/src/modules/crud/crud.typings.d.ts @@ -87,6 +87,10 @@ export interface ConnectionPoolJDBC { */ testOnBorrow?: boolean; + /** + * 空闲连接可用性定期检查 + */ + keepAlive?: boolean; /** * 归还前校验 */ @@ -108,6 +112,14 @@ export interface ConnectionPoolJDBC { * 连接在池中保持空闲而不被空闲连接回收器回收的最小时间,单位毫秒 */ minEvictableIdleTimeMillis?: number; + /** + * 连接在池中保持空闲而不被空闲连接回收器回收的最小时间,单位毫秒 + */ + maxEvictableIdleTimeMillis?: number; + /** + * 空闲连接可用性定期检查时间阈值 + */ + keepAliveBetweenTimeMillis?: number; } export type ConnectionJDBC = { diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index 09990ec..893e960 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -197,6 +197,11 @@ export class ConnectionJdbc extends BI.Widget { name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_On_Borrow'), value: connectionPoolAttr.testOnBorrow ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'), + value: connectionPoolAttr.keepAlive ? BI.i18nText('Dec-Dcm_Yes') : BI.i18nText('Dec-Dcm_No'), + }, { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_SQL_Validation_Query'), @@ -374,6 +379,18 @@ export class ConnectionJdbc extends BI.Widget { value: connectionPoolAttr.minEvictableIdleTimeMillis, unit: BI.i18nText('BI-Basic_Seconds'), }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'), + value: connectionPoolAttr.maxEvictableIdleTimeMillis, + unit: BI.i18nText('BI-Basic_Seconds'), + }, + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'), + value: connectionPoolAttr.keepAliveBetweenTimeMillis, + unit: BI.i18nText('Dec-Dcm_Millisecond'), + }, { type: FormItem.xtype, name: 'Fetchsize', diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 3cdd95b..430a7aa 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -86,12 +86,15 @@ export class FormJdbc extends BI.Widget { // more validationQuery: null, testOnBorrow: null, + keepAlive: null, testOnReturn: null, testWhileIdle: null, timeBetweenEvictionRunsMillis: null, numTestsPerEvictionRun: null, minIdle: null, minEvictableIdleTimeMillis: null, + maxEvictableIdleTimeMillis: null, + keepAliveBetweenTimeMillis: null, fetchSize: null, // 并行装载 parallelLoad: { @@ -152,12 +155,15 @@ export class FormJdbc extends BI.Widget { maxWait, validationQuery, testOnBorrow, + keepAlive, testOnReturn, testWhileIdle, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minIdle, minEvictableIdleTimeMillis, + maxEvictableIdleTimeMillis, + keepAliveBetweenTimeMillis, } = connectionPoolAttr as ConnectionPoolJDBC; const databaseType = getJdbcDatabaseType(database, driver); this.databaseType = databaseType; @@ -357,7 +363,7 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Port'), validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -895,7 +901,7 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Active'), validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -926,6 +932,25 @@ export class FormJdbc extends BI.Widget { }, ], }, + // 空闲连接可用性定期检查 + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'), + forms: [ + { + type: BI.TextValueCombo.xtype, + $value: 'keep-alive-check', + width: EDITOR_WIDTH, + allowBlank: true, + value: keepAlive, + items: this.getBooleanItem(), + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow'), + ref: (_ref: TextValueCombo) => { + this.form.keepAlive = _ref; + }, + }, + ], + }, // 校验语句 { type: FormItem.xtype, @@ -960,7 +985,7 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Wait'), validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -1069,7 +1094,7 @@ export class FormJdbc extends BI.Widget { allowBlank: false, validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -1332,7 +1357,7 @@ export class FormJdbc extends BI.Widget { value: initialSize, validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -1358,7 +1383,7 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Idle'), validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -1423,6 +1448,11 @@ export class FormJdbc extends BI.Widget { checker: (value: string) => this.checkNumber(value), autoFix: true, }, + { + errorText: BI.i18nText('Dec-Util-Must_Less_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold')), + checker: (value: string) => this.checkNumber(value) && (parseInt(value) < parseInt(this.form.keepAliveBetweenTimeMillis.getValue())), + autoFix: true, + }, valueRangeConfig, ], ref: (_ref: TextChecker) => { @@ -1450,7 +1480,7 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Tests_PerEviction_Run_Num'), validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), checker: (value: string) => this.checkInteger(value), autoFix: true, }, @@ -1475,8 +1505,13 @@ export class FormJdbc extends BI.Widget { watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), validationChecker: [ { - errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer'), - checker: (value: string) => this.checkInteger(value), + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 30), + checker: (value: string) => this.checkNumber(value) && (parseInt(value) >= 30), + autoFix: true, + }, + { + errorText: BI.i18nText('Dec-Util-Must_Less_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis')), + checker: (value: string) => parseInt(value) < parseInt(this.form.maxEvictableIdleTimeMillis.getValue()), autoFix: true, }, valueRangeConfig, @@ -1493,6 +1528,80 @@ export class FormJdbc extends BI.Widget { }, ], }, + + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'), + forms: [ + { + type: TextChecker.xtype, + $value: 'max-evictable-idle-time-millis', + width: EDITOR_WIDTH, + allowBlank: false, + value: maxEvictableIdleTimeMillis, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 0), + checker: (value: string) => this.checkInteger(value), + autoFix: true, + }, + { + errorText: BI.i18nText('Dec-Util-Must_More_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Max_Evictable_Idle_Time_Millis'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Min_Evictable_Idle_Time_Millis')), + checker: (value: string) => parseInt(value) > parseInt(this.form.minEvictableIdleTimeMillis.getValue()), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.maxEvictableIdleTimeMillis = _ref; + }, + }, + { + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('BI-Basic_Seconds'), + }, + ], + }, + + { + type: FormItem.xtype, + name: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'), + forms: [ + { + type: TextChecker.xtype, + $value: 'keep-live-between-time-millis', + width: EDITOR_WIDTH, + allowBlank: false, + value: keepAliveBetweenTimeMillis, + watermark: BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'), + validationChecker: [ + { + errorText: BI.i18nText('Dec-Dcm_Connection_Check_Integer', 30000), + checker: (value: string) => this.checkNumber(value) && (parseInt(value) > 30000), + autoFix: true, + }, + { + errorText: BI.i18nText('Dec-Util-Must_More_Than', BI.i18nText('Dec-Dcm_Connection_Form_Database_Regular_Check_On_Borrow_Threshold'), BI.i18nText('Dec-Dcm_Connection_Form_Database_Test_Between_Eviction_Millis')), + checker: (value: string) => this.checkNumber(value) && (parseInt(value) > parseInt(this.form.timeBetweenEvictionRunsMillis.getValue())), + autoFix: true, + }, + valueRangeConfig, + ], + ref: (_ref: TextChecker) => { + this.form.keepAliveBetweenTimeMillis = _ref; + }, + }, + { + type: BI.Label.xtype, + lgap: 5, + height: CONNECTION_LAYOUT.labelHeight, + text: BI.i18nText('Dec-Dcm_Millisecond'), + }, + ], + }, { el: { type: BI.VerticalLayout.xtype, @@ -1741,11 +1850,14 @@ export class FormJdbc extends BI.Widget { maxWait: this.form.maxWait.getValue(), validationQuery: api.getCipher(this.form.validationQuery.getValue()), testOnBorrow: BI.size(this.form.testOnBorrow.getValue()) > 0 ? this.form.testOnBorrow.getValue()[0] : connectionPoolAttr.testOnBorrow, + keepAlive: BI.size(this.form.keepAlive.getValue()) > 0 ? this.form.keepAlive.getValue()[0] : connectionPoolAttr.keepAlive, testOnReturn: BI.size(this.form.testOnReturn.getValue()) > 0 ? this.form.testOnReturn.getValue()[0] : connectionPoolAttr.testOnReturn, testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle, timeBetweenEvictionRunsMillis: this.form.timeBetweenEvictionRunsMillis.getValue(), numTestsPerEvictionRun: this.form.numTestsPerEvictionRun.getValue(), minEvictableIdleTimeMillis: this.form.minEvictableIdleTimeMillis.getValue(), + maxEvictableIdleTimeMillis: this.form.maxEvictableIdleTimeMillis.getValue(), + keepAliveBetweenTimeMillis: this.form.keepAliveBetweenTimeMillis.getValue(), }, // 并行装载 parallelLoad: { From 58dee6f64933e57fc0e5d8ba78436083118414ba Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Mon, 18 Dec 2023 14:07:23 +0800 Subject: [PATCH 108/116] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8C=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- babel.config.js | 14 ++++++++++++-- package.json | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/babel.config.js b/babel.config.js index 9085ac7..092e4d1 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,13 @@ -module.exports = function (api) { - return require("@fui/babel-preset-fineui").configs.base(api) +module.exports = api => { + const { plugins, presets, sourceType } = require("@fui/babel-preset-fineui").configs.base(api); + + return { + compact: false, + presets, + sourceType, + plugins: [ + ...plugins, + "@babel/plugin-proposal-logical-assignment-operators", + ], + }; }; diff --git a/package.json b/package.json index 6d411c8..e59b383 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "author": "decision", "license": "MIT", "dependencies": { + "@babel/plugin-proposal-logical-assignment-operators": "^7.20.7", "@types/jss": "9.5.8", "autoprefixer": "^9.6.1", "es6-promise": "4.2.6", From fc3f98bbf04002a1da9655721339f1d14253bdc4 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 19 Dec 2023 11:57:18 +0800 Subject: [PATCH 109/116] =?UTF-8?q?REPORT-111534=20fix=EF=BC=9A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=84=8F=E6=95=B0=E6=8D=AE=E5=AE=B9?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/list/list.model.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index a4bf602..3d30378 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -29,6 +29,9 @@ export class ConnectionListModel extends Model<{ .getHashSearchParams("databaseId"); this.model.connections.forEach(item => { + // REPORT-111534 有些环境存在脏数据,补下容错 + if (BI.isNull(item.connectionData)) return; + // 后端传过来的是字符串,转为对象 BI.isString(item.connectionData) && (item.connectionData = JSON.parse(item.connectionData as string)); From 64d03f07821e67249b5abd7ece2e56a471a23b15 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 4 Jan 2024 18:10:50 +0800 Subject: [PATCH 110/116] =?UTF-8?q?REPORT-112768=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E4=B8=8D=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 10 +++++++--- src/modules/pages/connection/list/list.model.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index f06dcc5..1215974 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -24,11 +24,15 @@ export class Connection extends BI.Widget { title: HTapeLayout; watch = { - connectionSelected: { + connectionSelectedOne: { immediate: true, - handler: (name: string) => { + handler: (v: Connection) => { BI.nextTick(() => { - name ? this.renderConnectionListView(name) : this.renderEmptyListView(); + const connectionName = v.connectionName; + + connectionName + ? this.renderConnectionListView(connectionName) + : this.renderEmptyListView(); }); }, }, diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index 3d30378..b1bc9d2 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -44,7 +44,7 @@ export class ConnectionListModel extends Model<{ // 仅首次进入时从url中读取参数,其他情况保留选中状态 defaultDatabaseName ||= data.data[0].connectionName; - this.setSelectedConnection(this.model.connectionSelected || defaultDatabaseName); + this.setSelectedConnection(defaultDatabaseName); } return new Promise(resolve => { From e846f055ccf7ab5022151ff7140484a67c000891 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Thu, 4 Jan 2024 18:10:50 +0800 Subject: [PATCH 111/116] =?UTF-8?q?REPORT-112768=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E4=B8=8D=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 10 +++++++--- src/modules/pages/connection/list/list.model.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index f06dcc5..1215974 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -24,11 +24,15 @@ export class Connection extends BI.Widget { title: HTapeLayout; watch = { - connectionSelected: { + connectionSelectedOne: { immediate: true, - handler: (name: string) => { + handler: (v: Connection) => { BI.nextTick(() => { - name ? this.renderConnectionListView(name) : this.renderEmptyListView(); + const connectionName = v.connectionName; + + connectionName + ? this.renderConnectionListView(connectionName) + : this.renderEmptyListView(); }); }, }, diff --git a/src/modules/pages/connection/list/list.model.ts b/src/modules/pages/connection/list/list.model.ts index 3d30378..b1bc9d2 100644 --- a/src/modules/pages/connection/list/list.model.ts +++ b/src/modules/pages/connection/list/list.model.ts @@ -44,7 +44,7 @@ export class ConnectionListModel extends Model<{ // 仅首次进入时从url中读取参数,其他情况保留选中状态 defaultDatabaseName ||= data.data[0].connectionName; - this.setSelectedConnection(this.model.connectionSelected || defaultDatabaseName); + this.setSelectedConnection(defaultDatabaseName); } return new Promise(resolve => { From ce17bd506c314fd426148dbdc464cec1e3f92171 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 9 Jan 2024 14:39:31 +0800 Subject: [PATCH 112/116] =?UTF-8?q?FDL-9101=20fix:=20=E4=BF=AE=E5=A4=8Dhan?= =?UTF-8?q?a=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5url=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index c1b83e2..4ed6284 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -92,13 +92,13 @@ BI.provider('dec.connection.provider.datebase', function () { } // 处理SAP HANA数据连接url - const sapHanaUrl = url.match(/^jdbc:(sap):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?([^]+)?(.*)/i); + const sapHanaUrl = url.match(/^jdbc:(sap):(thin:([0-9a-zA-Z/]*)?@|thin:([0-9a-zA-Z/]*)?@\/\/|\/\/|)([0-9a-zA-Z_\\.-]+)(:([0-9|port]+))?(\?databaseName=)?([^&]+)([^]+)?(.*)/i); if (sapHanaUrl) { return { host: sapHanaUrl[5], port: sapHanaUrl[7] === 'port' ? '' : sapHanaUrl[7], - databaseName: '', - urlInfo: sapHanaUrl[9], + databaseName: sapHanaUrl[9] || '', + urlInfo: sapHanaUrl[10], }; } From 74dd5ba289dbf6056dc02764b679b4ebe4fbd17f Mon Sep 17 00:00:00 2001 From: hans Date: Thu, 25 Jan 2024 15:54:32 +0800 Subject: [PATCH 113/116] =?UTF-8?q?REPORT-112276=20=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8F=96=E6=95=B0=E7=AE=80=E9=81=93=E4=BA=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=83=A8=E5=88=86=E9=80=82?= =?UTF-8?q?=E9=85=8D=20=E8=AE=BE=E8=AE=A1=E4=BC=98=E5=85=88=E7=BA=A7,?= =?UTF-8?q?=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8=E5=B9=B3=E5=8F=B0=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.provider.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 4ed6284..18b2a4a 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -135,6 +135,16 @@ BI.provider('dec.connection.provider.datebase', function () { return false; } + function filterPluginDataTypeByPriority() { + const originTypes = [...BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES)]; + const sortDataTypes = BI.sortBy(originTypes, (index, value: any) => { + return value.priority || 0; + }) + return BI.uniqWith(sortDataTypes, (current, other) => { + return current.text == other.text; + }); + } + this.registerDatabaseType = (config: any) => { if (coverBaseDatabase(config)) return; @@ -162,6 +172,6 @@ BI.provider('dec.connection.provider.datebase', function () { } return this.resolves[type] || jdbcResolve }, - customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES), + customDatabaseType: filterPluginDataTypeByPriority(), }); }); From 3b9a4799efb21ccbd645770e7834c28ca5f2c775 Mon Sep 17 00:00:00 2001 From: hans Date: Tue, 5 Mar 2024 13:56:43 +0800 Subject: [PATCH 114/116] getJdyDataLinkAppList --- src/modules/app.provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/app.provider.ts b/src/modules/app.provider.ts index 18b2a4a..3662b4a 100644 --- a/src/modules/app.provider.ts +++ b/src/modules/app.provider.ts @@ -172,6 +172,6 @@ BI.provider('dec.connection.provider.datebase', function () { } return this.resolves[type] || jdbcResolve }, - customDatabaseType: filterPluginDataTypeByPriority(), + customDatabaseType: BI.Constants.getConstant(CONSTANT_PLUGIN_TYPES), }); }); From 45aeb419b22a8c9caac422c4c0ae3493462816f3 Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Tue, 5 Mar 2024 16:29:23 +0800 Subject: [PATCH 115/116] =?UTF-8?q?BI-144496=20fix:=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=A2=9E=E5=8A=A0=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/app.ts | 1 + src/modules/pages/__point__/connect.point.ts | 24 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/modules/pages/__point__/connect.point.ts diff --git a/src/modules/app.ts b/src/modules/app.ts index d909040..46cd7b7 100644 --- a/src/modules/app.ts +++ b/src/modules/app.ts @@ -10,6 +10,7 @@ import { ConnectionPool } from './pages/connection_pool/connection_pool'; import { TimeOutSetting } from './pages/setting/setting'; import './app.provider'; import '../less/index.less'; +import "./pages/__point__/connect.point"; @shortcut() @store(AppModel) diff --git a/src/modules/pages/__point__/connect.point.ts b/src/modules/pages/__point__/connect.point.ts new file mode 100644 index 0000000..576f153 --- /dev/null +++ b/src/modules/pages/__point__/connect.point.ts @@ -0,0 +1,24 @@ +BI.point("dec.dcm.model.connection", "createNewConnection", () => { + Dec.Utils.saveFocusPoint({ + id: "E73325", + title: "新建数据连接", + }); +}); + +BI.point("dec.dcm.model.title_maintain", "setTestEvent", () => { + Dec.Utils.saveFocusPoint({ + id: "E73328", + title: "测试数据连接", + }); +}); + +BI.point("dec.dcm.model.maintain_form", "addConnection", function () { + Dec.Utils.saveFocusPoint({ + id: "E8827", + title: "保存数据连接", + body: { + datebaseType: this.model.datebaseTypeSelected, + databaseName: this.model.connectionSelected, + }, + }); +}); \ No newline at end of file From 008573646a8f11fe18ec4b5e4f26706c496fe58f Mon Sep 17 00:00:00 2001 From: "Austin.Duan" Date: Mon, 22 Apr 2024 10:04:47 +0800 Subject: [PATCH 116/116] =?UTF-8?q?REPORT-114169=20fix:=20=E3=80=90?= =?UTF-8?q?=E5=A4=9A=E7=A7=9F=E6=88=B7=E3=80=91=E6=96=B0=E5=BB=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=BE=93=E5=85=A5=E6=A1=86=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=97=AE=E9=A2=98?= 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 +- src/modules/pages/maintain/maintain.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index d9fe88c..34ffe27 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -295,7 +295,7 @@ export class FormJdbc extends BI.Widget { forms: [{ type: BI.Editor.xtype, $value: 'password', - cls: 'bi-border bi-border-radius', + cls: 'bi-border-bottom', width: 300, height: 20, allowBlank: true, diff --git a/src/modules/pages/maintain/maintain.ts b/src/modules/pages/maintain/maintain.ts index 137ccfe..32ed22a 100644 --- a/src/modules/pages/maintain/maintain.ts +++ b/src/modules/pages/maintain/maintain.ts @@ -25,7 +25,7 @@ export class Maintain extends BI.Widget { render() { const { isEdit, databaseType } = this.getEditConnection(); const titleText = getTextByDatabaseType(databaseType); - + return { type: BI.VTapeLayout.xtype, hgap: 5, @@ -82,12 +82,13 @@ export class Maintain extends BI.Widget { this.socketTip.setVisible(true); } - api.setEditedConnectionStatus(this.model.connectionSelectedOne.connectionName); + this.model.connectionSelectedOne + && api.setEditedConnectionStatus(this.model.connectionSelectedOne.connectionName); } private renderItems() { const { type } = this.getEditConnection(); - + return [{ type: MaintainForm.xtype, connectionType: type, @@ -108,7 +109,7 @@ export class Maintain extends BI.Widget { 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,