Browse Source

feat: DEC-9068 编辑前校验socket连接状态

qufenxi
alan 5 years ago
parent
commit
18ee5fc4bf
  1. 1
      i18n/zh_cn.properties
  2. 1
      private/i18n.ts
  3. 5
      src/modules/crud/api.ts
  4. 8
      src/modules/crud/decision.api.ts
  5. 5
      src/modules/crud/design.api.ts
  6. 10
      src/modules/pages/maintain/maintain.ts

1
i18n/zh_cn.properties

@ -101,6 +101,7 @@ Dec-Dcm_Connection_JDBC_Other=其他JDBC
Dec-Dcm_Connection_JDBC_Warning= 请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录
Dec-Dcm_Connection_Form_UserName_Password= 用户名密码
Dec-Dcm_Change_Name= 重命名
Dec-Dcm_Socket_Unable_Connect= Socket未连接,可能存在多人同时编辑造成冲突,相关端口可能未开放
BI-Multi_Date_Quarter_End= 季度末
BI-Multi_Date_Month_Begin= 月初

1
private/i18n.ts

@ -100,6 +100,7 @@ export default {
'Dec-Dcm_Connection_JDBC_Warning': '请确认已经将krb5.Conf文件添加到/webapps/webroot/WEB_INF/resources目录',
'Dec-Dcm_Connection_Form_UserName_Password': '用户名密码',
'Dec-Dcm_Change_Name': '重命名',
'Dec-Dcm_Socket_Unable_Connect': 'Socket未连接,可能存在多人同时编辑造成冲突,相关端口可能未开放',
'BI-Multi_Date_Quarter_End': '季度末',
'BI-Multi_Date_Month_Begin': '月初',
'BI-Multi_Date_YMD': '年月日',

5
src/modules/crud/api.ts

@ -51,4 +51,9 @@ export interface Api {
* @param name
*/
shutdownConnectionStatus(name: string): Promise<SocketResult>;
/**
* socket连接状态
*/
getSocketStatus(): boolean;
}

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

@ -57,6 +57,14 @@ export class DecisionApi implements Api {
return this.sendEditStatusEvent(name, editStatusEvent.SHUTDOWN);
}
getSocketStatus(): boolean {
if (Dec) {
return Dec.socket.connected;
}
return false;
}
private sendEditStatusEvent(name: string, type: string): Promise<SocketResult> {
return new Promise(resolve => {
if (Dec && Dec.socket.connected) {

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

@ -56,4 +56,9 @@ export class DesignApi implements Api {
resolve({ data: 'success' });
});
}
getSocketStatus() {
// 设计器无socket校验
return true;
}
}

10
src/modules/pages/maintain/maintain.ts

@ -3,6 +3,8 @@ import { shortcut, store } from '@core/core';
import { MaintainModel, MaintainModelXtype } from './maintain.model';
import { MaintainFormXtype } from './forms/form';
import { PAGE_INDEX } from '@constants/constant';
import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create();
import './maintain.less';
export const MaintainXtype = 'dec.dcm.maintain';
@ -53,6 +55,14 @@ export class Maintain extends BI.Widget {
};
}
mounted() {
if (!api.getSocketStatus()) {
BI.Msg.toast(BI.i18nText('Dec-Dcm_Socket_Unable_Connect'), {
level: 'warning',
});
}
}
private renderItems() {
const { type } = this.getEditConnection();

Loading…
Cancel
Save