From ba6dfb1792262e4da2399baf50f8268f0524b7ca Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Thu, 1 Apr 2021 20:13:35 +0800 Subject: [PATCH 1/8] =?UTF-8?q?DEC-17991=20chore:=20=E7=94=98=E8=80=81?= =?UTF-8?q?=E5=B8=88=E6=8F=92=E4=BB=B6=E6=8E=A5=E5=8F=A3=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8F=8D=E9=A6=88--=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=88=9B=E5=BB=BA=E6=97=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?connectionname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintain/forms/components/form.plugin.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index ae9646e..d36ba2c 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/src/modules/pages/maintain/forms/components/form.plugin.ts @@ -11,24 +11,28 @@ export class FormPlugin extends BI.Widget { plugin: any; render() { - const { connectionType } = this.options.formData; - + const { connectionType, connectionId, connectionName, connectionData } = this.options.formData; + return { type: getPluginWidgetEdit(connectionType), ref: (_ref: any) => { this.plugin = _ref; }, - value: this.options.formData.connectionData, + value: connectionData, // 兼容 + connectionData, + connectionId, + connectionType, + connectionName, }; } public getSubmitValue(): Connection { - const { connectionType, connectionId, connectionName } = this.options.formData; - + const { connectionType, connectionId } = this.options.formData; + return { connectionId, connectionType, - connectionName, + connectionName: this.plugin.getName ? this.plugin.getName() : '', connectionData: this.plugin.getValue(), }; } From bb96a1920aab623a3d424087fdf26e25e07d1766 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Thu, 1 Apr 2021 20:13:44 +0800 Subject: [PATCH 2/8] update demo --- README.md | 343 +++++++++++++++++++++++++++--------------------------- 1 file changed, 169 insertions(+), 174 deletions(-) diff --git a/README.md b/README.md index 5474677..1756d0c 100644 --- a/README.md +++ b/README.md @@ -36,185 +36,180 @@ ConstantName名称为`dec.constant.database.conf.connect.form.${name}.show`, ### 示例 ``` -const ConstantRedisType = 'dec.constant.database.conf.connect.types'; -const ConstantRedisShow = 'dec.constant.database.conf.connect.form.Redis.show'; -const ConstantRedisEdit = 'dec.constant.database.conf.connect.form.Redis.edit'; - -BI.DOM.ready(() => { - BI.config(ConstantRedisType, datas => [...datas, { - text: 'Redis', - databaseType: 'Redis', - }]); - - const RedisShowName = 'dec.dcm.connection.plugin.redis.show'; - const RedisShow = BI.inherit(BI.Widget, { - props: { - formData: { - url: '', - port: '6379', - password: '', - }, - }, - render() { - const o = this.options; - - return { - type: 'bi.vertical', - hgap: 15, - vgap: 10, - items: [ - { - type: 'bi.left', - items: [ - { - type: 'bi.label', - cls: 'bi-font-bold', - width: 100, - textAlign: 'left', - text: '数据库地址', - }, - { - type: 'bi.label', - text: o.formData.url, - }, - ], - }, - { - type: 'bi.left', - items: [ - { - type: 'bi.label', - cls: 'bi-font-bold', - width: 100, - textAlign: 'left', - text: '端口号', - }, - { - type: 'bi.label', - text: o.formData.port, - }, - ], - }, - { - type: 'bi.left', - items: [ - { - type: 'bi.label', - cls: 'bi-font-bold', - width: 100, - textAlign: 'left', - text: '密码', - }, - { - type: 'bi.label', - text: o.formData.password, - }, - ], - }, - ], - }; - }, +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({ + text: "Redis", + databaseType: "Redis", + edit: "dec.dcm.connection.plugin.demo.edit", + show: "dec.dcm.connection.plugin.demo.show", }); +}); - BI.shortcut(RedisShowName, RedisShow); - BI.constant(ConstantRedisShow, RedisShowName); - - - const RedisEditName = 'dec.dcm.connection.plugin.redis.edit'; - const RedisEdit = BI.inherit(BI.Widget, { - props: { - formData: { - url: '', - port: '6379', - password: '', - }, +const RedisShow = BI.inherit(BI.Widget, { + props: { + formData: { + url: '', + port: '6379', + password: '', }, - render() { - const o = this.options; - - return { - type: 'bi.vertical', - hgap: 15, - vgap: 10, - items: [ - { - type: 'bi.left', - items: [ - { - type: 'bi.label', - cls: 'bi-font-bold', - width: 100, - textAlign: 'left', - text: '数据库地址', - }, - { - type: 'bi.text_editor', - width: 300, - allowBlank: true, - ref: _ref => { - this.url = _ref; - }, - text: o.formData.url, - }, - ], - }, - { - type: 'bi.left', - items: [ - { - type: 'bi.label', - cls: 'bi-font-bold', - width: 100, - textAlign: 'left', - text: '端口号', - }, - { - type: 'bi.text_editor', - width: 300, - allowBlank: true, - ref: _ref => { - this.port = _ref; - }, - text: o.formData.port, + }, + render() { + const o = this.options; + + return { + type: 'bi.vertical', + hgap: 15, + vgap: 10, + items: [ + { + type: 'bi.left', + items: [ + { + type: 'bi.label', + cls: 'bi-font-bold', + width: 100, + textAlign: 'left', + text: '数据库地址', + }, + { + type: 'bi.label', + text: o.formData.url, + }, + ], + }, + { + type: 'bi.left', + items: [ + { + type: 'bi.label', + cls: 'bi-font-bold', + width: 100, + textAlign: 'left', + text: '端口号', + }, + { + type: 'bi.label', + text: o.formData.port, + }, + ], + }, + { + type: 'bi.left', + items: [ + { + type: 'bi.label', + cls: 'bi-font-bold', + width: 100, + textAlign: 'left', + text: '密码', + }, + { + type: 'bi.label', + text: o.formData.password, + }, + ], + }, + ], + }; + }, +}); +BI.shortcut(RedisShowName, RedisShow); + +const RedisEdit = BI.inherit(BI.Widget, { + props: { + formData: { + url: '', + port: '6379', + password: '', + }, + }, + render() { + const o = this.options; + + return { + type: 'bi.vertical', + hgap: 15, + vgap: 10, + items: [ + { + type: 'bi.left', + items: [ + { + type: 'bi.label', + cls: 'bi-font-bold', + width: 100, + textAlign: 'left', + text: '数据库地址', + }, + { + type: 'bi.text_editor', + width: 300, + allowBlank: true, + ref: _ref => { + this.url = _ref; }, - ], - }, - { - type: 'bi.left', - items: [ - { - type: 'bi.label', - cls: 'bi-font-bold', - width: 100, - textAlign: 'left', - text: '密码', + text: o.formData.url, + }, + ], + }, + { + type: 'bi.left', + items: [ + { + type: 'bi.label', + cls: 'bi-font-bold', + width: 100, + textAlign: 'left', + text: '端口号', + }, + { + type: 'bi.text_editor', + width: 300, + allowBlank: true, + ref: _ref => { + this.port = _ref; }, - { - type: 'bi.text_editor', - width: 300, - allowBlank: true, - inputType: 'password', - ref: _ref => { - this.password = _ref; - }, - text: o.formData.password, + text: o.formData.port, + }, + ], + }, + { + type: 'bi.left', + items: [ + { + type: 'bi.label', + cls: 'bi-font-bold', + width: 100, + textAlign: 'left', + text: '密码', + }, + { + type: 'bi.text_editor', + width: 300, + allowBlank: true, + inputType: 'password', + ref: _ref => { + this.password = _ref; }, - ], - }, - ], - }; - }, - getSubmitValue() { - return { - url: this.url.getValue(), - port: this.port.getValue(), - password: this.password.getValue(), - }; - }, - }); - - BI.shortcut(RedisEditName, RedisEdit); - BI.constant(ConstantRedisEdit, RedisEditName); + text: o.formData.password, + }, + ], + }, + ], + }; + }, + getSubmitValue() { + return { + url: this.url.getValue(), + port: this.port.getValue(), + password: this.password.getValue(), + }; + }, }); +BI.shortcut(RedisEditName, RedisEdit); -``` \ No newline at end of file +``` From 3c8bc2bebdb8d0801f6c926f840596ddaf8d5b17 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Wed, 7 Apr 2021 19:19:25 +0800 Subject: [PATCH 3/8] =?UTF-8?q?DEC-17971=20feat:=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86sql=E4=BC=A0=E8=BE=93?= =?UTF-8?q?=E5=8A=A0=E5=AF=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 | 9 ++++-- src/modules/crud/decision.api.ts | 24 ++++++++------ src/modules/crud/design.api.ts | 31 ++++++++++++------- .../maintain/forms/components/form.jdbc.ts | 16 +++++----- 4 files changed, 48 insertions(+), 32 deletions(-) diff --git a/src/modules/crud/api.ts b/src/modules/crud/api.ts index 8757a7f..0122e48 100644 --- a/src/modules/crud/api.ts +++ b/src/modules/crud/api.ts @@ -9,7 +9,7 @@ export interface Api { /** * 获取已添加的数据连接 */ - getConnectionlist(): Promise<{data?: Connection[]}>; + getConnectionlist(): Promise<{ data?: Connection[] }>; /** * 删除数据连接 @@ -38,7 +38,7 @@ export interface Api { * 获取连接池数据 * @param name */ - getConnectionPool(name: string): Promise<{data?: ConnectionPoolType}>; + getConnectionPool(name: string): Promise<{ data?: ConnectionPoolType }>; /** * 获取连接状态 @@ -67,6 +67,11 @@ export interface Api { */ getCipher(password: string): string; + /** + * 获取解密后文本 + */ + getPlain(cipher: string): string; + /** * 获取外链 */ diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index a39c2f7..6c2f2a5 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -6,7 +6,7 @@ import { editStatusEvent, errorCode } from '@constants/env'; export class DecisionApi implements Api { isDec = true; - getConnectionlist(): Promise<{data?: Connection[]}> { + getConnectionlist(): Promise<{ data?: Connection[] }> { return requestGet('list', {}); } @@ -20,31 +20,31 @@ export class DecisionApi implements Api { const form = { ...data, connectionId: data.connectionId || data.connectionName, - connectionData : JSON.stringify(data.connectionData), + connectionData: JSON.stringify(data.connectionData), }; - + return requestPost('', form); } updateConnection(data: Connection) { const form = { ...data, - connectionData : JSON.stringify(data.connectionData), + connectionData: JSON.stringify(data.connectionData), }; - + return requestPut('', form); } testConnection(data: Connection): Promise { const form = { ...data, - connectionData : JSON.stringify(data.connectionData), + connectionData: JSON.stringify(data.connectionData), }; - + return requestPost('test', form); } - getConnectionPool(name: string): Promise<{data?: ConnectionPoolType}> { + getConnectionPool(name: string): Promise<{ data?: ConnectionPoolType }> { return requestGet(`pool/info?connectionName=${encodeURIComponent(name)}`, {}); } @@ -81,7 +81,7 @@ export class DecisionApi implements Api { if (Dec) { return Dec.socket.connected; } - + return false; } @@ -89,7 +89,7 @@ export class DecisionApi implements Api { if (Dec) { return DecCst.ErrorCode.LACK_DRIVER === errorCode; } - + return false; } @@ -97,6 +97,10 @@ export class DecisionApi implements Api { return BI.Providers.getProvider('dec.provider.cipher').getCipher(password); } + getPlain(cipher: string) { + return BI.Providers.getProvider('dec.provider.cipher').getPlain(cipher); + } + getHyperlink(name: string) { return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name]; } diff --git a/src/modules/crud/design.api.ts b/src/modules/crud/design.api.ts index ee983e8..2402db7 100644 --- a/src/modules/crud/design.api.ts +++ b/src/modules/crud/design.api.ts @@ -4,26 +4,26 @@ import { Connection, TestRequest, ConnectionPoolType, SocketResult } from './cru export class DesignApi implements Api { isDec = false; - - getConnectionlist(): Promise<{data: Connection[]}> { + + getConnectionlist(): Promise<{ data: Connection[] }> { return new Promise(resolve => { resolve({ data: [] }); }); } - deleteConnection(connectionName: string): Promise<{data: string}> { + deleteConnection(connectionName: string): Promise<{ data: string }> { return new Promise(resolve => { resolve({ data: 'success' }); }); } - addConnection(data: Connection): Promise<{data: string}> { + addConnection(data: Connection): Promise<{ data: string }> { return new Promise(resolve => { resolve({ data: 'success' }); }); } - updateConnection(data: Connection): Promise<{data: string}> { + updateConnection(data: Connection): Promise<{ data: string }> { return new Promise(resolve => { resolve({ data: 'success' }); }); @@ -34,14 +34,16 @@ export class DesignApi implements Api { }); } - getConnectionPool(name: string): Promise<{data: ConnectionPoolType}> { + getConnectionPool(name: string): Promise<{ data: ConnectionPoolType }> { return new Promise(resolve => { - resolve({ data: { - maxActive: 1, - maxIdle: 1, - numActive: 1, - numIdle: 1, - } }); + resolve({ + data: { + maxActive: 1, + maxIdle: 1, + numActive: 1, + numIdle: 1, + } + }); }); } @@ -72,6 +74,11 @@ export class DesignApi implements Api { return password; } + getPlain(cipher: string) { + // 设计器解密方法 + return cipher; + } + getHyperlink(name: string) { // 设计器获取超链 return ''; diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 700564c..84f52d4 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -64,13 +64,13 @@ export class FormJdbc extends BI.Widget { 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, @@ -360,7 +360,7 @@ export class FormJdbc extends BI.Widget { vgap: 15, disabled: true, value: schema, - items: schema ? [{ text: schema, value:schema }] : [], + items: schema ? [{ text: schema, value: schema }] : [], ref: (_ref: TextValueCombo) => { this.form.schema = _ref; }, @@ -537,7 +537,7 @@ export class FormJdbc extends BI.Widget { cls: 'bi-border', allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - value: validationQuery, + value: api.getPlain(validationQuery), width: 300, height: 100, ref: (_ref: TextAreaEditor) => { @@ -715,7 +715,7 @@ export class FormJdbc extends BI.Widget { ...drivers, ]; } - + return drivers; } @@ -756,12 +756,12 @@ export class FormJdbc extends BI.Widget { } } - public getSubmitValue():Connection { + 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(), @@ -788,7 +788,7 @@ export class FormJdbc extends BI.Widget { maxIdle: this.form.maxIdle.getValue(), minIdle: this.form.minIdle.getValue(), maxWait: this.form.maxWait.getValue(), - validationQuery: this.form.validationQuery.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, From 71c9d39d9dcd46d72a53681f9e4f6f7dfb2f92e3 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Thu, 8 Apr 2021 11:39:16 +0800 Subject: [PATCH 4/8] =?UTF-8?q?DEC-18013=20fix:=20=E3=80=90=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E3=80=91=E6=9C=80=E6=96=B0redis=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=8F=92=E4=BB=B6=EF=BC=8C=E6=96=B0=E5=BB=BA?= =?UTF-8?q?redis=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=EF=BC=8C=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=90=8D=E7=A7=B0=E6=98=AFwidget7127=E8=BF=99?= =?UTF-8?q?=E7=A7=8D=E5=B8=A6=E9=9A=8F=E6=9C=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 +++++++++------- .../maintain/forms/components/form.plugin.ts | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1756d0c..cca899a 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,16 @@ yarn dev BI.config(ConstantPluginTyps, (datas: string[]) => [...datas, { text: 'Redis', databaseType: 'Redis', + edit: '', + show: '', }]); ``` ### 数据连接填写页面 -ConstantName名称为`dec.constant.database.conf.connect.form.${name}.edit`,值为组件shortcut的名称 +edit属性值为填写组件shortcut的名称 ### 数据连接展示页面 -ConstantName名称为`dec.constant.database.conf.connect.form.${name}.show`,值为组件shortcut的名称 +show属性值为组件shortcut的名称 ### 示例 ``` @@ -121,7 +123,7 @@ BI.shortcut(RedisShowName, RedisShow); const RedisEdit = BI.inherit(BI.Widget, { props: { - formData: { + value: { url: '', port: '6379', password: '', @@ -152,7 +154,7 @@ const RedisEdit = BI.inherit(BI.Widget, { ref: _ref => { this.url = _ref; }, - text: o.formData.url, + text: o.value.url, }, ], }, @@ -173,7 +175,7 @@ const RedisEdit = BI.inherit(BI.Widget, { ref: _ref => { this.port = _ref; }, - text: o.formData.port, + text: o.value.port, }, ], }, @@ -195,14 +197,14 @@ const RedisEdit = BI.inherit(BI.Widget, { ref: _ref => { this.password = _ref; }, - text: o.formData.password, + text: o.value.password, }, ], }, ], }; }, - getSubmitValue() { + getValue() { return { url: this.url.getValue(), port: this.port.getValue(), diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index d36ba2c..c9bce03 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/src/modules/pages/maintain/forms/components/form.plugin.ts @@ -32,7 +32,7 @@ export class FormPlugin extends BI.Widget { return { connectionId, connectionType, - connectionName: this.plugin.getName ? this.plugin.getName() : '', + connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : '', connectionData: this.plugin.getValue(), }; } From 5ba87936b9cb6b98f53bf43ec9966121db676bb3 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Thu, 8 Apr 2021 16:09:09 +0800 Subject: [PATCH 5/8] =?UTF-8?q?DEC-17971=20feat:=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86sql=E4=BC=A0=E8=BE=93?= =?UTF-8?q?=E5=8A=A0=E5=AF=86-=E5=89=8D=E7=AB=AF?= 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 84f52d4..a527cd6 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -537,7 +537,7 @@ export class FormJdbc extends BI.Widget { cls: 'bi-border', allowBlank: true, watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), - value: api.getPlain(validationQuery), + value: api.getPlain(validationQuery || ''), width: 300, height: 100, ref: (_ref: TextAreaEditor) => { From aad60cbe9d9d5c85da1e405d9d3a2085d9e0e1e8 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Thu, 8 Apr 2021 11:39:16 +0800 Subject: [PATCH 6/8] =?UTF-8?q?DEC-18013=20fix:=20=E3=80=90=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E3=80=91=E6=9C=80=E6=96=B0redis=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=8F=92=E4=BB=B6=EF=BC=8C=E6=96=B0=E5=BB=BA?= =?UTF-8?q?redis=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=EF=BC=8C=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=90=8D=E7=A7=B0=E6=98=AFwidget7127=E8=BF=99?= =?UTF-8?q?=E7=A7=8D=E5=B8=A6=E9=9A=8F=E6=9C=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 71c9d39d9dcd46d72a53681f9e4f6f7dfb2f92e3) --- README.md | 16 +++++++++------- .../maintain/forms/components/form.plugin.ts | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1756d0c..cca899a 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,16 @@ yarn dev BI.config(ConstantPluginTyps, (datas: string[]) => [...datas, { text: 'Redis', databaseType: 'Redis', + edit: '', + show: '', }]); ``` ### 数据连接填写页面 -ConstantName名称为`dec.constant.database.conf.connect.form.${name}.edit`,值为组件shortcut的名称 +edit属性值为填写组件shortcut的名称 ### 数据连接展示页面 -ConstantName名称为`dec.constant.database.conf.connect.form.${name}.show`,值为组件shortcut的名称 +show属性值为组件shortcut的名称 ### 示例 ``` @@ -121,7 +123,7 @@ BI.shortcut(RedisShowName, RedisShow); const RedisEdit = BI.inherit(BI.Widget, { props: { - formData: { + value: { url: '', port: '6379', password: '', @@ -152,7 +154,7 @@ const RedisEdit = BI.inherit(BI.Widget, { ref: _ref => { this.url = _ref; }, - text: o.formData.url, + text: o.value.url, }, ], }, @@ -173,7 +175,7 @@ const RedisEdit = BI.inherit(BI.Widget, { ref: _ref => { this.port = _ref; }, - text: o.formData.port, + text: o.value.port, }, ], }, @@ -195,14 +197,14 @@ const RedisEdit = BI.inherit(BI.Widget, { ref: _ref => { this.password = _ref; }, - text: o.formData.password, + text: o.value.password, }, ], }, ], }; }, - getSubmitValue() { + getValue() { return { url: this.url.getValue(), port: this.port.getValue(), diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index d36ba2c..c9bce03 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/src/modules/pages/maintain/forms/components/form.plugin.ts @@ -32,7 +32,7 @@ export class FormPlugin extends BI.Widget { return { connectionId, connectionType, - connectionName: this.plugin.getName ? this.plugin.getName() : '', + connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : '', connectionData: this.plugin.getValue(), }; } From b72960c613b13ef164f3e698b0c9db2c2f2db31b Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Fri, 16 Apr 2021 14:42:21 +0800 Subject: [PATCH 7/8] =?UTF-8?q?DEC-18126=20fix:=20=E3=80=90=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E3=80=91=E5=B9=B3=E5=8F=B0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=EF=BC=88redis/json=EF=BC=89=EF=BC=8C=E5=9D=87?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/maintain/forms/components/form.plugin.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/pages/maintain/forms/components/form.plugin.ts b/src/modules/pages/maintain/forms/components/form.plugin.ts index c9bce03..8fd8fc9 100644 --- a/src/modules/pages/maintain/forms/components/form.plugin.ts +++ b/src/modules/pages/maintain/forms/components/form.plugin.ts @@ -1,6 +1,7 @@ -import { shortcut } from '@core/core'; -import { Connection } from 'src/modules/crud/crud.typings'; -import { getPluginWidgetEdit } from '../../../../app.service'; +import {shortcut} from '@core/core'; +import {Connection} from 'src/modules/crud/crud.typings'; +import {getPluginWidgetEdit} from '../../../../app.service'; + @shortcut() export class FormPlugin extends BI.Widget { static xtype = 'dec.dcm.maintain_plugin'; @@ -27,12 +28,12 @@ export class FormPlugin extends BI.Widget { } public getSubmitValue(): Connection { - const { connectionType, connectionId } = this.options.formData; + const { connectionType, connectionId, connectionName } = this.options.formData; return { connectionId, connectionType, - connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : '', + connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : connectionName, connectionData: this.plugin.getValue(), }; } From 7612bd1f6095319bf8fd842e9a814176a4cf3fe7 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Mon, 10 May 2021 14:38:50 +0800 Subject: [PATCH 8/8] =?UTF-8?q?DEC-18427=20fix:=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=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/form.server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/pages/maintain/forms/form.server.ts b/src/modules/pages/maintain/forms/form.server.ts index dc52f4c..d378768 100644 --- a/src/modules/pages/maintain/forms/form.server.ts +++ b/src/modules/pages/maintain/forms/form.server.ts @@ -12,7 +12,7 @@ export function testConnection(value: Connection): Promise { BI.Msg.toast(BI.i18nText('Dec-Dcm_Connection_ConnectionName_Cannt_Null'), { level: 'error', }); - + return false; } const id = BI.UUID(); @@ -27,7 +27,7 @@ export function testConnection(value: Connection): Promise { // DEC-14009 1.8以上版本JDK支持ODBC连接 if (driver === JDBC_ODBC_DRIVER) { testStatus.setFail(re.errorMsg, driver, Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][JDBC_ODBC_DRIVER_HELP_LINK]); - + return; } const databaseType = (formValue.connectionData as ConnectionJDBC).database; @@ -63,7 +63,7 @@ export function testConnection(value: Connection): Promise { loadingCls: 'upload-loading-icon', successText: BI.i18nText('Dec-Dcm_Connection_Test_Success'), successCls: 'upload-success-icon', - failText: BI.i18nText('Dec-Dcm_Connection_Test_Fail', name), + failText: BI.i18nText('Dec-Dcm_Connection_Test_Fail', ''), failCls: 'upload-fail-icon', retryText: BI.i18nText('Dec-Dcm_Connection_ReConnect'), ref: (_ref: any) => {