Compare commits

...

36 Commits

Author SHA1 Message Date
Hans-杨瀚 439b8bc8ad Pull request #9647: REPORT-126948 合并WebSocket的namespace和event FBP部分 4 months ago
hans f4140b1035 REPORT-126948 合并WebSocket的namespace和event FBP部分 数据结构调整 4 months ago
Hans-杨瀚 50b9a9a181 Pull request #9644: REPORT-126948 合并WebSocket的namespace和event FBP部分 4 months ago
hans 564c5ac01c REPORT-126948 合并WebSocket的namespace和event FBP部分 数据结构调整 4 months ago
hans 626c712ce6 REPORT-126948 合并WebSocket的namespace和event FBP部分 4 months ago
superman b65b5d17ee Merge pull request #9594 in DEC/decision-webui-dcm from research/fbp-1.0 to research/mss-2.0 5 months ago
superman 8d5549c908 Merge pull request #9388 in DEC/decision-webui-dcm from research/mss-2.0 to research/fbp-1.0 6 months ago
superman 0127ccfc6e Merge pull request #9387 in DEC/decision-webui-dcm from research/11.0 to research/mss-2.0 6 months ago
superman 1967092641 Merge pull request #9385 in DEC/decision-webui-dcm from research/mss-2.0 to research/11.0 6 months ago
superman 3a2ad47cb6 Merge pull request #9311 in DEC/decision-webui-dcm from research/mss-2.0 to research/fbp-1.0 6 months ago
superman f86b5ec86f Merge pull request #9310 in DEC/decision-webui-dcm from research/11.0 to research/mss-2.0 6 months ago
superman 9518f7aa5a Merge pull request #9309 in DEC/decision-webui-dcm from research/mss-2.0 to research/11.0 6 months ago
superman b0eed777e6 Merge pull request #9164 in DEC/decision-webui-dcm from research/mss-2.0 to research/fbp-1.0 7 months ago
superman c58b16497d Merge pull request #9161 in DEC/decision-webui-dcm from research/fbp-1.0 to research/mss-2.0 7 months ago
Austin.Duan-段嗣跃 e89681f83c Pull request #9150: 无JIRA任务,解决冲突 7 months ago
Austin.Duan e331143a9f 无JIRA任务,解决冲突 7 months ago
superman 8bd01fdff6 Merge pull request #9147 in DEC/decision-webui-dcm from research/11.0 to research/mss-2.0 7 months ago
Austin.Duan-段嗣跃 2b5d1144f3 Pull request #9145: REPORT-114169 fix: 【多租户】新建数据连接输入框样式问题 7 months ago
Austin.Duan 008573646a REPORT-114169 fix: 【多租户】新建数据连接输入框样式问题 7 months ago
superman 570e6fd9d2 Merge pull request #9144 in DEC/decision-webui-dcm from research/mss-2.0 to research/11.0 7 months ago
superman 9c75596e56 Merge pull request #9125 in DEC/decision-webui-dcm from research/mss-2.0 to research/fbp-1.0 7 months ago
Austin.Duan-段嗣跃 7a0c99f0ad Pull request #9123: REPORT-118414 fix: 【多租户】修复数据连接编辑异常问题 7 months ago
Austin.Duan 14ea780da8 REPORT-118414 fix: 【多租户】修复数据连接编辑异常问题 7 months ago
superman 8a84d4e1e0 Pull request #9094: 无jira任务, persist/11.0 合 research/fbp-1.0 8 months ago
Austin.Duan-段嗣跃 a50190eb1c Pull request #8996: KERNEL-15739 fix: 【服务拆分】数据连接补充下socket连接异常场景 8 months ago
Austin.Duan 1b8aa4e63a Merge branch 'research/11.0' of ssh://code.fineres.com:7999/~austin.duan/decision-webui-dcm into research/11.0 8 months ago
Austin.Duan 680c195084 KERNEL-15739 fix: 【服务拆分】数据连接补充下socket连接异常场景 8 months ago
Austin.Duan-段嗣跃 159428317b Pull request #8955: REPORT-116621 fix: 【服务拆分】数据连接消息结构适配 8 months ago
Austin.Duan db636f32ed Merge branch 'research/11.0' of ssh://code.fineres.com:7999/~austin.duan/decision-webui-dcm into research/11.0 8 months ago
Austin.Duan 70a96925b7 REPORT-116621 fix: 【服务拆分】数据连接消息结构适配 8 months ago
Austin.Duan-段嗣跃 babc7aafa1 Pull request #8944: REPORT-116621 fix: 【服务拆分】emit回调无法触发问题 8 months ago
Austin.Duan 4847988a92 REPORT-116621 fix: 【服务拆分】emit回调无法触发问题 8 months ago
Austin.Duan-段嗣跃 ba44e417e6 Pull request #8927: REPORT-115929 fix: 【服务拆分】数据连接适配通知中心 8 months ago
Austin.Duan c8aceb8349 REPORT-115929 fix: 【服务拆分】数据连接适配通知中心 8 months ago
Austin.Duan-段嗣跃 62064baa0f Pull request #8564: REPORT-110595 fix: socket相关内容加个容错 12 months ago
Austin.Duan 2d14eb0480 REPORT-110595 fix: 数据连接-删除数据连接失败 12 months ago
  1. 2
      assets/scripts/dec.js
  2. 10
      src/modules/constants/env.ts
  3. 6
      src/modules/crud/api.ts
  4. 53
      src/modules/crud/decision.api.ts
  5. 9
      src/modules/pages/maintain/maintain.ts
  6. 4
      types/globals.d.ts

2
assets/scripts/dec.js

@ -16,6 +16,8 @@ window.DecCst = {
EditStatusEvent: { EditStatusEvent: {
OPEN: 'getConnectionStatus', OPEN: 'getConnectionStatus',
SHUTDOWN: 'shutdownConnectionStatus', SHUTDOWN: 'shutdownConnectionStatus',
CONNECTION_EDITED: 'connectionEdited',
CONNECTION_RELEASED: 'connectionReleased',
} }
}, },
Hyperlink: { Hyperlink: {

10
src/modules/constants/env.ts

@ -9,10 +9,12 @@ export const connectionType: {
JNDI: string; JNDI: string;
} = DecCst.Connect.ConnectionType; } = DecCst.Connect.ConnectionType;
export const editStatusEvent: { export const editStatusEvent = {
OPEN: string; OPEN: 'getConnectionStatus',
SHUTDOWN: string; SHUTDOWN: 'shutdownConnectionStatus',
} = DecCst.Connect.EditStatusEvent; CONNECTION_EDITED: 'connectionEdited',
CONNECTION_RELEASED: 'connectionReleased',
};
export const errorCode: { export const errorCode: {
CONNECTION_DELETED: string; CONNECTION_DELETED: string;

6
src/modules/crud/api.ts

@ -75,6 +75,12 @@ export interface Api {
*/ */
getConnectionStatus(name: string): Promise<SocketResult>; getConnectionStatus(name: string): Promise<SocketResult>;
/**
*
* @param name
*/
setEditedConnectionStatus(name: string): void;
/** /**
* *
* @param name * @param name

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

@ -50,7 +50,7 @@ export class DecisionApi implements Api {
/** /**
* *
* @returns * @returns
*/ */
getDriverLoadPath(data: Connection): Promise<ResultType<string>> { getDriverLoadPath(data: Connection): Promise<ResultType<string>> {
const form = { const form = {
@ -82,11 +82,19 @@ export class DecisionApi implements Api {
} }
getConnectionStatus(name: string): Promise<SocketResult> { getConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.OPEN) // TODO: 当前emit同步回调已无法执行
.then(re => { this.sendEditStatusEvent(name, editStatusEvent.OPEN);
if (re.errorCode) {
if (!Dec.socket?.connected) {
return Promise.resolve({ data: 'success' });
}
return new Promise((resolve, rejected) => {
this.addEventListener(editStatusEvent.OPEN, data => {
if (data.errorCode) {
let errorMessage = ''; let errorMessage = '';
switch (re.errorCode) { switch (data.errorCode) {
case errorCode.CONNECTION_DELETED: case errorCode.CONNECTION_DELETED:
errorMessage = 'Dec-Dcm_Connection_Deleted'; errorMessage = 'Dec-Dcm_Connection_Deleted';
break; break;
@ -94,29 +102,30 @@ export class DecisionApi implements Api {
errorMessage = 'Dec-Dcm_Connection_Is_Using'; errorMessage = 'Dec-Dcm_Connection_Is_Using';
break; break;
default: default:
errorMessage = re.errorMsg; errorMessage = data.errorMessage;
break; break;
} }
BI.Msg.toast(BI.i18nText(errorMessage, re.errorMsg), { BI.Msg.toast(BI.i18nText(errorMessage, data.errorMessage), {
level: 'error', level: 'error',
}); });
throw re; rejected(data);
} else { } else {
return re; resolve(data);
} }
}); });
});
}
setEditedConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.CONNECTION_EDITED);
} }
shutdownConnectionStatus(name: string): Promise<SocketResult> { shutdownConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.SHUTDOWN); return this.sendEditStatusEvent(name, editStatusEvent.CONNECTION_RELEASED);
} }
getSocketStatus(): boolean { getSocketStatus(): boolean {
if (Dec) { return !!Dec?.socket?.connected;
return Dec.socket.connected;
}
return false;
} }
isDriverError(errorCode: string) { isDriverError(errorCode: string) {
@ -164,8 +173,8 @@ export class DecisionApi implements Api {
private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> { private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => { return new Promise(resolve => {
if (Dec && Dec.socket.connected) { if (Dec?.socket?.connected) {
Dec.socketEmit(type, BI.encode(name), (re: any) => { Dec.socket.emit(type, BI.encode(name), (re: any) => {
resolve(re); resolve(re);
}); });
} else { } else {
@ -173,4 +182,14 @@ export class DecisionApi implements Api {
} }
}); });
} }
private addEventListener(name: string, callback: Function) {
if (!Dec.socket) return;
if (Dec.socket.hasListeners(name)) {
Dec.socket.removeListener(name);
}
Dec.socket.on(name, callback, false);
}
} }

9
src/modules/pages/maintain/maintain.ts

@ -25,7 +25,7 @@ export class Maintain extends BI.Widget {
render() { render() {
const { isEdit, databaseType } = this.getEditConnection(); const { isEdit, databaseType } = this.getEditConnection();
const titleText = getTextByDatabaseType(databaseType); const titleText = getTextByDatabaseType(databaseType);
return { return {
type: BI.VTapeLayout.xtype, type: BI.VTapeLayout.xtype,
hgap: 16, hgap: 16,
@ -81,11 +81,14 @@ export class Maintain extends BI.Widget {
}); });
this.socketTip.setVisible(true); this.socketTip.setVisible(true);
} }
this.model.connectionSelectedOne
&& api.setEditedConnectionStatus(this.model.connectionSelectedOne.connectionName);
} }
private renderItems() { private renderItems() {
const { type } = this.getEditConnection(); const { type } = this.getEditConnection();
return [{ return [{
type: MaintainForm.xtype, type: MaintainForm.xtype,
connectionType: type, connectionType: type,
@ -106,7 +109,7 @@ export class Maintain extends BI.Widget {
const connectionJDBC = this.model.connectionSelectedOne.connectionData as ConnectionJDBC; const connectionJDBC = this.model.connectionSelectedOne.connectionData as ConnectionJDBC;
databaseType = getJdbcDatabaseType(connectionJDBC.database, connectionJDBC.driver).databaseType; databaseType = getJdbcDatabaseType(connectionJDBC.database, connectionJDBC.driver).databaseType;
} }
return { return {
type: this.model.connectionSelectedOne.connectionType, type: this.model.connectionSelectedOne.connectionType,
text: this.model.connectionSelectedOne.connectionName, text: this.model.connectionSelectedOne.connectionName,

4
types/globals.d.ts vendored

@ -11,6 +11,10 @@ declare const Dec: {
fineServletURL: string; fineServletURL: string;
socket: { socket: {
connected: boolean; connected: boolean;
emit: Function;
on: Function;
hasListeners: Function;
removeListener: Function;
}; };
system: {}; system: {};
personal: { personal: {

Loading…
Cancel
Save