@xh/hoist 46.0.0 → 46.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/admin/tabs/activity/clienterrors/ClientErrorDetail.js +8 -29
- package/admin/tabs/activity/tracking/detail/ActivityDetailView.js +7 -28
- package/admin/tabs/general/alertBanner/AlertBannerPanel.js +2 -5
- package/admin/tabs/server/websocket/WebSocketModel.js +34 -20
- package/admin/tabs/server/websocket/WebSocketPanel.js +27 -7
- package/appcontainer/FeedbackDialogModel.js +2 -2
- package/cmp/ag-grid/AgGridModel.js +16 -9
- package/cmp/grid/Grid.js +13 -15
- package/cmp/grid/GridModel.js +10 -10
- package/cmp/grid/columns/Column.js +1 -1
- package/core/XH.js +23 -3
- package/data/Store.js +5 -5
- package/data/StoreRecord.js +18 -6
- package/desktop/appcontainer/AppContainer.js +13 -10
- package/desktop/appcontainer/SuspendPanel.js +54 -0
- package/desktop/appcontainer/SuspendPanel.scss +21 -0
- package/desktop/cmp/contextmenu/StoreContextMenu.js +1 -1
- package/desktop/cmp/form/FormField.js +38 -20
- package/desktop/cmp/grid/find/impl/GridFindFieldImplModel.js +4 -4
- package/kit/onsen/styles.scss +3 -3
- package/mobile/appcontainer/AppContainer.js +10 -5
- package/mobile/appcontainer/SuspendPanel.js +55 -0
- package/mobile/appcontainer/SuspendPanel.scss +51 -0
- package/mobile/cmp/form/FormField.js +32 -16
- package/package.json +1 -1
- package/svc/GridExportService.js +3 -3
- package/svc/IdleService.js +4 -10
- package/svc/WebSocketService.js +15 -4
package/svc/IdleService.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2021 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import {HoistService, XH, managed} from '@xh/hoist/core';
|
|
8
8
|
import {Timer} from '@xh/hoist/utils/async';
|
|
9
9
|
import {MINUTES, olderThan} from '@xh/hoist/utils/datetime';
|
|
10
10
|
|
|
@@ -55,14 +55,8 @@ export class IdleService extends HoistService {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
checkInactivityTimeout() {
|
|
58
|
-
if (XH.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
suspendApp() {
|
|
63
|
-
if (XH.appState === AppState.SUSPENDED) return;
|
|
64
|
-
XH.setAppState(AppState.SUSPENDED);
|
|
65
|
-
XH.webSocketService.shutdown();
|
|
66
|
-
Timer.cancelAll();
|
|
58
|
+
if (olderThan(XH.lastActivityMs, this.timeout)) {
|
|
59
|
+
XH.suspendApp({reason: 'IDLE'});
|
|
60
|
+
}
|
|
67
61
|
}
|
|
68
62
|
}
|
package/svc/WebSocketService.js
CHANGED
|
@@ -39,7 +39,7 @@ export class WebSocketService extends HoistService {
|
|
|
39
39
|
|
|
40
40
|
HEARTBEAT_TOPIC = 'xhHeartbeat';
|
|
41
41
|
REG_SUCCESS_TOPIC = 'xhRegistrationSuccess';
|
|
42
|
-
|
|
42
|
+
FORCE_APP_SUSPEND_TOPIC = 'xhForceAppSuspend';
|
|
43
43
|
|
|
44
44
|
/** @property {string} - unique channel assigned by server upon successful connection. */
|
|
45
45
|
@observable channelKey = null;
|
|
@@ -57,7 +57,8 @@ export class WebSocketService extends HoistService {
|
|
|
57
57
|
_socket;
|
|
58
58
|
_subsByTopic = {};
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
/** @property {boolean} **/
|
|
61
|
+
enabled = XH.appSpec.webSocketsEnabled;
|
|
61
62
|
|
|
62
63
|
constructor() {
|
|
63
64
|
super();
|
|
@@ -66,6 +67,15 @@ export class WebSocketService extends HoistService {
|
|
|
66
67
|
|
|
67
68
|
async initAsync() {
|
|
68
69
|
if (!this.enabled) return;
|
|
70
|
+
if (XH.environmentService.get('webSocketsEnabled') === false) {
|
|
71
|
+
console.error(
|
|
72
|
+
'WebSockets have been enabled on this client app, but are disabled on the server. ' +
|
|
73
|
+
'Please adjust your server-side configuration to use WebSockets.'
|
|
74
|
+
);
|
|
75
|
+
this.enabled = false;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
|
|
70
80
|
this.connect();
|
|
71
81
|
|
|
@@ -196,8 +206,9 @@ export class WebSocketService extends HoistService {
|
|
|
196
206
|
case this.REG_SUCCESS_TOPIC:
|
|
197
207
|
this.installChannelKey(data.channelKey);
|
|
198
208
|
break;
|
|
199
|
-
case this.
|
|
200
|
-
|
|
209
|
+
case this.FORCE_APP_SUSPEND_TOPIC:
|
|
210
|
+
XH.suspendApp({reason: 'SERVER_FORCE', message: data});
|
|
211
|
+
XH.track({category: 'App', message: 'App suspended via WebSocket'});
|
|
201
212
|
break;
|
|
202
213
|
}
|
|
203
214
|
|