@xh/hoist 76.0.0-SNAPSHOT.1758211176948 → 76.0.0-SNAPSHOT.1758215282397
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 +7 -1
- package/admin/tabs/userData/roles/graph/RoleGraph.ts +2 -1
- package/appcontainer/AppContainerModel.ts +2 -1
- package/build/types/core/XH.d.ts +13 -0
- package/build/types/core/types/Types.d.ts +10 -0
- package/build/types/utils/js/LangUtils.d.ts +2 -3
- package/build/types/utils/js/index.d.ts +0 -2
- package/build/types/utils/{js → log}/LogUtils.d.ts +28 -11
- package/build/types/utils/log/index.d.ts +1 -0
- package/build/types/utils/version/index.d.ts +1 -0
- package/cmp/ag-grid/AgGrid.ts +1 -1
- package/cmp/chart/Chart.ts +2 -1
- package/cmp/chart/impl/ChartContextMenuItems.ts +1 -1
- package/cmp/grid/columns/Column.ts +2 -1
- package/cmp/grid/helpers/GridCountLabel.ts +2 -1
- package/cmp/grid/impl/ColumnWidthCalculator.ts +2 -1
- package/cmp/grid/impl/Utils.ts +2 -1
- package/cmp/relativetimestamp/RelativeTimestamp.ts +2 -1
- package/cmp/treemap/TreeMap.ts +2 -1
- package/core/HoistBase.ts +2 -3
- package/core/HoistBaseDecorators.ts +2 -1
- package/core/HoistComponent.ts +9 -6
- package/core/XH.ts +20 -0
- package/core/exception/ExceptionHandler.ts +3 -2
- package/core/load/LoadSupport.ts +3 -2
- package/core/persist/PersistenceProvider.ts +2 -1
- package/core/types/Types.ts +6 -0
- package/data/filter/Utils.ts +2 -1
- package/data/impl/RecordSet.ts +2 -1
- package/desktop/cmp/button/grid/ColAutosizeButton.ts +2 -1
- package/desktop/cmp/button/grid/ColChooserButton.ts +2 -1
- package/desktop/cmp/button/grid/ExpandToLevelButton.ts +2 -1
- package/desktop/cmp/button/grid/ExportButton.ts +2 -1
- package/desktop/cmp/button/panel/ModalToggleButton.ts +2 -1
- package/desktop/cmp/button/zoneGrid/ZoneMapperButton.ts +2 -1
- package/desktop/cmp/dash/container/impl/DashContainerUtils.ts +4 -3
- package/desktop/cmp/form/FormField.ts +2 -1
- package/desktop/cmp/grid/editors/BooleanEditor.ts +1 -1
- package/desktop/cmp/panel/Panel.ts +1 -1
- package/desktop/hooks/UseContextMenu.ts +1 -1
- package/inspector/instances/InstancesModel.ts +2 -2
- package/kit/ag-grid/index.ts +3 -2
- package/kit/highcharts/index.ts +3 -2
- package/mobile/cmp/button/grid/ColAutosizeButton.ts +2 -1
- package/mobile/cmp/button/grid/ColChooserButton.ts +2 -1
- package/mobile/cmp/button/grid/ExpandCollapseButton.ts +2 -1
- package/mobile/cmp/button/grid/ExpandToLevelButton.ts +2 -1
- package/mobile/cmp/button/zoneGrid/ZoneMapperButton.ts +2 -1
- package/mobile/cmp/panel/Panel.ts +1 -1
- package/mobx/overrides.ts +1 -1
- package/package.json +1 -1
- package/security/BaseOAuthClient.ts +2 -1
- package/security/msal/MsalClient.ts +2 -1
- package/svc/ChangelogService.ts +1 -1
- package/svc/EnvironmentService.ts +2 -1
- package/svc/FetchService.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/async/Timer.ts +2 -1
- package/utils/js/Decorators.ts +1 -1
- package/utils/js/LangUtils.ts +3 -4
- package/utils/js/index.ts +0 -2
- package/utils/{js → log}/LogUtils.ts +85 -16
- package/utils/log/index.ts +8 -0
- package/utils/version/index.ts +8 -0
- /package/build/types/utils/{js → version}/VersionUtils.d.ts +0 -0
- /package/utils/{js → version}/VersionUtils.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
## 76.0.0-SNAPSHOT - unreleased
|
|
4
4
|
|
|
5
5
|
### 💥 Breaking Changes (upgrade difficulty: 🟢 LOW - upgrade to Hoist Core, change to Tab constructor)
|
|
6
|
-
*
|
|
6
|
+
* The constructor for `TabModel` has changed to take its owning container as a second argument.
|
|
7
7
|
(Most applications do not create `TabModels` directly, but it is possible.)
|
|
8
|
+
* `checkVersion` and related methods' import path has changed. Update imports from
|
|
9
|
+
`@xh/hoist/utils/js/VersionUtils` to `@xh/hoist/utils/version`; (Unlikely to affect most apps.)
|
|
8
10
|
|
|
9
11
|
### 🎁 New Features
|
|
10
12
|
|
|
@@ -36,6 +38,10 @@
|
|
|
36
38
|
|
|
37
39
|
### ⚙️ Technical
|
|
38
40
|
|
|
41
|
+
* Added `XH.logLevel` to define a minimum logging severity threshold for Hoist's client-side logging
|
|
42
|
+
utilities. Defaulted to 'info' to prevent possible memory and performance impacts of verbose
|
|
43
|
+
logging on 'debug'. Change at runtime via new `XH.setLogLevel()` when troubleshooting. See
|
|
44
|
+
`LogUtils.ts` for more info.
|
|
39
45
|
* Added control to trigger browser GC from app footer. Useful for troubleshooting memory issues.
|
|
40
46
|
Requires running chromium-based browser via e.g. `start chrome --js-flags="--expose-gc`.
|
|
41
47
|
|
|
@@ -14,7 +14,8 @@ import {panel} from '@xh/hoist/desktop/cmp/panel';
|
|
|
14
14
|
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
|
|
15
15
|
import {Icon} from '@xh/hoist/icon';
|
|
16
16
|
import {Highcharts} from '@xh/hoist/kit/highcharts';
|
|
17
|
-
import {
|
|
17
|
+
import {pluralize} from '@xh/hoist/utils/js';
|
|
18
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
18
19
|
import {isEmpty} from 'lodash';
|
|
19
20
|
import {RoleModel} from '../RoleModel';
|
|
20
21
|
import {RoleGraphModel} from './RoleGraphModel';
|
|
@@ -40,7 +40,8 @@ import {
|
|
|
40
40
|
TrackService,
|
|
41
41
|
WebSocketService
|
|
42
42
|
} from '@xh/hoist/svc';
|
|
43
|
-
import {checkMinVersion
|
|
43
|
+
import {checkMinVersion} from '@xh/hoist/utils/version';
|
|
44
|
+
import {createSingleton, throwIf} from '@xh/hoist/utils/js';
|
|
44
45
|
import {compact, isEmpty} from 'lodash';
|
|
45
46
|
import {AboutDialogModel} from './AboutDialogModel';
|
|
46
47
|
import {BannerSourceModel} from './BannerSourceModel';
|
package/build/types/core/XH.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { RouterModel } from '@xh/hoist/appcontainer/RouterModel';
|
|
|
2
2
|
import { HoistAuthModel } from '@xh/hoist/core/HoistAuthModel';
|
|
3
3
|
import { Store } from '@xh/hoist/data';
|
|
4
4
|
import { AlertBannerService, AutoRefreshService, ChangelogService, ConfigService, EnvironmentService, FetchOptions, FetchService, GridAutosizeService, GridExportService, IdentityService, IdleService, InspectorService, JsonBlobService, LocalStorageService, PrefService, SessionStorageService, TrackService, WebSocketService, ClientHealthService } from '@xh/hoist/svc';
|
|
5
|
+
import type { LogLevel } from './types/Types';
|
|
5
6
|
import { Router, State } from 'router5';
|
|
6
7
|
import { CancelFn } from 'router5/types/types/base';
|
|
7
8
|
import { SetOptional } from 'type-fest';
|
|
@@ -177,6 +178,18 @@ export declare class XHApi {
|
|
|
177
178
|
* @see HoistAuthModel.logoutAsync
|
|
178
179
|
*/
|
|
179
180
|
logoutAsync(): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Current minimum severity for Hoist log utils (default 'info').
|
|
183
|
+
* Messages logged via managed Hoist log utils with lower severity will be ignored.
|
|
184
|
+
*/
|
|
185
|
+
get logLevel(): LogLevel;
|
|
186
|
+
/**
|
|
187
|
+
* Set the minimum severity for Hoist log utils until the page is refreshed. Optionally persist
|
|
188
|
+
* this adjustment to sessionStorage to maintain for the lifetime of the browser tab.
|
|
189
|
+
*
|
|
190
|
+
* Hint: call this method from the console to adjust your app's log level while troubleshooting.
|
|
191
|
+
*/
|
|
192
|
+
setLogLevel(level: LogLevel, persistInSessionStorage?: boolean): void;
|
|
180
193
|
/**
|
|
181
194
|
* Main entry point to start the client app - initializes and renders application code.
|
|
182
195
|
* Call from the app's entry-point file within your project's `/client-app/src/apps/` folder.
|
|
@@ -66,3 +66,13 @@ export type PageState =
|
|
|
66
66
|
* The page is in the process of being unloaded by the browser (this is a terminal state x_x).
|
|
67
67
|
*/
|
|
68
68
|
| 'terminated';
|
|
69
|
+
/** Severity Level for log statement */
|
|
70
|
+
export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
71
|
+
/** Object identifying the source of log statement. Typically, a javascript class */
|
|
72
|
+
export type LogSource = string | {
|
|
73
|
+
displayName: string;
|
|
74
|
+
} | {
|
|
75
|
+
constructor: {
|
|
76
|
+
name: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Thunkable } from '@xh/hoist/core';
|
|
2
|
-
import { LogSource } from '@xh/hoist/utils/js/LogUtils';
|
|
1
|
+
import type { Thunkable, LogSource } from '@xh/hoist/core';
|
|
3
2
|
/**
|
|
4
3
|
* Get a cached value on an object, creating it if it does not yet exist.
|
|
5
4
|
*
|
|
@@ -65,7 +64,7 @@ export interface APIWarnOptions {
|
|
|
65
64
|
v?: string;
|
|
66
65
|
/** An additional message. Can contain suggestions for alternatives. */
|
|
67
66
|
msg?: string;
|
|
68
|
-
/** Source of message for
|
|
67
|
+
/** Source of message for labeling log message. */
|
|
69
68
|
source?: LogSource;
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
import { Some } from '@xh/hoist/core';
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { Some, LogLevel, LogSource } from '@xh/hoist/core';
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions providing managed, structured logging to Hoist apps.
|
|
4
|
+
*
|
|
5
|
+
* Essentially a wrapper around the browser console supporting logging levels, timing, and
|
|
6
|
+
* miscellaneous Hoist display conventions.
|
|
7
|
+
*
|
|
8
|
+
* Objects extending `HoistBase` need not import these functions directly, as they are available
|
|
9
|
+
* via delegates on `HoistBase`.
|
|
10
|
+
*
|
|
11
|
+
* Hoist sets its minimum severity level to 'info' by default. This prevents performance or
|
|
12
|
+
* memory impacts that might result from verbose debug logging. This can be adjusted by calling
|
|
13
|
+
* XH.logLevel from the console.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Current minimum severity for Hoist log utils (default 'info').
|
|
17
|
+
* Messages logged via managed Hoist log utils with lower severity will be ignored.
|
|
18
|
+
*
|
|
19
|
+
* @internal - use public `XH.logLevel`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getLogLevel(): LogLevel;
|
|
22
|
+
/**
|
|
23
|
+
* Set the minimum severity for Hoist log utils until the page is refreshed. Optionally persist
|
|
24
|
+
* this adjustment to sessionStorage to maintain for the lifetime of the browser tab.
|
|
25
|
+
*
|
|
26
|
+
* @internal - use public `XH.setLogLevel()`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setLogLevel(level: LogLevel, persistInSessionStorage?: boolean): void;
|
|
10
29
|
/**
|
|
11
30
|
* Time and log execution of a function to `console.info()`.
|
|
12
31
|
*
|
|
@@ -51,5 +70,3 @@ export declare function logError(msgs: Some<unknown>, source?: LogSource): unkno
|
|
|
51
70
|
* @param source - class, function or string to label the source of the message
|
|
52
71
|
*/
|
|
53
72
|
export declare function logWarn(msgs: Some<unknown>, source?: LogSource): unknown;
|
|
54
|
-
/** Parse a LogSource in to a canonical string label. */
|
|
55
|
-
export declare function parseSource(source: LogSource): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LogUtils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VersionUtils';
|
package/cmp/ag-grid/AgGrid.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
XH
|
|
19
19
|
} from '@xh/hoist/core';
|
|
20
20
|
import {AgGridReact, GridOptions} from '@xh/hoist/kit/ag-grid';
|
|
21
|
-
import {logError} from '@xh/hoist/utils/
|
|
21
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
22
22
|
import {splitLayoutProps} from '@xh/hoist/utils/react';
|
|
23
23
|
import classNames from 'classnames';
|
|
24
24
|
import {isNil} from 'lodash';
|
package/cmp/chart/Chart.ts
CHANGED
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
import {useContextMenu} from '@xh/hoist/dynamics/desktop';
|
|
22
22
|
import {Highcharts} from '@xh/hoist/kit/highcharts';
|
|
23
23
|
import {runInAction} from '@xh/hoist/mobx';
|
|
24
|
-
import {
|
|
24
|
+
import {mergeDeep} from '@xh/hoist/utils/js';
|
|
25
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
25
26
|
import {
|
|
26
27
|
createObservableRef,
|
|
27
28
|
getLayoutProps,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
import type {ChartMenuContext, ChartMenuToken} from '@xh/hoist/cmp/chart/Types';
|
|
8
|
-
import {logWarn} from '@xh/hoist/utils/
|
|
8
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
9
9
|
import {cloneDeep, isEmpty, isString} from 'lodash';
|
|
10
10
|
import {ChartModel} from '@xh/hoist/cmp/chart';
|
|
11
11
|
import {isMenuItem, type MenuItem, type MenuItemLike} from '@xh/hoist/core';
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
RecordActionSpec,
|
|
16
16
|
StoreRecord
|
|
17
17
|
} from '@xh/hoist/data';
|
|
18
|
-
import {logDebug, logWarn
|
|
18
|
+
import {logDebug, logWarn} from '@xh/hoist/utils/log';
|
|
19
|
+
import {throwIf, warnIf, withDefault} from '@xh/hoist/utils/js';
|
|
19
20
|
import classNames from 'classnames';
|
|
20
21
|
import {
|
|
21
22
|
castArray,
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import {box} from '@xh/hoist/cmp/layout';
|
|
8
8
|
import {BoxProps, hoistCmp, HoistProps, useContextModel} from '@xh/hoist/core';
|
|
9
9
|
import {fmtNumber} from '@xh/hoist/format';
|
|
10
|
-
import {
|
|
10
|
+
import {pluralize, singularize, withDefault} from '@xh/hoist/utils/js';
|
|
11
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
11
12
|
import {GridModel} from '../GridModel';
|
|
12
13
|
|
|
13
14
|
export interface GridCountLabelProps extends HoistProps, BoxProps {
|
|
@@ -9,7 +9,8 @@ import {GridAutosizeOptions} from '@xh/hoist/cmp/grid/GridAutosizeOptions';
|
|
|
9
9
|
import {XH} from '@xh/hoist/core';
|
|
10
10
|
import {CompoundFilter, FieldFilter, Filter, StoreRecord} from '@xh/hoist/data';
|
|
11
11
|
import {forEachAsync} from '@xh/hoist/utils/async';
|
|
12
|
-
import {logWarn
|
|
12
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
13
|
+
import {stripTags} from '@xh/hoist/utils/js';
|
|
13
14
|
import {
|
|
14
15
|
forOwn,
|
|
15
16
|
groupBy,
|
package/cmp/grid/impl/Utils.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {Column, ColumnGroup, ColumnRenderer, GroupRowRenderer} from '@xh/hoist/cmp/grid';
|
|
8
8
|
import {HeaderClassParams} from '@xh/hoist/kit/ag-grid';
|
|
9
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
9
10
|
import {castArray, isFunction} from 'lodash';
|
|
10
11
|
|
|
11
12
|
/** @internal */
|
|
@@ -18,7 +19,7 @@ export function managedRenderer<T extends ColumnRenderer | GroupRowRenderer>(
|
|
|
18
19
|
try {
|
|
19
20
|
return fn.apply(null, arguments);
|
|
20
21
|
} catch (e) {
|
|
21
|
-
|
|
22
|
+
logWarn([`Renderer for '${identifier}' has thrown an error`, e]);
|
|
22
23
|
return '#ERROR';
|
|
23
24
|
}
|
|
24
25
|
} as unknown as T;
|
|
@@ -21,7 +21,8 @@ import {fmtCompactDate, fmtDateTime} from '@xh/hoist/format';
|
|
|
21
21
|
import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
22
22
|
import {Timer} from '@xh/hoist/utils/async';
|
|
23
23
|
import {DAYS, HOURS, LocalDate, SECONDS} from '@xh/hoist/utils/datetime';
|
|
24
|
-
import {
|
|
24
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
25
|
+
import {apiDeprecated, withDefault} from '@xh/hoist/utils/js';
|
|
25
26
|
|
|
26
27
|
interface RelativeTimestampProps extends HoistProps, BoxProps, RelativeTimestampOptions {
|
|
27
28
|
/**
|
package/cmp/treemap/TreeMap.ts
CHANGED
|
@@ -21,7 +21,8 @@ import {errorMessage} from '@xh/hoist/cmp/error';
|
|
|
21
21
|
import {mask} from '@xh/hoist/cmp/mask';
|
|
22
22
|
import {Highcharts} from '@xh/hoist/kit/highcharts';
|
|
23
23
|
import {wait} from '@xh/hoist/promise';
|
|
24
|
-
import {
|
|
24
|
+
import {logWithDebug} from '@xh/hoist/utils/js';
|
|
25
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
25
26
|
import {
|
|
26
27
|
createObservableRef,
|
|
27
28
|
getLayoutProps,
|
package/core/HoistBase.ts
CHANGED
|
@@ -13,16 +13,15 @@ import {
|
|
|
13
13
|
runInAction,
|
|
14
14
|
when as mobxWhen
|
|
15
15
|
} from '@xh/hoist/mobx';
|
|
16
|
+
import {getOrCreate, throwIf} from '@xh/hoist/utils/js';
|
|
16
17
|
import {
|
|
17
|
-
getOrCreate,
|
|
18
18
|
logDebug,
|
|
19
19
|
logError,
|
|
20
20
|
logInfo,
|
|
21
21
|
logWarn,
|
|
22
|
-
throwIf,
|
|
23
22
|
withDebug,
|
|
24
23
|
withInfo
|
|
25
|
-
} from '@xh/hoist/utils/
|
|
24
|
+
} from '@xh/hoist/utils/log/LogUtils';
|
|
26
25
|
import {
|
|
27
26
|
debounce as lodashDebounce,
|
|
28
27
|
isFunction,
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {wait} from '@xh/hoist/promise';
|
|
8
8
|
import {observable} from 'mobx';
|
|
9
|
-
import {logError
|
|
9
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
10
|
+
import {throwIf} from '../utils/js';
|
|
10
11
|
import {HoistBaseClass, PersistableState, PersistenceProvider, PersistOptions} from './';
|
|
11
12
|
|
|
12
13
|
/**
|
package/core/HoistComponent.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
HoistModel
|
|
27
27
|
} from './model';
|
|
28
28
|
import {throwIf, warnIf, withDefault} from '@xh/hoist/utils/js';
|
|
29
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
29
30
|
import {getLayoutProps, useOnMount, useOnUnmount} from '@xh/hoist/utils/react';
|
|
30
31
|
import classNames from 'classnames';
|
|
31
32
|
import {isFunction, isPlainObject, isObject} from 'lodash';
|
|
@@ -285,9 +286,10 @@ function wrapWithModel(render: RenderFn, cfg: Config): RenderFn {
|
|
|
285
286
|
|
|
286
287
|
// 2) Validate
|
|
287
288
|
if (!model && !spec.optional && spec instanceof UsesSpec) {
|
|
288
|
-
|
|
289
|
-
`Failed to find model with selector '${formatSelector(spec.selector)}
|
|
290
|
-
proper model is available via context, or specify using the 'model' prop
|
|
289
|
+
logError(
|
|
290
|
+
`Failed to find model with selector '${formatSelector(spec.selector)}'. Ensure the
|
|
291
|
+
proper model is available via context, or specify using the 'model' prop.`,
|
|
292
|
+
cfg.displayName
|
|
291
293
|
);
|
|
292
294
|
return cmpErrDisplay({...getLayoutProps(props), item: 'No model found'});
|
|
293
295
|
}
|
|
@@ -407,10 +409,11 @@ function lookupModel(props: HoistProps, modelLookup: ModelLookup, cfg: Config):
|
|
|
407
409
|
// 2) props - instance
|
|
408
410
|
if (model) {
|
|
409
411
|
if (!model.isHoistModel || !model.matchesSelector(selector, true)) {
|
|
410
|
-
|
|
411
|
-
`Incorrect model passed
|
|
412
|
+
logError(
|
|
413
|
+
`Incorrect model passed.
|
|
412
414
|
Expected: ${formatSelector(selector)}
|
|
413
|
-
Received: ${model.constructor.name}
|
|
415
|
+
Received: ${model.constructor.name}`,
|
|
416
|
+
cfg.displayName
|
|
414
417
|
);
|
|
415
418
|
model = null;
|
|
416
419
|
}
|
package/core/XH.ts
CHANGED
|
@@ -31,6 +31,8 @@ import {
|
|
|
31
31
|
WebSocketService,
|
|
32
32
|
ClientHealthService
|
|
33
33
|
} from '@xh/hoist/svc';
|
|
34
|
+
import type {LogLevel} from './types/Types';
|
|
35
|
+
import {getLogLevel, setLogLevel} from '@xh/hoist/utils/log';
|
|
34
36
|
import {camelCase, flatten, isString, uniqueId} from 'lodash';
|
|
35
37
|
import {Router, State} from 'router5';
|
|
36
38
|
import {CancelFn} from 'router5/types/types/base';
|
|
@@ -360,6 +362,24 @@ export class XHApi {
|
|
|
360
362
|
this.reloadApp();
|
|
361
363
|
}
|
|
362
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Current minimum severity for Hoist log utils (default 'info').
|
|
367
|
+
* Messages logged via managed Hoist log utils with lower severity will be ignored.
|
|
368
|
+
*/
|
|
369
|
+
get logLevel(): LogLevel {
|
|
370
|
+
return getLogLevel();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Set the minimum severity for Hoist log utils until the page is refreshed. Optionally persist
|
|
375
|
+
* this adjustment to sessionStorage to maintain for the lifetime of the browser tab.
|
|
376
|
+
*
|
|
377
|
+
* Hint: call this method from the console to adjust your app's log level while troubleshooting.
|
|
378
|
+
*/
|
|
379
|
+
setLogLevel(level: LogLevel, persistInSessionStorage: boolean = false) {
|
|
380
|
+
setLogLevel(level, persistInSessionStorage);
|
|
381
|
+
}
|
|
382
|
+
|
|
363
383
|
//----------------------
|
|
364
384
|
// App lifecycle support
|
|
365
385
|
//----------------------
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {Exception} from './Exception';
|
|
8
8
|
import {fragment, span} from '@xh/hoist/cmp/layout';
|
|
9
|
-
import {
|
|
9
|
+
import {stripTags} from '@xh/hoist/utils/js';
|
|
10
|
+
import {logDebug, logError, logWarn} from '@xh/hoist/utils/log';
|
|
10
11
|
import {Icon} from '@xh/hoist/icon';
|
|
11
12
|
import {forOwn, has, isArray, isNil, isObject, omitBy, pick, set} from 'lodash';
|
|
12
13
|
import {HoistException, PlainObject, XH} from '../';
|
|
@@ -312,7 +313,7 @@ export class ExceptionHandler {
|
|
|
312
313
|
}
|
|
313
314
|
|
|
314
315
|
private logException(e: HoistException, opts: ExceptionHandlerOptions) {
|
|
315
|
-
return opts.showAsError ?
|
|
316
|
+
return opts.showAsError ? logError([opts.message, e], this) : logDebug(opts.message, this);
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
private parseOptions(
|
package/core/load/LoadSupport.ts
CHANGED
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
} from '../';
|
|
15
15
|
import {LoadSpec, Loadable} from './';
|
|
16
16
|
import {makeObservable, observable, runInAction} from '@xh/hoist/mobx';
|
|
17
|
-
import {
|
|
17
|
+
import {throwIf} from '@xh/hoist/utils/js';
|
|
18
|
+
import {logDebug, logError} from '@xh/hoist/utils/log';
|
|
18
19
|
import {isPlainObject, pull} from 'lodash';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -135,7 +136,7 @@ export async function loadAllAsync(objs: Loadable[], loadSpec?: LoadSpec | any)
|
|
|
135
136
|
ret = await Promise.allSettled(promises);
|
|
136
137
|
|
|
137
138
|
ret.filter(it => it.status === 'rejected').forEach((err: any) =>
|
|
138
|
-
|
|
139
|
+
logError(['Failed to Load Object', err.reason])
|
|
139
140
|
);
|
|
140
141
|
|
|
141
142
|
return ret;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import {olderThan} from '@xh/hoist/utils/datetime';
|
|
9
|
-
import {logDebug, logError
|
|
9
|
+
import {logDebug, logError} from '@xh/hoist/utils/log';
|
|
10
|
+
import {throwIf} from '@xh/hoist/utils/js';
|
|
10
11
|
import {
|
|
11
12
|
cloneDeep,
|
|
12
13
|
compact,
|
package/core/types/Types.ts
CHANGED
|
@@ -86,3 +86,9 @@ export type PageState =
|
|
|
86
86
|
* The page is in the process of being unloaded by the browser (this is a terminal state x_x).
|
|
87
87
|
*/
|
|
88
88
|
| 'terminated';
|
|
89
|
+
|
|
90
|
+
/** Severity Level for log statement */
|
|
91
|
+
export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
92
|
+
|
|
93
|
+
/** Object identifying the source of log statement. Typically, a javascript class */
|
|
94
|
+
export type LogSource = string | {displayName: string} | {constructor: {name: string}};
|
package/data/filter/Utils.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import {Some} from '@xh/hoist/core';
|
|
9
9
|
import {CompoundFilter, FunctionFilter} from '@xh/hoist/data';
|
|
10
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
10
11
|
import {castArray, flatMap, groupBy, isArray, isFunction} from 'lodash';
|
|
11
12
|
import {FieldFilter} from './FieldFilter';
|
|
12
13
|
import {Filter} from './Filter';
|
|
@@ -55,7 +56,7 @@ export function parseFilter(spec: FilterLike): Filter {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
logError(['Unable to identify filter type:', s]);
|
|
59
60
|
return null;
|
|
60
61
|
}
|
|
61
62
|
|
package/data/impl/RecordSet.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import equal from 'fast-deep-equal';
|
|
9
|
-
import {logWarn
|
|
9
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
10
|
+
import {throwIf} from '@xh/hoist/utils/js';
|
|
10
11
|
import {maxBy, isNil} from 'lodash';
|
|
11
12
|
import {StoreRecord, StoreRecordId} from '../StoreRecord';
|
|
12
13
|
import {Store} from '../Store';
|
|
@@ -8,7 +8,8 @@ import {GridAutosizeOptions, GridModel} from '@xh/hoist/cmp/grid';
|
|
|
8
8
|
import {hoistCmp, useContextModel} from '@xh/hoist/core';
|
|
9
9
|
import '@xh/hoist/desktop/register';
|
|
10
10
|
import {Icon} from '@xh/hoist/icon';
|
|
11
|
-
import {logError
|
|
11
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
12
|
+
import {withDefault} from '@xh/hoist/utils/js';
|
|
12
13
|
import {button, ButtonProps} from '../Button';
|
|
13
14
|
|
|
14
15
|
export interface ColAutosizeButtonProps extends ButtonProps {
|
|
@@ -12,7 +12,8 @@ import {ColChooserModel} from '@xh/hoist/desktop/cmp/grid/impl/colchooser/ColCho
|
|
|
12
12
|
import '@xh/hoist/desktop/register';
|
|
13
13
|
import {Icon} from '@xh/hoist/icon';
|
|
14
14
|
import {popover, Position} from '@xh/hoist/kit/blueprint';
|
|
15
|
-
import {logError
|
|
15
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
16
|
+
import {stopPropagation, withDefault} from '@xh/hoist/utils/js';
|
|
16
17
|
import {button, ButtonProps} from '../Button';
|
|
17
18
|
|
|
18
19
|
export interface ColChooserButtonProps extends ButtonProps {
|
|
@@ -11,7 +11,8 @@ import '@xh/hoist/desktop/register';
|
|
|
11
11
|
import {Icon} from '@xh/hoist/icon';
|
|
12
12
|
import {menu, popover, Position} from '@xh/hoist/kit/blueprint';
|
|
13
13
|
import {parseMenuItems} from '@xh/hoist/utils/impl';
|
|
14
|
-
import {logError
|
|
14
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
15
|
+
import {withDefault} from '@xh/hoist/utils/js';
|
|
15
16
|
import {ReactNode} from 'react';
|
|
16
17
|
import {button, ButtonProps} from '../Button';
|
|
17
18
|
|
|
@@ -9,7 +9,8 @@ import {hoistCmp, useContextModel} from '@xh/hoist/core';
|
|
|
9
9
|
import '@xh/hoist/desktop/register';
|
|
10
10
|
import {Icon} from '@xh/hoist/icon';
|
|
11
11
|
import {ExportOptions} from '@xh/hoist/svc';
|
|
12
|
-
import {logError
|
|
12
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
13
|
+
import {withDefault} from '@xh/hoist/utils/js';
|
|
13
14
|
import {button, ButtonProps} from '../Button';
|
|
14
15
|
|
|
15
16
|
export interface ExportButtonProps extends ButtonProps {
|
|
@@ -9,7 +9,8 @@ import {button, ButtonProps} from '@xh/hoist/desktop/cmp/button/Button';
|
|
|
9
9
|
import {PanelModel} from '@xh/hoist/desktop/cmp/panel';
|
|
10
10
|
import '@xh/hoist/desktop/register';
|
|
11
11
|
import {Icon} from '@xh/hoist/icon';
|
|
12
|
-
import {logError
|
|
12
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
13
|
+
import {withDefault} from '@xh/hoist/utils/js';
|
|
13
14
|
|
|
14
15
|
export interface ModalToggleButtonProps extends ButtonProps {
|
|
15
16
|
panelModel?: PanelModel;
|
|
@@ -12,7 +12,8 @@ import {ZoneMapperModel} from '@xh/hoist/cmp/zoneGrid/impl/ZoneMapperModel';
|
|
|
12
12
|
import {zoneMapper} from '@xh/hoist/desktop/cmp/zoneGrid/impl/ZoneMapper';
|
|
13
13
|
import {Icon} from '@xh/hoist/icon';
|
|
14
14
|
import {popover, Position} from '@xh/hoist/kit/blueprint';
|
|
15
|
-
import {logError
|
|
15
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
16
|
+
import {stopPropagation, withDefault} from '@xh/hoist/utils/js';
|
|
16
17
|
import {button, ButtonProps} from '../Button';
|
|
17
18
|
|
|
18
19
|
export interface ZoneMapperButtonProps extends ButtonProps {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import {PlainObject} from '@xh/hoist/core';
|
|
8
8
|
import {DashContainerModel} from '@xh/hoist/desktop/cmp/dash';
|
|
9
9
|
import {serializeIcon} from '@xh/hoist/icon';
|
|
10
|
+
import {logDebug} from '@xh/hoist/utils/log';
|
|
10
11
|
import {throwIf} from '@xh/hoist/utils/js';
|
|
11
12
|
import {isArray, isEmpty, isFinite, isNil, isPlainObject, isString, round} from 'lodash';
|
|
12
13
|
import {DashContainerViewSpec} from '../DashContainerViewSpec';
|
|
@@ -119,9 +120,9 @@ function convertStateToGLInner(items = [], viewSpecs = [], containerSize, contai
|
|
|
119
120
|
const viewSpec = viewSpecs.find(v => v.id === item.id);
|
|
120
121
|
|
|
121
122
|
if (!viewSpec) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
logDebug(
|
|
124
|
+
`Attempted to load non-existent or omitted view from state: ${item.id}`,
|
|
125
|
+
'DashContainer'
|
|
125
126
|
);
|
|
126
127
|
return null;
|
|
127
128
|
}
|
|
@@ -23,7 +23,8 @@ import {fmtDate, fmtDateTime, fmtJson, fmtNumber} from '@xh/hoist/format';
|
|
|
23
23
|
import {Icon} from '@xh/hoist/icon';
|
|
24
24
|
import {tooltip} from '@xh/hoist/kit/blueprint';
|
|
25
25
|
import {isLocalDate} from '@xh/hoist/utils/datetime';
|
|
26
|
-
import {
|
|
26
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
27
|
+
import {errorIf, getTestId, TEST_ID, throwIf, withDefault} from '@xh/hoist/utils/js';
|
|
27
28
|
import {getLayoutProps, getReactElementName, useOnMount, useOnUnmount} from '@xh/hoist/utils/react';
|
|
28
29
|
import classNames from 'classnames';
|
|
29
30
|
import {isBoolean, isDate, isEmpty, isFinite, isNil, isUndefined, kebabCase} from 'lodash';
|
|
@@ -12,7 +12,7 @@ import '@xh/hoist/desktop/register';
|
|
|
12
12
|
import {EditorProps} from './EditorProps';
|
|
13
13
|
import './Editors.scss';
|
|
14
14
|
import {useInlineEditorModel} from './impl/InlineEditorModel';
|
|
15
|
-
import {logWarn} from '@xh/hoist/utils/
|
|
15
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
16
16
|
|
|
17
17
|
export interface BooleanEditorProps extends EditorProps<CheckboxProps> {
|
|
18
18
|
/**
|
|
@@ -24,7 +24,7 @@ import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
|
|
|
24
24
|
import {useContextMenu, useHotkeys} from '@xh/hoist/desktop/hooks';
|
|
25
25
|
import '@xh/hoist/desktop/register';
|
|
26
26
|
import {HotkeyConfig} from '@xh/hoist/kit/blueprint';
|
|
27
|
-
import {logWarn} from '@xh/hoist/utils/
|
|
27
|
+
import {logWarn} from '@xh/hoist/utils/log';
|
|
28
28
|
import {splitLayoutProps} from '@xh/hoist/utils/react';
|
|
29
29
|
import {castArray, omitBy} from 'lodash';
|
|
30
30
|
import {Children, isValidElement, ReactElement, ReactNode, useLayoutEffect, useRef} from 'react';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type {ContextMenuSpec} from '@xh/hoist/core';
|
|
8
8
|
import {contextMenu} from '@xh/hoist/desktop/cmp/contextmenu/ContextMenu';
|
|
9
9
|
import {showContextMenu} from '@xh/hoist/kit/blueprint';
|
|
10
|
-
import {logError} from '@xh/hoist/utils/
|
|
10
|
+
import {logError} from '@xh/hoist/utils/log';
|
|
11
11
|
import {isArray, isEmpty, isFunction, isUndefined} from 'lodash';
|
|
12
12
|
import {cloneElement, isValidElement, MouseEvent, ReactElement} from 'react';
|
|
13
13
|
|
|
@@ -130,7 +130,7 @@ export class InstancesModel extends HoistModel {
|
|
|
130
130
|
instance = this.getInstance(xhId);
|
|
131
131
|
|
|
132
132
|
if (!instance) {
|
|
133
|
-
|
|
133
|
+
this.logWarn(`Instance with xhId ${xhId} no longer alive - cannot be logged`);
|
|
134
134
|
} else {
|
|
135
135
|
console.log(`[${xhId}]`, instance);
|
|
136
136
|
XH.toast({
|
|
@@ -147,7 +147,7 @@ export class InstancesModel extends HoistModel {
|
|
|
147
147
|
instance = this.getInstance(instanceXhId);
|
|
148
148
|
|
|
149
149
|
if (!instance) {
|
|
150
|
-
|
|
150
|
+
this.logWarn(`Instance ${instanceDisplayName} no longer alive - cannot be logged`);
|
|
151
151
|
} else {
|
|
152
152
|
console.log(`[${instanceDisplayName}].${property}`, instance[property]);
|
|
153
153
|
XH.toast({
|