Browse Source

DEC-17971 feat: 服务器数据集sql传输加密-前端

feature/10.0
zsmj1994 4 years ago
parent
commit
3c8bc2bebd
  1. 9
      src/modules/crud/api.ts
  2. 14
      src/modules/crud/decision.api.ts
  3. 29
      src/modules/crud/design.api.ts
  4. 8
      src/modules/pages/maintain/forms/components/form.jdbc.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 * @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; getCipher(password: string): string;
/**
*
*/
getPlain(cipher: string): string;
/** /**
* *
*/ */

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

@ -6,7 +6,7 @@ import { editStatusEvent, errorCode } from '@constants/env';
export class DecisionApi implements Api { export class DecisionApi implements Api {
isDec = true; isDec = true;
getConnectionlist(): Promise<{data?: Connection[]}> { getConnectionlist(): Promise<{ data?: Connection[] }> {
return requestGet('list', {}); return requestGet('list', {});
} }
@ -20,7 +20,7 @@ export class DecisionApi implements Api {
const form = { const form = {
...data, ...data,
connectionId: data.connectionId || data.connectionName, connectionId: data.connectionId || data.connectionName,
connectionData : JSON.stringify(data.connectionData), connectionData: JSON.stringify(data.connectionData),
}; };
return requestPost('', form); return requestPost('', form);
@ -29,7 +29,7 @@ export class DecisionApi implements Api {
updateConnection(data: Connection) { updateConnection(data: Connection) {
const form = { const form = {
...data, ...data,
connectionData : JSON.stringify(data.connectionData), connectionData: JSON.stringify(data.connectionData),
}; };
return requestPut('', form); return requestPut('', form);
@ -38,13 +38,13 @@ export class DecisionApi implements Api {
testConnection(data: Connection): Promise<TestRequest> { testConnection(data: Connection): Promise<TestRequest> {
const form = { const form = {
...data, ...data,
connectionData : JSON.stringify(data.connectionData), connectionData: JSON.stringify(data.connectionData),
}; };
return requestPost('test', form); return requestPost('test', form);
} }
getConnectionPool(name: string): Promise<{data?: ConnectionPoolType}> { getConnectionPool(name: string): Promise<{ data?: ConnectionPoolType }> {
return requestGet(`pool/info?connectionName=${encodeURIComponent(name)}`, {}); return requestGet(`pool/info?connectionName=${encodeURIComponent(name)}`, {});
} }
@ -97,6 +97,10 @@ export class DecisionApi implements Api {
return BI.Providers.getProvider('dec.provider.cipher').getCipher(password); return BI.Providers.getProvider('dec.provider.cipher').getCipher(password);
} }
getPlain(cipher: string) {
return BI.Providers.getProvider('dec.provider.cipher').getPlain(cipher);
}
getHyperlink(name: string) { getHyperlink(name: string) {
return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name]; return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name];
} }

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

@ -5,25 +5,25 @@ import { Connection, TestRequest, ConnectionPoolType, SocketResult } from './cru
export class DesignApi implements Api { export class DesignApi implements Api {
isDec = false; isDec = false;
getConnectionlist(): Promise<{data: Connection[]}> { getConnectionlist(): Promise<{ data: Connection[] }> {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ data: [] }); resolve({ data: [] });
}); });
} }
deleteConnection(connectionName: string): Promise<{data: string}> { deleteConnection(connectionName: string): Promise<{ data: string }> {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ data: 'success' }); resolve({ data: 'success' });
}); });
} }
addConnection(data: Connection): Promise<{data: string}> { addConnection(data: Connection): Promise<{ data: string }> {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ data: 'success' }); resolve({ data: 'success' });
}); });
} }
updateConnection(data: Connection): Promise<{data: string}> { updateConnection(data: Connection): Promise<{ data: string }> {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ data: 'success' }); 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 => { return new Promise(resolve => {
resolve({ data: { resolve({
maxActive: 1, data: {
maxIdle: 1, maxActive: 1,
numActive: 1, maxIdle: 1,
numIdle: 1, numActive: 1,
} }); numIdle: 1,
}
});
}); });
} }
@ -72,6 +74,11 @@ export class DesignApi implements Api {
return password; return password;
} }
getPlain(cipher: string) {
// 设计器解密方法
return cipher;
}
getHyperlink(name: string) { getHyperlink(name: string) {
// 设计器获取超链 // 设计器获取超链
return ''; return '';

8
src/modules/pages/maintain/forms/components/form.jdbc.ts

@ -360,7 +360,7 @@ export class FormJdbc extends BI.Widget {
vgap: 15, vgap: 15,
disabled: true, disabled: true,
value: schema, value: schema,
items: schema ? [{ text: schema, value:schema }] : [], items: schema ? [{ text: schema, value: schema }] : [],
ref: (_ref: TextValueCombo) => { ref: (_ref: TextValueCombo) => {
this.form.schema = _ref; this.form.schema = _ref;
}, },
@ -537,7 +537,7 @@ export class FormJdbc extends BI.Widget {
cls: 'bi-border', cls: 'bi-border',
allowBlank: true, allowBlank: true,
watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'), watermark: BI.i18nText('Dec-Dcm_Connection_Form_Place_Input'),
value: validationQuery, value: api.getPlain(validationQuery),
width: 300, width: 300,
height: 100, height: 100,
ref: (_ref: TextAreaEditor) => { ref: (_ref: TextAreaEditor) => {
@ -756,7 +756,7 @@ export class FormJdbc extends BI.Widget {
} }
} }
public getSubmitValue():Connection { public getSubmitValue(): Connection {
const connectionData = this.options.formData.connectionData as ConnectionJDBC; const connectionData = this.options.formData.connectionData as ConnectionJDBC;
const connectionPoolAttr = connectionData.connectionPoolAttr; const connectionPoolAttr = connectionData.connectionPoolAttr;
const originalCharsetName = this.form.originalCharsetName.getValue()[0] || ''; const originalCharsetName = this.form.originalCharsetName.getValue()[0] || '';
@ -788,7 +788,7 @@ export class FormJdbc extends BI.Widget {
maxIdle: this.form.maxIdle.getValue(), maxIdle: this.form.maxIdle.getValue(),
minIdle: this.form.minIdle.getValue(), minIdle: this.form.minIdle.getValue(),
maxWait: this.form.maxWait.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, 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, 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, testWhileIdle: BI.size(this.form.testWhileIdle.getValue()) > 0 ? this.form.testWhileIdle.getValue()[0] : connectionPoolAttr.testWhileIdle,

Loading…
Cancel
Save