Browse Source

DEC-14713 feat: 新增websocket连接失败文档链接

release/10.0
qcc 4 years ago
parent
commit
eef874ca72
  1. 12
      assets/scripts/dec.js
  2. 3
      i18n/zh_cn.properties
  3. 2
      package.json
  4. 1
      private/i18n.ts
  5. 41
      src/modules/components/link_button/link.ts
  6. 5
      src/modules/crud/api.ts
  7. 4
      src/modules/crud/decision.api.ts
  8. 5
      src/modules/crud/design.api.ts
  9. 12
      src/modules/pages/maintain/maintain.ts
  10. 6
      types/globals.d.ts

12
assets/scripts/dec.js

@ -16,6 +16,11 @@ window.DecCst = {
OPEN: 'getConnectionStatus', OPEN: 'getConnectionStatus',
SHUTDOWN: 'shutdownConnectionStatus', SHUTDOWN: 'shutdownConnectionStatus',
} }
},
Hyperlink: {
Database: {},
DECISION_HYPERLINK_CONFIG: "hyperlink",
WEBSOCKET_CONNECT: "websocket"
} }
}; };
@ -25,6 +30,11 @@ window.Dec = {
connected: false, connected: false,
}, },
personal: { personal: {
username: '' username: '',
},
system: {
hyperlink: {
websocket: "http://help.finebi.com/doc-view-183.html",
},
} }
} }

3
i18n/zh_cn.properties

@ -302,4 +302,5 @@ BI-Basic_Quarter= 季度
BI-Basic_No_Select= 不选 BI-Basic_No_Select= 不选
BI-Basic_Now= 此刻 BI-Basic_Now= 此刻
Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB Dec-Dcm_Connection_Analytic_DB=阿里云AnalyticDB
Dec-Dcm_Connection_Value_Out_Range=数值超出范围 Dec-Dcm_Connection_Value_Out_Range=数值超出范围
Dec-Dcm_Socket_Unable_Connect_Tip=可能出现编辑冲突

2
package.json

@ -72,4 +72,4 @@
"pre-push": "npm run eslint && npm run test" "pre-push": "npm run eslint && npm run test"
} }
} }
} }

1
private/i18n.ts

@ -302,4 +302,5 @@ export default {
'BI-Basic_Now': '此刻', 'BI-Basic_Now': '此刻',
'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB', 'Dec-Dcm_Connection_Analytic_DB': '阿里云AnalyticDB',
'Dec-Dcm_Connection_Value_Out_Range': '数值超出范围', 'Dec-Dcm_Connection_Value_Out_Range': '数值超出范围',
'Dec-Dcm_Socket_Unable_Connect_Tip': '可能出现编辑冲突',
}; };

41
src/modules/components/link_button/link.ts

@ -0,0 +1,41 @@
import { CenterAdapt, Label } from 'ui';
import { shortcut } from '@core/core';
export const LinkXtype = 'dec.dcm.components.link.button';
const DEFAULT_LINK = '/';
@shortcut(LinkXtype)
export class LinkButton extends BI.BasicButton {
props = {
text: '',
cls: 'cursor-pointer',
$testId: 'dec-dcm-link-button',
}
render() {
return {
type: CenterAdapt,
cls: 'bi-high-light',
items: [
{
type: Label,
cls: 'bi-high-light-border-bottom',
text: this.options.text,
},
],
};
}
getLink() {
const link = this.options.link;
return (BI.isFunction(link) ? link() : link) || DEFAULT_LINK;
}
setText(v: string) {
this.text.setText(v);
}
doClick() {
window.open(this.getLink());
}
}

5
src/modules/crud/api.ts

@ -66,4 +66,9 @@ export interface Api {
* *
*/ */
getCipher(password: string): string; getCipher(password: string): string;
/**
*
*/
getHyperlink(name: string): string;
} }

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

@ -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);
} }
getHyperlink(name: string) {
return Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][name];
}
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 && Dec.socket.connected) {

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

@ -71,4 +71,9 @@ export class DesignApi implements Api {
// 设计器加密方法 // 设计器加密方法
return password; return password;
} }
getHyperlink(name: string) {
// 设计器获取超链
return '';
}
} }

12
src/modules/pages/maintain/maintain.ts

@ -2,6 +2,7 @@ import { Vtape, Label, VerticalAdapt, ListView, IconButton } from 'ui';
import { shortcut, store } from '@core/core'; import { shortcut, store } from '@core/core';
import { MaintainModel, MaintainModelXtype } from './maintain.model'; import { MaintainModel, MaintainModelXtype } from './maintain.model';
import { MaintainFormXtype } from './forms/form'; import { MaintainFormXtype } from './forms/form';
import { LinkXtype } from 'src/modules/components/link_button/link';
import { PAGE_INDEX } from '@constants/constant'; import { PAGE_INDEX } from '@constants/constant';
import { ApiFactory } from 'src/modules/crud/apiFactory'; import { ApiFactory } from 'src/modules/crud/apiFactory';
const api = new ApiFactory().create(); const api = new ApiFactory().create();
@ -48,6 +49,16 @@ export class Maintain extends BI.Widget {
text: titleText, text: titleText,
height: 15, height: 15,
}, },
{
type: LinkXtype,
invisible: true,
lgap: 10,
text: BI.i18nText('Dec-Dcm_Socket_Unable_Connect_Tip'),
link: api.getHyperlink(DecCst.Hyperlink.WEBSOCKET_CONNECT),
ref: (_ref: any) => {
this.socketTip = _ref;
},
},
], ],
}, },
{ {
@ -66,6 +77,7 @@ export class Maintain extends BI.Widget {
BI.Msg.toast(BI.i18nText('Dec-Dcm_Socket_Unable_Connect'), { BI.Msg.toast(BI.i18nText('Dec-Dcm_Socket_Unable_Connect'), {
level: 'warning', level: 'warning',
}); });
this.socketTip.setVisible(true);
} }
} }

6
types/globals.d.ts vendored

@ -9,10 +9,14 @@ declare const Dec: {
fineServletURL: string; fineServletURL: string;
socket: { socket: {
connected: boolean; connected: boolean;
};
system: {
}; };
personal: { personal: {
username: string; username: string;
}; };
socketEmit: (type: string, name: string, callback: (re: any) => void) => void;
reqGet: (url: string, data: any, callback: (re: any) => void) => void; reqGet: (url: string, data: any, callback: (re: any) => void) => void;
reqPost: (url: string, data: any, callback: (re: any) => void) => void; reqPost: (url: string, data: any, callback: (re: any) => void) => void;
reqPut: (url: string, data: any, callback: (re: any) => void) => void; reqPut: (url: string, data: any, callback: (re: any) => void) => void;

Loading…
Cancel
Save