@xh/hoist 72.5.0 → 72.5.1
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
CHANGED
|
@@ -138,18 +138,23 @@ export class LogDisplayModel extends HoistModel {
|
|
|
138
138
|
sizingMode: 'tiny',
|
|
139
139
|
emptyText: 'No log entries found...',
|
|
140
140
|
sortBy: 'rowNum|asc',
|
|
141
|
+
autosizeOptions: {mode: 'disabled'},
|
|
141
142
|
store: {
|
|
142
143
|
idSpec: 'rowNum'
|
|
143
144
|
},
|
|
144
145
|
columns: [
|
|
145
146
|
{
|
|
146
147
|
field: {name: 'rowNum', type: 'number'},
|
|
147
|
-
width:
|
|
148
|
+
width: 60,
|
|
149
|
+
pinned: true,
|
|
148
150
|
cellClass: 'xh-log-display__row-number'
|
|
149
151
|
},
|
|
150
152
|
{
|
|
151
153
|
field: 'rowContent',
|
|
152
|
-
|
|
154
|
+
// Hard-code to a very wide value - allows us to avoid autosize overhead while
|
|
155
|
+
// ensuring that all but crazy-long lines are readable. We trust Admins can
|
|
156
|
+
// ignore excess horizontal scrolling for this component.
|
|
157
|
+
width: 5000,
|
|
153
158
|
autosizable: false,
|
|
154
159
|
cellClass: 'xh-log-display__row-content'
|
|
155
160
|
}
|
|
@@ -179,20 +184,11 @@ export class LogDisplayModel extends HoistModel {
|
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
private updateGridData(data) {
|
|
182
|
-
const {tailActive, gridModel} = this
|
|
183
|
-
|
|
184
|
-
const gridData = data.map(row => {
|
|
185
|
-
if (row[1].length > maxRowLength) {
|
|
186
|
-
maxRowLength = row[1].length;
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
187
|
+
const {tailActive, gridModel} = this,
|
|
188
|
+
gridData = data.map(row => ({
|
|
189
189
|
rowNum: row[0],
|
|
190
190
|
rowContent: row[1]
|
|
191
|
-
};
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// Estimate the length of the row in pixels based on (character count) * (font size)
|
|
195
|
-
gridModel.setColumnState([{colId: 'rowContent', width: maxRowLength * 6}]);
|
|
191
|
+
}));
|
|
196
192
|
|
|
197
193
|
gridModel.loadData(gridData);
|
|
198
194
|
|
|
@@ -83,6 +83,7 @@ export declare class WebSocketService extends HoistService {
|
|
|
83
83
|
private buildWebSocketUrl;
|
|
84
84
|
private maybeLogMessage;
|
|
85
85
|
private noteTelemetryEvent;
|
|
86
|
+
private ensureEnabled;
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
88
89
|
* Wrapper class to encapsulate and manage a subscription to messages for a given topic + handler.
|
package/package.json
CHANGED
package/svc/WebSocketService.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class WebSocketService extends HoistService {
|
|
|
61
61
|
/** Set to true to log all sent/received messages - very chatty. */
|
|
62
62
|
logMessages: boolean = false;
|
|
63
63
|
|
|
64
|
-
telemetry: WebSocketTelemetry = null;
|
|
64
|
+
telemetry: WebSocketTelemetry = {channelKey: null, subscriptionCount: 0, events: {}};
|
|
65
65
|
|
|
66
66
|
private _timer: Timer;
|
|
67
67
|
private _socket: WebSocket;
|
|
@@ -83,7 +83,6 @@ export class WebSocketService extends HoistService {
|
|
|
83
83
|
this.enabled = false;
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
this.telemetry = {channelKey: null, subscriptionCount: 0, events: {}};
|
|
87
86
|
|
|
88
87
|
this.connect();
|
|
89
88
|
|
|
@@ -109,6 +108,7 @@ export class WebSocketService extends HoistService {
|
|
|
109
108
|
* dispose of their subs on destroy.
|
|
110
109
|
*/
|
|
111
110
|
subscribe(topic: string, fn: (msg: WebSocketMessage) => any): WebSocketSubscription {
|
|
111
|
+
this.ensureEnabled();
|
|
112
112
|
const subs = this.getSubsForTopic(topic),
|
|
113
113
|
existingSub = find(subs, {fn});
|
|
114
114
|
|
|
@@ -126,6 +126,7 @@ export class WebSocketService extends HoistService {
|
|
|
126
126
|
* @param subscription - WebSocketSubscription returned when the subscription was established.
|
|
127
127
|
*/
|
|
128
128
|
unsubscribe(subscription: WebSocketSubscription) {
|
|
129
|
+
this.ensureEnabled();
|
|
129
130
|
const subs = this.getSubsForTopic(subscription.topic);
|
|
130
131
|
pull(subs, subscription);
|
|
131
132
|
this.telemetry.subscriptionCount--;
|
|
@@ -135,6 +136,7 @@ export class WebSocketService extends HoistService {
|
|
|
135
136
|
* Send a message back to the server via the connected websocket.
|
|
136
137
|
*/
|
|
137
138
|
sendMessage(message: WebSocketMessage) {
|
|
139
|
+
this.ensureEnabled();
|
|
138
140
|
this.updateConnectedStatus();
|
|
139
141
|
throwIf(!this.connected, 'Unable to send message via websocket - not connected.');
|
|
140
142
|
|
|
@@ -320,6 +322,10 @@ export class WebSocketService extends HoistService {
|
|
|
320
322
|
evtTel.count++;
|
|
321
323
|
evtTel.lastTime = Date.now();
|
|
322
324
|
}
|
|
325
|
+
|
|
326
|
+
private ensureEnabled() {
|
|
327
|
+
throwIf(!this.enabled, 'Operation not available. WebSocketService is disabled.');
|
|
328
|
+
}
|
|
323
329
|
}
|
|
324
330
|
|
|
325
331
|
/**
|