Browse Source

Merge pull request #1943 in DEC/decision-webui-dcm from bugfix/10.0 to release/10.0

* commit '10427947847bd3ebf729c25a912d51441aa42af5':
  DEC-18427 fix: 国际化问题
  DEC-17971 feat: 服务器数据集sql传输加密-前端
  DEC-18013 fix: 【自动化】最新redis数据集插件,新建redis数据连接,默认名称是widget7127这种带随机数
  DEC-17971 feat: 服务器数据集sql传输加密-前端
release/10.0
superman 4 years ago
parent
commit
0a5f8d60de
  1. 9
      src/modules/crud/api.ts
  2. 24
      src/modules/crud/decision.api.ts
  3. 31
      src/modules/crud/design.api.ts
  4. 16
      src/modules/pages/maintain/forms/components/form.jdbc.ts
  5. 6
      src/modules/pages/maintain/forms/form.server.ts

9
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;
/**
*
*/

24
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<TestRequest> {
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];
}

31
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 '';

16
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,

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

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