Compare commits

...

26 Commits

Author SHA1 Message Date
superman 1967092641 Merge pull request #9385 in DEC/decision-webui-dcm from research/mss-2.0 to research/11.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 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. 52
      src/modules/crud/decision.api.ts
  5. 3
      src/modules/pages/maintain/maintain.ts
  6. 4
      types/globals.d.ts

2
assets/scripts/dec.js

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

10
src/modules/constants/env.ts

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

6
src/modules/crud/api.ts

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

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

@ -82,11 +82,20 @@ export class DecisionApi implements Api {
}
getConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.OPEN)
.then(re => {
if (re.errorCode) {
// TODO: 当前emit同步回调已无法执行
this.sendEditStatusEvent(name, editStatusEvent.OPEN);
if (!Dec.socket?.connected) {
return Promise.resolve({ data: 'success' });
}
return new Promise((resolve, rejected) => {
this.addEventListener(editStatusEvent.OPEN, res => {
const data = JSON.parse(res.data);
if (data.errorCode) {
let errorMessage = '';
switch (re.errorCode) {
switch (data.errorCode) {
case errorCode.CONNECTION_DELETED:
errorMessage = 'Dec-Dcm_Connection_Deleted';
break;
@ -94,29 +103,30 @@ export class DecisionApi implements Api {
errorMessage = 'Dec-Dcm_Connection_Is_Using';
break;
default:
errorMessage = re.errorMsg;
errorMessage = data.errorMessage;
break;
}
BI.Msg.toast(BI.i18nText(errorMessage, re.errorMsg), {
BI.Msg.toast(BI.i18nText(errorMessage, data.errorMessage), {
level: 'error',
});
throw re;
rejected(data);
} else {
return re;
resolve(res);
}
});
});
}
shutdownConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.SHUTDOWN);
setEditedConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.CONNECTION_EDITED);
}
getSocketStatus(): boolean {
if (Dec) {
return Dec.socket.connected;
shutdownConnectionStatus(name: string): Promise<SocketResult> {
return this.sendEditStatusEvent(name, editStatusEvent.CONNECTION_RELEASED);
}
return false;
getSocketStatus(): boolean {
return !!Dec?.socket?.connected;
}
isDriverError(errorCode: string) {
@ -164,8 +174,8 @@ export class DecisionApi implements Api {
private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => {
if (Dec && Dec.socket.connected) {
Dec.socketEmit(type, BI.encode(name), (re: any) => {
if (Dec?.socket?.connected) {
Dec.socket.emit(type, BI.encode(name), (re: any) => {
resolve(re);
});
} else {
@ -173,4 +183,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.originOn(name, callback);
}
}

3
src/modules/pages/maintain/maintain.ts

@ -81,6 +81,9 @@ export class Maintain extends BI.Widget {
});
this.socketTip.setVisible(true);
}
this.model.connectionSelectedOne
&& api.setEditedConnectionStatus(this.model.connectionSelectedOne.connectionName);
}
private renderItems() {

4
types/globals.d.ts vendored

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

Loading…
Cancel
Save