Browse Source

Merge pull request #1984 in DEC/decision-webui-dcm from release/10.0 to final/10.0

* commit '0a5f8d60de7bc62bbf53bfdce972e9a6be9e63ea':
  DEC-18427 fix: 国际化问题
  DEC-18126 fix: 【自动化】平台新增插件类型数据连接(redis/json),均无法保存
  DEC-18013 fix: 【自动化】最新redis数据集插件,新建redis数据连接,默认名称是widget7127这种带随机数
  DEC-17971 feat: 服务器数据集sql传输加密-前端
  DEC-18013 fix: 【自动化】最新redis数据集插件,新建redis数据连接,默认名称是widget7127这种带随机数
  DEC-17971 feat: 服务器数据集sql传输加密-前端
  update demo
  DEC-17991 chore: 甘老师插件接口问题反馈--数据连接支持创建时添加connectionname
final/10.0
superman 4 years ago
parent
commit
0259a6a0be
  1. 43
      README.md
  2. 5
      src/modules/crud/api.ts
  3. 4
      src/modules/crud/decision.api.ts
  4. 11
      src/modules/crud/design.api.ts
  5. 4
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  6. 11
      src/modules/pages/maintain/forms/components/form.plugin.ts
  7. 2
      src/modules/pages/maintain/forms/form.server.ts

43
README.md

@ -25,28 +25,32 @@ 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的名称
### 示例
```
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 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",
});
});
const RedisShow = BI.inherit(BI.Widget, {
props: {
formData: {
@ -115,15 +119,11 @@ BI.DOM.ready(() => {
};
},
});
BI.shortcut(RedisShowName, RedisShow);
BI.constant(ConstantRedisShow, RedisShowName);
const RedisEditName = 'dec.dcm.connection.plugin.redis.edit';
const RedisEdit = BI.inherit(BI.Widget, {
props: {
formData: {
value: {
url: '',
port: '6379',
password: '',
@ -154,7 +154,7 @@ BI.DOM.ready(() => {
ref: _ref => {
this.url = _ref;
},
text: o.formData.url,
text: o.value.url,
},
],
},
@ -175,7 +175,7 @@ BI.DOM.ready(() => {
ref: _ref => {
this.port = _ref;
},
text: o.formData.port,
text: o.value.port,
},
],
},
@ -197,14 +197,14 @@ BI.DOM.ready(() => {
ref: _ref => {
this.password = _ref;
},
text: o.formData.password,
text: o.value.password,
},
],
},
],
};
},
getSubmitValue() {
getValue() {
return {
url: this.url.getValue(),
port: this.port.getValue(),
@ -212,9 +212,6 @@ BI.DOM.ready(() => {
};
},
});
BI.shortcut(RedisEditName, RedisEdit);
BI.constant(ConstantRedisEdit, RedisEditName);
});
```

5
src/modules/crud/api.ts

@ -67,6 +67,11 @@ export interface Api {
*/
getCipher(password: string): string;
/**
*
*/
getPlain(cipher: string): string;
/**
*
*/

4
src/modules/crud/decision.api.ts

@ -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];
}

11
src/modules/crud/design.api.ts

@ -36,12 +36,14 @@ export class DesignApi implements Api {
getConnectionPool(name: string): Promise<{ data: ConnectionPoolType }> {
return new Promise(resolve => {
resolve({ data: {
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 '';

4
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: validationQuery,
value: api.getPlain(validationQuery || ''),
width: 300,
height: 100,
ref: (_ref: TextAreaEditor) => {
@ -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,

11
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';
@shortcut()
export class FormPlugin extends BI.Widget {
static xtype = 'dec.dcm.maintain_plugin';
@ -11,14 +12,18 @@ 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,
};
}
@ -28,7 +33,7 @@ export class FormPlugin extends BI.Widget {
return {
connectionId,
connectionType,
connectionName,
connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : connectionName,
connectionData: this.plugin.getValue(),
};
}

2
src/modules/pages/maintain/forms/form.server.ts

@ -63,7 +63,7 @@ export function testConnection(value: Connection): Promise<string[]> {
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) => {

Loading…
Cancel
Save