@xh/hoist 73.0.0-SNAPSHOT.1741790055811 → 73.0.0-SNAPSHOT.1741804543922
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 +6 -4
- package/admin/tabs/activity/clienterrors/ClientErrorsModel.ts +23 -4
- package/build/types/core/XH.d.ts +4 -4
- package/build/types/core/types/Interfaces.d.ts +9 -0
- package/core/XH.ts +12 -4
- package/core/types/Interfaces.ts +11 -0
- package/desktop/appcontainer/ExceptionDialog.ts +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
### 🎁 New Features
|
|
6
6
|
|
|
7
|
-
*
|
|
8
|
-
use-cases.
|
|
9
|
-
*
|
|
10
|
-
|
|
7
|
+
* Modified `TabContainerModel` to make more methods `protected`, improving extensibility for
|
|
8
|
+
advanced use-cases.
|
|
9
|
+
* Enhanced `XH.reloadApp` with new argument to clear query parameters before loading.
|
|
10
|
+
* Enhanced exception handling in `FetchService` to capture messages returned as raw strings, or
|
|
11
|
+
without explicit names.
|
|
12
|
+
* Added dedicated columns to the Admin Console "Client Errors" tab for error names and messages.
|
|
11
13
|
|
|
12
14
|
### 🐞 Bug Fixes
|
|
13
15
|
|
|
@@ -9,7 +9,7 @@ import * as Col from '@xh/hoist/admin/columns';
|
|
|
9
9
|
import {FilterChooserModel} from '@xh/hoist/cmp/filter';
|
|
10
10
|
import {FormModel} from '@xh/hoist/cmp/form';
|
|
11
11
|
import {GridModel} from '@xh/hoist/cmp/grid';
|
|
12
|
-
import {HoistModel, LoadSpec, managed, XH} from '@xh/hoist/core';
|
|
12
|
+
import {HoistModel, LoadSpec, managed, PlainObject, XH} from '@xh/hoist/core';
|
|
13
13
|
import {StoreRecord} from '@xh/hoist/data';
|
|
14
14
|
import {fmtJson} from '@xh/hoist/format';
|
|
15
15
|
import {action, bindable, comparer, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
@@ -62,6 +62,14 @@ export class ClientErrorsModel extends HoistModel {
|
|
|
62
62
|
{...Col.appVersion},
|
|
63
63
|
{...Col.appEnvironment},
|
|
64
64
|
{...Col.msg, displayName: 'User Message', hidden},
|
|
65
|
+
{
|
|
66
|
+
field: {name: 'errorName', type: 'string'},
|
|
67
|
+
autosizeMaxWidth: 400
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
field: {name: 'errorMessage', type: 'string'},
|
|
71
|
+
autosizeMaxWidth: 400
|
|
72
|
+
},
|
|
65
73
|
{...Col.error, hidden},
|
|
66
74
|
{...Col.url},
|
|
67
75
|
{...Col.correlationId},
|
|
@@ -119,18 +127,29 @@ export class ClientErrorsModel extends HoistModel {
|
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
override async doLoadAsync(loadSpec: LoadSpec) {
|
|
122
|
-
const {gridModel} = this;
|
|
130
|
+
const {query, gridModel} = this;
|
|
123
131
|
|
|
124
132
|
try {
|
|
125
|
-
const data = await XH.fetchService.postJson({
|
|
133
|
+
const data: PlainObject[] = await XH.fetchService.postJson({
|
|
126
134
|
url: 'clientErrorAdmin',
|
|
127
|
-
body:
|
|
135
|
+
body: query,
|
|
128
136
|
loadSpec
|
|
129
137
|
});
|
|
130
138
|
|
|
139
|
+
// Parse name + message from JSON-serialized error object out to top-level properties.
|
|
140
|
+
data.forEach(it => {
|
|
141
|
+
try {
|
|
142
|
+
const error = JSON.parse(it.error);
|
|
143
|
+
it.errorName = error?.name;
|
|
144
|
+
it.errorMessage = error?.message;
|
|
145
|
+
} catch (ignored) {}
|
|
146
|
+
});
|
|
147
|
+
|
|
131
148
|
gridModel.loadData(data);
|
|
132
149
|
await gridModel.preSelectFirstAsync();
|
|
133
150
|
} catch (e) {
|
|
151
|
+
if (loadSpec.isStale || loadSpec.isAutoRefresh) return;
|
|
152
|
+
|
|
134
153
|
gridModel.clear();
|
|
135
154
|
XH.handleException(e);
|
|
136
155
|
}
|
package/build/types/core/XH.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { AppContainerModel } from '../appcontainer/AppContainerModel';
|
|
|
9
9
|
import { BannerModel } from '../appcontainer/BannerModel';
|
|
10
10
|
import { ToastModel } from '../appcontainer/ToastModel';
|
|
11
11
|
import '../styles/XH.scss';
|
|
12
|
-
import { AppSpec, AppState, AppSuspendData, BannerSpec, ExceptionHandler, ExceptionHandlerOptions, HoistAppModel, HoistException, HoistService, HoistServiceClass, HoistUser, MessageSpec, PageState, PlainObject, SizingMode, TaskObserver, Theme, ToastSpec, TrackOptions } from './';
|
|
12
|
+
import { AppSpec, AppState, AppSuspendData, BannerSpec, ExceptionHandler, ExceptionHandlerOptions, HoistAppModel, HoistException, HoistService, HoistServiceClass, HoistUser, MessageSpec, PageState, PlainObject, ReloadAppOptions, SizingMode, TaskObserver, Theme, ToastSpec, TrackOptions } from './';
|
|
13
13
|
import { HoistModel, ModelSelector, RefreshContextModel } from './model';
|
|
14
14
|
export declare const MIN_HOIST_CORE_VERSION = "28.0";
|
|
15
15
|
/**
|
|
@@ -193,13 +193,13 @@ export declare class XHApi {
|
|
|
193
193
|
/**
|
|
194
194
|
* Trigger a full reload of the current application.
|
|
195
195
|
*
|
|
196
|
-
* @param
|
|
197
|
-
*
|
|
196
|
+
* @param opts - options to govern reload. To support legacy usages, a provided
|
|
197
|
+
* string will be treated as `ReloadAppOptions.path`.
|
|
198
198
|
*
|
|
199
199
|
* This method will reload the entire application document in the browser - to trigger a
|
|
200
200
|
* refresh of the loadable content within the app, use {@link refreshAppAsync} instead.
|
|
201
201
|
*/
|
|
202
|
-
reloadApp(
|
|
202
|
+
reloadApp(opts?: ReloadAppOptions | string): void;
|
|
203
203
|
/**
|
|
204
204
|
* Refresh the current application.
|
|
205
205
|
*
|
|
@@ -19,6 +19,15 @@ export interface HoistUser {
|
|
|
19
19
|
hasRole(s: string): boolean;
|
|
20
20
|
hasGate(s: string): boolean;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Options governing XH.reloadApp().
|
|
24
|
+
*/
|
|
25
|
+
export interface ReloadAppOptions {
|
|
26
|
+
/** Relative path to reload (e.g. 'mobile/'). Defaults to the existing location pathname. */
|
|
27
|
+
path?: string;
|
|
28
|
+
/** Should the query parameters be removed from the url before reload. Default false. */
|
|
29
|
+
removeQueryParams?: boolean;
|
|
30
|
+
}
|
|
22
31
|
/**
|
|
23
32
|
* Options for showing a "toast" notification that appears and then automatically dismisses.
|
|
24
33
|
*/
|
package/core/XH.ts
CHANGED
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
MessageSpec,
|
|
55
55
|
PageState,
|
|
56
56
|
PlainObject,
|
|
57
|
+
ReloadAppOptions,
|
|
57
58
|
SizingMode,
|
|
58
59
|
TaskObserver,
|
|
59
60
|
Theme,
|
|
@@ -392,18 +393,25 @@ export class XHApi {
|
|
|
392
393
|
/**
|
|
393
394
|
* Trigger a full reload of the current application.
|
|
394
395
|
*
|
|
395
|
-
* @param
|
|
396
|
-
*
|
|
396
|
+
* @param opts - options to govern reload. To support legacy usages, a provided
|
|
397
|
+
* string will be treated as `ReloadAppOptions.path`.
|
|
397
398
|
*
|
|
398
399
|
* This method will reload the entire application document in the browser - to trigger a
|
|
399
400
|
* refresh of the loadable content within the app, use {@link refreshAppAsync} instead.
|
|
400
401
|
*/
|
|
401
402
|
@action
|
|
402
|
-
reloadApp(
|
|
403
|
+
reloadApp(opts?: ReloadAppOptions | string) {
|
|
403
404
|
never().linkTo(this.appLoadModel);
|
|
405
|
+
|
|
406
|
+
opts = isString(opts) ? {path: opts} : (opts ?? {});
|
|
407
|
+
|
|
404
408
|
const {location} = window,
|
|
405
|
-
href =
|
|
409
|
+
href = opts.path
|
|
410
|
+
? `${location.origin}/${opts.path.replace(/^\/+/, '')}`
|
|
411
|
+
: location.href,
|
|
406
412
|
url = new URL(href);
|
|
413
|
+
|
|
414
|
+
if (opts.removeQueryParams) url.search = '';
|
|
407
415
|
// Add a unique query param to force a full reload without using the browser cache.
|
|
408
416
|
url.searchParams.set('xhCacheBuster', Date.now().toString());
|
|
409
417
|
document.location.assign(url);
|
package/core/types/Interfaces.ts
CHANGED
|
@@ -28,6 +28,17 @@ export interface HoistUser {
|
|
|
28
28
|
hasGate(s: string): boolean;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Options governing XH.reloadApp().
|
|
33
|
+
*/
|
|
34
|
+
export interface ReloadAppOptions {
|
|
35
|
+
/** Relative path to reload (e.g. 'mobile/'). Defaults to the existing location pathname. */
|
|
36
|
+
path?: string;
|
|
37
|
+
|
|
38
|
+
/** Should the query parameters be removed from the url before reload. Default false. */
|
|
39
|
+
removeQueryParams?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
/**
|
|
32
43
|
* Options for showing a "toast" notification that appears and then automatically dismisses.
|
|
33
44
|
*/
|
|
@@ -79,7 +79,7 @@ export const dismissButton = hoistCmp.factory<ExceptionDialogModel>(({model}) =>
|
|
|
79
79
|
icon: Icon.refresh(),
|
|
80
80
|
text: 'Reload App',
|
|
81
81
|
autoFocus: true,
|
|
82
|
-
onClick: () => XH.reloadApp()
|
|
82
|
+
onClick: () => XH.reloadApp({removeQueryParams: true})
|
|
83
83
|
})
|
|
84
84
|
: button({
|
|
85
85
|
text: 'Close',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "73.0.0-SNAPSHOT.
|
|
3
|
+
"version": "73.0.0-SNAPSHOT.1741804543922",
|
|
4
4
|
"description": "Hoist add-on for building and deploying React Applications.",
|
|
5
5
|
"repository": "github:xh/hoist-react",
|
|
6
6
|
"homepage": "https://xh.io",
|