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 1/6] =?UTF-8?q?REPORT-88994=20feat:=E9=80=82=E9=85=8DKingb?= =?UTF-8?q?ase8.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 2/6] =?UTF-8?q?REPORT-88759=20feat:=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=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 3/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=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 4/6] =?UTF-8?q?REPORT-90807=20fix:=20=E9=80=82=E9=85=8D?= =?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/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 5/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=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 6/6] =?UTF-8?q?REPORT-90864=20fix:=E6=8B=BC=E6=8E=A5url?= =?UTF-8?q?=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); }