From 3568b32989c193cb060edb1a8775046c3e796ac3 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 2 Aug 2021 18:17:00 +0800 Subject: [PATCH 01/13] =?UTF-8?q?DEC-19879=20feat:=20=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/crud/api.ts | 5 + src/modules/crud/decision.api.ts | 8 + .../driverselector/driverselector.model.ts | 119 ++++++++++ .../driverselector/driverselector.ts | 217 ++++++++++++++++++ .../maintain/forms/components/form.jdbc.ts | 56 +++-- src/modules/pages/maintain/forms/form.ts | 11 +- 6 files changed, 390 insertions(+), 26 deletions(-) create mode 100644 src/modules/pages/maintain/components/driverselector/driverselector.model.ts create mode 100644 src/modules/pages/maintain/components/driverselector/driverselector.ts diff --git a/src/modules/crud/api.ts b/src/modules/crud/api.ts index 1d917b8..12d4f0c 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 diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index a15cd14..7301526 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -52,6 +52,14 @@ export class DecisionApi implements Api { return requestGet(`pool/info?connectionName=${encodeURIComponent(name)}`, {}); } + getSimpleDriverList(): Promise<{ data: any[] }> { + return new Promise(resolve => { + Dec.reqGet('/v10/drivers/simple/list', '', re => { + resolve(re); + }); + }); + } + getConnectionStatus(name: string): Promise { return this.sendEditStatusEvent(name, editStatusEvent.OPEN) .then(re => { diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts new file mode 100644 index 0000000..77077ab --- /dev/null +++ b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts @@ -0,0 +1,119 @@ +import { model, Model } from '@core/core'; +import { ConnectionJDBC } from '../../../../crud/crud.typings'; +import { getJdbcDatabaseType } from '../../../../app.service'; +import { ApiFactory } from '../../../../crud/apiFactory'; + +const api = new ApiFactory().create(); + +@model() +export class DriverSelectorModel extends Model { + static xtype = 'dec.dcm.model.maintain.form.jdbc.driver_selector'; + + state = () => { + const defaultDrivers = this.getDrivers(); + const [driverSource, selectedDriver] = this.resolveSelectedDriverType(); + + return { + defaultDrivers, + driverSource, + selectedDriverType: driverSource === '' ? 'default' : 'custom', + customDrivers: [], + defaultDriver: { + driver: driverSource === '' ? selectedDriver : '', + }, + customDriver: { + driver: driverSource !== '' ? selectedDriver : '', + text: driverSource !== '' ? `${this.options.driver} (${driverSource})` : '', + }, + }; + }; + + computed = { + driverClassItems: () => this.model.customDrivers.map(driver => { + return { + text: `${driver.driverClass} (${driver.name})`, + value: driver.driverClass, + }; + }), + + driverTypeComboValue: () => this.model.driverSource === '' ? 'default' : 'custom', + + driverManageEntryVisible: () => this.model.selectedDriverType === 'custom' && BI.Services.getService('dec.service.global').isAdmin(), + }; + + actions = { + initDriverClassList: cb => { + + api.getSimpleDriverList().then(res => { + this.model.customDrivers = res.data; + cb(); + }); + }, + + changeDefaultDriver: driver => { + this.model.defaultDriver.driver = driver; + this.model.driverSource = ''; + }, + + changeCustomDriver: driver => { + this.model.customDriver.driver = driver; + + + this.model.customDrivers.some(customDriver => { + if (customDriver.driverClass === driver) { + this.model.driverSource = customDriver.name; + this.model.customDriver.text = `${driver} (${customDriver.name})`; + + return true; + } + + return false; + }); + }, + + changeSelectedDriverType: driverTypeComboValue => { + this.model.selectedDriverType = driverTypeComboValue; + this.model.driverSource = driverTypeComboValue === 'default' ? '' : this.model.driverSource; + }, + + changeDriverSource: driverTypeComboValue => { + this.model.driverSource = driverTypeComboValue === 'default' ? '' : this.model.driverSource; + }, + }; + + private resolveSelectedDriverType = () => { + if (BI.isNotEmptyString(this.options.driverSource)) { + return [this.options.driverSource, this.options.driver]; + } + + return [this.options.driverSource, this.options.driver]; + }; + + private getDrivers = () => { + const connectionData = this.options.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; + }; +} diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts new file mode 100644 index 0000000..564dc9a --- /dev/null +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -0,0 +1,217 @@ +import { shortcut, store } from '@core/core'; + +import { + Button, + EditorIconCheckCombo, + SearchTextValueCombo, + TextValueCombo, +} from '@fui/core'; +import { ConnectionJDBC } from '../../../../crud/crud.typings'; +import { getJdbcDatabaseType } from '../../../../app.service'; +import { DriverSelectorModel } from './driverselector.model'; + + +@shortcut() +@store(DriverSelectorModel, { + props(this: DriverSelector) { + return this.options; + }, +}) +export class DriverSelector extends BI.Widget { + static xtype = 'dec.dcm.maintain.form.jdbc.driver_selector'; + + props = { + driver: '', + driverSource: '', + connectionData: {} as ConnectionJDBC, + }; + + defaultDrivers: EditorIconCheckCombo = null; + + customDrivers: SearchTextValueCombo = null; + + beforeRender(cb: Function) { + this.store.initDriverClassList(cb); + } + + watch = { + driverClassItems: items => { + this.customDrivers.populate(items); + this.customDrivers.setValue(this.model.customDriver.driver); + }, + + driverManageEntryVisible: b => { + this.driverManageEntry.setVisible(b); + }, + }; + + private driverManageEntry = null; + + render() { + const { driver } = this.options.connectionData; + + return { + type: BI.VerticalAdaptLayout.xtype, + rgap: 10, + items: [ + { + el: { + type: BI.TextValueCombo.xtype, + width: 86, + value: this.model.selectedDriverType, + items: [ + { + text: BI.i18nText('Dec-Basic_Default'), + value: 'default', + }, { + text: BI.i18nText('Dec-Basic_Custom'), + value: 'custom', + }, + ], + listeners: [ + { + eventName: BI.TextValueCombo.EVENT_CHANGE, + action: value => { + this.store.changeSelectedDriverType(value); + if (value === 'default') { + this.defaultDrivers.setVisible(true); + this.customDrivers.setVisible(false); + + return; + } + + this.defaultDrivers.setVisible(false); + this.customDrivers.setVisible(true); + }, + }, + ], + }, + }, { + el: { + type: BI.EditorIconCheckCombo.xtype, + $testId: 'dec-editor-icon-check-combo', + $value: 'driver', + ref: _ref => { + this.defaultDrivers = _ref; + }, + invisible: this.model.driverSource !== '', + width: 204, + items: this.model.defaultDrivers, + value: this.model.defaultDriver.driver, + listeners: [ + { + eventName: BI.EditorIconCheckCombo.EVENT_CHANGE, + action: () => this.store.changeDefaultDriver(this.defaultDrivers.getValue()), + }, + ], + }, + }, { + el: { + type: BI.SearchTextValueCombo.xtype, + $testId: 'dec-editor-icon-check-combo', + $value: 'driver', + ref: _ref => { + this.customDrivers = _ref; + }, + invisible: this.model.driverSource === '', + width: 204, + watermark: BI.i18nText('Dec-Please_Input'), + items: this.model.driverClassItems, + value: this.model.customDriver.driver, + text: () => this.model.customDriver.text || BI.i18nText('Dec-Please_Select'), + warningTitle: BI.i18nText('Dec-Dcm-Driver_Driver_File_Lost'), + listeners: [ + { + eventName: BI.SearchTextValueCombo.EVENT_CHANGE, + action: () => this.store.changeCustomDriver(this.customDrivers.getValue()[0]), + }, + ], + }, + }, { + el: { + type: BI.Button.xtype, + ref: (_ref: Button) => { + this.driverManageEntry = _ref; + }, + level: 'ignore', + text: BI.i18nText('Dec-Dcm_Create_New_Driver'), + invisible: !this.model.driverManageEntryVisible, + handler: () => { + this.createDriverManagerLayer(); + }, + }, + }, + ], + }; + } + + private createDriverManagerLayer() { + const name = BI.UUID(); + + BI.Layers.create(name, '.dec-dcm', { + render: { + type: 'bi.vtape', + cls: 'bi-background', + items: [ + { + type: 'bi.vertical_adapt', + cls: 'bi-card', + items: [ + { + el: { + type: 'bi.icon_text_item', + text: BI.i18nText('Dec-Connection_Driver_Management_Exit'), + cls: 'back-font bi-high-light', + height: 24, + logic: { + dynamic: true, + }, + handler: () => { + this.store.initDriverClassList(() => BI.Layers.remove(name)); + }, + }, + hgap: 10, + }, + ], + height: 40, + }, { + el: { + type: 'dec.connection.driver', + listeners: [ + { + eventName: 'EVENT_CLOSE', + action() { + BI.Layers.remove(name); + }, + }, + ], + }, + hgap: 10, + vgap: 10, + }, + ], + }, + }); + + BI.Layers.show(name); + } + + validation(): boolean { + if (this.model.selectedDriverType === 'default' && BI.isKey(this.model.defaultDriver.driver)) { + return true; + } + if (this.model.selectedDriverType === 'custom' && BI.isKey(this.model.customDriver.driver)) { + return true; + } + BI.Msg.toast(BI.i18nText('Dec-Dcm_Driver_Class_Not_Allow_Empty'), { level: 'error' }); + + return false; + } + + getValue() { + return { + driverSource: this.model.driverSource, + driver: this.model.driverSource === '' ? this.model.defaultDriver.driver : this.model.customDriver.driver, + }; + } +} diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index a0c49d4..fa18f6a 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -16,6 +16,7 @@ import { TextValueCombo, VerticalLayout, } from '@fui/core'; +import { DriverSelector } from '../../components/driverselector/driverselector'; const api = new ApiFactory().create(); @@ -130,31 +131,32 @@ export class FormJdbc extends BI.Widget { { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - forms: [{ - type: BI.EditorIconCheckCombo.xtype, - $testId: 'dec-editor-icon-check-combo', - $value: 'driver', - width: 300, - value: driver, - ref: (_ref: EditorIconCheckCombo) => { - this.form.driver = _ref; - }, - items: this.getDrivers(), - listeners: [{ - eventName: BI.EditorIconCheckCombo.EVENT_CHANGE, - action: () => { - const value = this.form.driver.getValue(); - const connectionData = this.options.formData.connectionData as ConnectionJDBC; - const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - const url = connectionType.urls ? connectionType.urls[value] : 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); + forms: [ + { + type: DriverSelector.xtype, + ref: (_ref: DriverSelector) => { + this.form.driver = _ref; }, - }], - }], + driver, + 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); + const url = connectionType.urls ? connectionType.urls[value] : 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, @@ -823,6 +825,10 @@ export class FormJdbc extends BI.Widget { } } + public validation(): boolean { + return this.form.driver.validation(); + } + public getSubmitValue(): Connection { const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionPoolAttr = connectionData.connectionPoolAttr; @@ -836,7 +842,7 @@ export class FormJdbc extends BI.Widget { connectionData: BI.extend({}, connectionData, { database: connectionData.database, connectionName: this.form.connectionName.getValue(), - driver: this.form.driver.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()), diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index ceb59cc..84201e6 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -197,6 +197,10 @@ export class MaintainForm extends BI.Widget { return false; } + if (!this.form.validation || !this.form.validation()) { + return false; + } + return true; } @@ -223,13 +227,18 @@ export class MaintainForm extends BI.Widget { if (!formValue.connectionName) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null')); - return; + return false; } if (getChartLength(formValue.connectionName) > NAME_MAX_LENGTH) { this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang', NAME_MAX_LENGTH)); return false; } + + if (!this.form.validation || !this.form.validation()) { + return false; + } + if (this.isEdit || this.model.isCopy) { formValue.connectionId = this.connectionName; } From a0f2479cc0b88c4b47219aea7ef4829484811d6c Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 9 Aug 2021 16:59:23 +0800 Subject: [PATCH 02/13] =?UTF-8?q?DEC-20078=20fix:=20=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=94=AF=E6=8C=81fetchSize=E3=80=91JNDI?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=96=B0=E5=BB=BA=E3=80=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E7=9A=84=E3=80=8C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=BF=9E=E6=8E=A5=E3=80=8D=E3=80=81=E3=80=8C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E3=80=8D=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E6=97=A0?= =?UTF-8?q?=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/maintain/components/driverselector/driverselector.ts | 3 ++- src/modules/pages/maintain/forms/components/form.jdbc.ts | 2 ++ src/modules/pages/maintain/forms/form.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 564dc9a..d59f956 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -118,7 +118,8 @@ export class DriverSelector extends BI.Widget { watermark: BI.i18nText('Dec-Please_Input'), items: this.model.driverClassItems, value: this.model.customDriver.driver, - text: () => this.model.customDriver.text || BI.i18nText('Dec-Please_Select'), + text: () => this.model.customDriver.text || '', + defaultText: BI.i18nText('Dec-Please_Select'), warningTitle: BI.i18nText('Dec-Dcm-Driver_Driver_File_Lost'), listeners: [ { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index fa18f6a..baf83ff 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -71,6 +71,7 @@ export class FormJdbc extends BI.Widget { const { connectionName, connectionData } = this.options.formData; const { driver, + driverSource, user, password, originalCharsetName, @@ -138,6 +139,7 @@ export class FormJdbc extends BI.Widget { this.form.driver = _ref; }, driver, + driverSource, connectionData, listeners: [ { diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 84201e6..4900051 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -235,7 +235,7 @@ export class MaintainForm extends BI.Widget { return false; } - if (!this.form.validation || !this.form.validation()) { + if (this.form.validation && !this.form.validation()) { return false; } From f15c965f5abb822e183cf0439daa82d1095c0c8b Mon Sep 17 00:00:00 2001 From: dailer Date: Tue, 10 Aug 2021 14:46:49 +0800 Subject: [PATCH 03/13] =?UTF-8?q?DEC-20036=20fix:=20=E3=80=90=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E5=85=B6=E4=BB=96JDBC=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=88=87=E6=8D=A2=E9=A9=B1=E5=8A=A8=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=90=8EURL=E6=B2=A1=E6=9C=89=E8=81=94=E5=8A=A8=E5=8F=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/driverselector/driverselector.ts | 10 ++++++++-- .../pages/maintain/forms/components/form.jdbc.ts | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index d59f956..c155878 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -101,7 +101,10 @@ export class DriverSelector extends BI.Widget { listeners: [ { eventName: BI.EditorIconCheckCombo.EVENT_CHANGE, - action: () => this.store.changeDefaultDriver(this.defaultDrivers.getValue()), + action: () => { + this.store.changeDefaultDriver(this.defaultDrivers.getValue()); + this.fireEvent('EVENT_CHANGE'); + }, }, ], }, @@ -124,7 +127,10 @@ export class DriverSelector extends BI.Widget { listeners: [ { eventName: BI.SearchTextValueCombo.EVENT_CHANGE, - action: () => this.store.changeCustomDriver(this.customDrivers.getValue()[0]), + action: () => { + this.store.changeCustomDriver(this.customDrivers.getValue()[0]); + this.fireEvent('EVENT_CHANGE'); + }, }, ], }, diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index baf83ff..c73ff73 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -148,7 +148,7 @@ export class FormJdbc extends BI.Widget { const value = this.form.driver.getValue(); const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - const url = connectionType.urls ? connectionType.urls[value] : connectionType.url; + 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); @@ -806,7 +806,7 @@ export class FormJdbc extends BI.Widget { private onHostPortChange(databaseType) { const { urls, url } = databaseType; const driver = this.form.driver.getValue(); - const selectUrl = BI.get(urls, driver) || url; + 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(); From 19dc654a7db0633b49f109be459214da0843b6f7 Mon Sep 17 00:00:00 2001 From: dailer Date: Wed, 11 Aug 2021 17:48:43 +0800 Subject: [PATCH 04/13] =?UTF-8?q?DEC-20026=20fix:=20=E3=80=90=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E3=80=91=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?-=E6=96=B0=E5=A2=9EJNDI=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98=E5=92=8C?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/maintain/forms/form.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 4900051..cb3b573 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -197,7 +197,7 @@ export class MaintainForm extends BI.Widget { return false; } - if (!this.form.validation || !this.form.validation()) { + if (this.form.validation && !this.form.validation()) { return false; } From 0843c9acae4e4d04a3ecbf5aa81686e03e9a069c Mon Sep 17 00:00:00 2001 From: dailer Date: Thu, 12 Aug 2021 20:11:23 +0800 Subject: [PATCH 05/13] =?UTF-8?q?DEC-20047=20fix:=20=E3=80=90=E8=BF=AD?= =?UTF-8?q?=E4=BB=A3=E3=80=91=E3=80=90=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=94=AF=E6=8C=81fetchSize=E3=80=91=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E8=AE=BE=E7=BD=AEfetchSize=E4=B8=BA=E7=A9=BA=E5=9B=9E?= =?UTF-8?q?=E5=A1=AB=E6=95=B0=E5=80=BC=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/connection/connection_jdbc/connection_jdbc.ts | 4 ++-- src/modules/pages/maintain/forms/components/form.jdbc.ts | 6 +++--- 2 files changed, 5 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 4dc6d0e..f28f9ec 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -182,9 +182,9 @@ export class ConnectionJdbc extends BI.Widget { unit: BI.i18nText('BI-Basic_Seconds'), }, { type: FormItem.xtype, - invisible: BI.parseInt(fetchSize) < 0, + invisible: fetchSize < 0 && fetchSize !== -2, name: 'Fetchsize', - value: 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 c73ff73..9f4262b 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -712,7 +712,7 @@ export class FormJdbc extends BI.Widget { el: { type: BI.VerticalLayout.xtype, cls: 'bi-border-top', - invisible: BI.parseInt(fetchSize) < 0, + invisible: fetchSize < 0 && fetchSize !== -2, items: [ { el: { @@ -723,7 +723,7 @@ export class FormJdbc extends BI.Widget { $value: 'fetch-size', width: 300, allowBlank: true, - value: fetchSize, + value: fetchSize === -2 ? '' : fetchSize, watermark: 'Fetchsize', validationChecker: [{ errorText: BI.i18nText('Dec-Dcm_Connection_Check_Fetch_Size_Range'), @@ -857,7 +857,7 @@ export class FormJdbc extends BI.Widget { creator: Dec ? Dec.personal.username : '', principal: this.form.principal.getValue(), keyPath: this.form.keyPath.getValue(), - fetchSize: BI.parseInt(this.form.fetchSize.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(), From cfe65b0254978fc4cc63f865caeaabed0ba002f9 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 13 Aug 2021 15:21:44 +0800 Subject: [PATCH 06/13] =?UTF-8?q?DEC-20201=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?=E3=80=91=E5=88=87=E6=8D=A2=E4=B8=BA=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=EF=BC=8C=E5=B7=B2=E7=BB=8F=E5=A1=AB=E5=A5=BD?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E4=BF=A1=E6=81=AF=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E4=BF=9D=E5=AD=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 +- 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 9f4262b..5d26ad1 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -148,7 +148,7 @@ export class FormJdbc extends BI.Widget { const value = this.form.driver.getValue(); const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); - const url = connectionType.urls ? connectionType.urls[value.driver] : connectionType.url; + 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); From fa2a113f0943a4a725fff8d9503c1ff3216e3a60 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 13 Aug 2021 15:35:58 +0800 Subject: [PATCH 07/13] =?UTF-8?q?DEC-20200=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?=E3=80=91=E6=96=B0=E5=BB=BA=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=EF=BC=8C=E9=80=89=E6=8B=A9=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=EF=BC=8C=E4=BF=9D=E5=AD=98=E5=90=8E=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=A9=B1=E5=8A=A8?= 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 | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts index f28f9ec..eff5383 100644 --- a/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts +++ b/src/modules/pages/connection/connection_jdbc/connection_jdbc.ts @@ -23,6 +23,7 @@ export class ConnectionJdbc extends BI.Widget { const connectionData = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; const { driver, + driverSource, database, user, originalCharsetName, @@ -45,7 +46,7 @@ export class ConnectionJdbc extends BI.Widget { { type: FormItem.xtype, name: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), - value: driver, + value: BI.isKey(driverSource) ? `${driver} (${driverSource})` : driver, }, { type: FormItem.xtype, diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 5d26ad1..d9fe88c 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -148,6 +148,7 @@ export class FormJdbc extends BI.Widget { const value = this.form.driver.getValue(); const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionType = getJdbcDatabaseType(connectionData.database, connectionData.driver); + // DEC-2020 const url = (connectionType.urls && connectionType.urls[value.driver]) || connectionType.url; this.form.url.setValue(url); const urlInfo = resolveUrlInfo(url, connectionData.database); From 4cea5f431e11a93019a06bee17e332b4f8c01eb6 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 13 Aug 2021 17:21:26 +0800 Subject: [PATCH 08/13] =?UTF-8?q?DEC-20204=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?=E3=80=91=E6=AC=A1=E7=AE=A1=E6=9D=83=E9=99=90=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=8C=E5=8F=AF=E4=BB=A5=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= 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 4682418..8094b8d 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -79,6 +79,7 @@ export class Connection extends BI.Widget { right: [ { type: 'dec.connection.driver.entry', + invisible: !BI.Services.getService('dec.service.global').isAdmin(), from: '.dec-dcm', }, ], From d8b3b81e3997b3c9c54a534a985a3d3b5bbfd933 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 16 Aug 2021 15:08:25 +0800 Subject: [PATCH 09/13] =?UTF-8?q?DEC-19760=20feat:=20=E3=80=90BI=E9=85=8D?= =?UTF-8?q?=E5=90=88=E3=80=91=E9=A9=B1=E5=8A=A8=E7=AE=A1=E7=90=86,war?= =?UTF-8?q?=E5=8C=85=E9=83=A8=E7=BD=B2=E4=B8=8D=E6=94=AF=E6=8C=81=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driverselector/driverselector.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index c155878..4382810 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -136,16 +136,25 @@ export class DriverSelector extends BI.Widget { }, }, { el: { - type: BI.Button.xtype, + type: 'dec.connection.driver.entry', ref: (_ref: Button) => { this.driverManageEntry = _ref; }, - level: 'ignore', - text: BI.i18nText('Dec-Dcm_Create_New_Driver'), - invisible: !this.model.driverManageEntryVisible, - handler: () => { - this.createDriverManagerLayer(); + el: { + type: BI.Button.xtype, + level: 'ignore', + text: BI.i18nText('Dec-Dcm_Create_New_Driver'), }, + from: '.dec-dcm', + invisible: !this.model.driverManageEntryVisible, + listeners: [ + { + eventName: 'EVENT_CLOSE', + action: () => { + this.store.initDriverClassList(BI.emptyFn); + }, + }, + ], }, }, ], From 11d8cea36be3af882c468ffea7728c26b9ce63cd Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 16 Aug 2021 17:02:11 +0800 Subject: [PATCH 10/13] =?UTF-8?q?DEC-20201=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?=E3=80=91=E5=88=87=E6=8D=A2=E4=B8=BA=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=EF=BC=8C=E5=B7=B2=E7=BB=8F=E5=A1=AB=E5=A5=BD?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E4=BF=A1=E6=81=AF=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driverselector/driverselector.ts | 56 ++----------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 4382810..0bb502c 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -76,12 +76,15 @@ export class DriverSelector extends BI.Widget { if (value === 'default') { this.defaultDrivers.setVisible(true); this.customDrivers.setVisible(false); - + this.fireEvent('EVENT_CHANGE'); return; } this.defaultDrivers.setVisible(false); this.customDrivers.setVisible(true); + if (BI.isKey(this.customDrivers.getValue()[0])) { + this.fireEvent('EVENT_CHANGE'); + } }, }, ], @@ -161,57 +164,6 @@ export class DriverSelector extends BI.Widget { }; } - private createDriverManagerLayer() { - const name = BI.UUID(); - - BI.Layers.create(name, '.dec-dcm', { - render: { - type: 'bi.vtape', - cls: 'bi-background', - items: [ - { - type: 'bi.vertical_adapt', - cls: 'bi-card', - items: [ - { - el: { - type: 'bi.icon_text_item', - text: BI.i18nText('Dec-Connection_Driver_Management_Exit'), - cls: 'back-font bi-high-light', - height: 24, - logic: { - dynamic: true, - }, - handler: () => { - this.store.initDriverClassList(() => BI.Layers.remove(name)); - }, - }, - hgap: 10, - }, - ], - height: 40, - }, { - el: { - type: 'dec.connection.driver', - listeners: [ - { - eventName: 'EVENT_CLOSE', - action() { - BI.Layers.remove(name); - }, - }, - ], - }, - hgap: 10, - vgap: 10, - }, - ], - }, - }); - - BI.Layers.show(name); - } - validation(): boolean { if (this.model.selectedDriverType === 'default' && BI.isKey(this.model.defaultDriver.driver)) { return true; From 8226d5ac15b4b96b8fd663674a1811226a421689 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 16 Aug 2021 19:56:09 +0800 Subject: [PATCH 11/13] =?UTF-8?q?DEC-20235=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?=E3=80=91=E6=96=B0=E5=BB=BA=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E6=B7=BB=E5=8A=A0=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E5=86=8D=E9=80=80=E5=87=BA=EF=BC=8C=E6=89=80=E6=9C=89=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E9=80=89=E6=8B=A9=E9=A9=B1=E5=8A=A8=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A9=B1=E5=8A=A8=E6=A0=87=E8=93=9D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/driverselector/driverselector.model.ts | 4 +++- 1 file changed, 3 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 77077ab..9b2fc3e 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts @@ -45,7 +45,9 @@ export class DriverSelectorModel extends Model { initDriverClassList: cb => { api.getSimpleDriverList().then(res => { - this.model.customDrivers = res.data; + this.model.customDrivers = res.data.filter(driver => { + return BI.isKey(driver.driverClass); + }); cb(); }); }, From c61dac179428975334bfa93bf05c988acfcb1ee1 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 16 Aug 2021 20:21:14 +0800 Subject: [PATCH 12/13] =?UTF-8?q?DEC-20237=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?=E3=80=91=E4=BD=BF=E7=94=A8=E6=9F=90=E4=B8=AA=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=A9=B1=E5=8A=A8=E6=96=B0=E5=BB=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=EF=BC=8C=E4=B8=8B=E6=8B=89=E6=A1=86=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E5=90=8E=E5=86=8D=E6=AC=A1=E4=B8=8B=E6=8B=89=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9B=B8=E5=90=8C=E9=A9=B1=E5=8A=A8=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E7=9A=84=E6=89=80=E6=9C=89=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=A9=B1=E5=8A=A8=E9=83=BD=E4=BC=9A=E6=A0=87=E8=93=9D?= =?UTF-8?q?=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driverselector/driverselector.model.ts | 15 ++++++++++----- .../components/driverselector/driverselector.ts | 6 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts index 9b2fc3e..384e4f4 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts @@ -23,7 +23,7 @@ export class DriverSelectorModel extends Model { }, customDriver: { driver: driverSource !== '' ? selectedDriver : '', - text: driverSource !== '' ? `${this.options.driver} (${driverSource})` : '', + value: driverSource !== '' ? `${this.options.driver} (${driverSource})` : '', }, }; }; @@ -32,7 +32,8 @@ export class DriverSelectorModel extends Model { driverClassItems: () => this.model.customDrivers.map(driver => { return { text: `${driver.driverClass} (${driver.name})`, - value: driver.driverClass, + value: `${driver.driverClass} (${driver.name})`, + driverClass: driver.driverClass, }; }), @@ -57,14 +58,18 @@ export class DriverSelectorModel extends Model { this.model.driverSource = ''; }, - changeCustomDriver: driver => { - this.model.customDriver.driver = driver; + changeCustomDriver: value => { + const item = this.model.driverClassItems.find(item => { + return item.value === value; + }); + const driver = item.driverClass; + this.model.customDriver.driver = driver; this.model.customDrivers.some(customDriver => { if (customDriver.driverClass === driver) { this.model.driverSource = customDriver.name; - this.model.customDriver.text = `${driver} (${customDriver.name})`; + this.model.customDriver.value = `${driver} (${customDriver.name})`; return true; } diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 0bb502c..896c157 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -37,7 +37,7 @@ export class DriverSelector extends BI.Widget { watch = { driverClassItems: items => { this.customDrivers.populate(items); - this.customDrivers.setValue(this.model.customDriver.driver); + this.customDrivers.setValue(this.model.customDriver.value); }, driverManageEntryVisible: b => { @@ -123,8 +123,8 @@ export class DriverSelector extends BI.Widget { width: 204, watermark: BI.i18nText('Dec-Please_Input'), items: this.model.driverClassItems, - value: this.model.customDriver.driver, - text: () => this.model.customDriver.text || '', + value: this.model.customDriver.value, + text: () => this.model.customDriver.value || '', defaultText: BI.i18nText('Dec-Please_Select'), warningTitle: BI.i18nText('Dec-Dcm-Driver_Driver_File_Lost'), listeners: [ From 02622eef5bb9b1461a2299f8de8a09f34b49cecd Mon Sep 17 00:00:00 2001 From: dailer Date: Wed, 18 Aug 2021 11:02:55 +0800 Subject: [PATCH 13/13] =?UTF-8?q?DEC-19760=20feat:=20=E3=80=90BI=E9=85=8D?= =?UTF-8?q?=E5=90=88=E3=80=91=E9=A9=B1=E5=8A=A8=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/pages/connection/connection.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/pages/connection/connection.ts b/src/modules/pages/connection/connection.ts index 8094b8d..90f5ba1 100644 --- a/src/modules/pages/connection/connection.ts +++ b/src/modules/pages/connection/connection.ts @@ -81,6 +81,14 @@ export class Connection extends BI.Widget { type: 'dec.connection.driver.entry', invisible: !BI.Services.getService('dec.service.global').isAdmin(), from: '.dec-dcm', + listeners: [ + { + eventName: 'EVENT_CLOSE', + action: () => { + this.reset(); + }, + }, + ], }, ], },