Browse Source

Pull request #8927: REPORT-115929 fix: 【服务拆分】数据连接适配通知中心

Merge in DEC/decision-webui-dcm from ~AUSTIN.DUAN/decision-webui-dcm:research/11.0 to research/11.0

* commit 'c8aceb8349c3ebf35c44f12f1c3d2c439acd2871':
  REPORT-115929 fix: 【服务拆分】数据连接适配通知中心
research/11.0
Austin.Duan-段嗣跃 8 months ago
parent
commit
ba44e417e6
  1. 2
      assets/scripts/dec.js
  2. 2
      src/modules/constants/env.ts
  3. 6
      src/modules/crud/api.ts
  4. 8
      src/modules/crud/decision.api.ts
  5. 2
      src/modules/pages/maintain/maintain.ts
  6. 1
      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: {

2
src/modules/constants/env.ts

@ -12,6 +12,8 @@ export const connectionType: {
export const editStatusEvent: { export const editStatusEvent: {
OPEN: string; OPEN: string;
SHUTDOWN: string; SHUTDOWN: string;
CONNECTION_EDITED: string,
CONNECTION_RELEASED: string,
} = DecCst.Connect.EditStatusEvent; } = DecCst.Connect.EditStatusEvent;
export const errorCode: { export const errorCode: {

6
src/modules/crud/api.ts

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

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

@ -86,8 +86,12 @@ export class DecisionApi implements Api {
}); });
} }
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 {
@ -119,7 +123,7 @@ 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?.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 {

2
src/modules/pages/maintain/maintain.ts

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

1
types/globals.d.ts vendored

@ -9,6 +9,7 @@ declare const Dec: {
fineServletURL: string; fineServletURL: string;
socket: { socket: {
connected: boolean; connected: boolean;
emit: Function;
}; };
system: { system: {

Loading…
Cancel
Save