@xh/hoist 79.0.0-SNAPSHOT.1766104125611 → 79.0.0-SNAPSHOT.1766166832103
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 +4 -0
- package/admin/differ/DifferModel.ts +1 -1
- package/admin/tabs/clients/activity/ClientDetailPanel.ts +1 -1
- package/admin/tabs/cluster/instances/InstancesTabModel.ts +1 -1
- package/admin/tabs/cluster/instances/connpool/ConnPoolMonitorModel.ts +2 -2
- package/admin/tabs/cluster/instances/logs/LogDisplay.ts +1 -1
- package/admin/tabs/cluster/instances/logs/LogDisplayModel.ts +1 -1
- package/admin/tabs/cluster/instances/memory/MemoryMonitorModel.ts +3 -3
- package/admin/tabs/cluster/objects/ClusterObjectsModel.ts +2 -2
- package/admin/tabs/general/alertBanner/AlertBannerModel.ts +1 -1
- package/admin/tabs/userData/roles/RoleModel.ts +1 -1
- package/build/types/core/HoistService.d.ts +3 -2
- package/build/types/core/load/LoadSupport.d.ts +1 -1
- package/build/types/core/load/Loadable.d.ts +2 -2
- package/build/types/core/model/HoistModel.d.ts +3 -2
- package/build/types/data/UrlStore.d.ts +3 -2
- package/build/types/desktop/cmp/rest/impl/RestFormModel.d.ts +3 -2
- package/core/HoistService.ts +10 -2
- package/core/load/LoadSupport.ts +6 -6
- package/core/load/Loadable.ts +2 -2
- package/core/model/HoistModel.ts +10 -3
- package/data/UrlStore.ts +10 -2
- package/desktop/cmp/panel/Panel.ts +3 -3
- package/desktop/cmp/rest/RestGrid.ts +2 -2
- package/desktop/cmp/rest/RestGridModel.ts +2 -2
- package/desktop/cmp/rest/data/RestStore.ts +5 -5
- package/desktop/cmp/rest/impl/RestFormModel.ts +11 -4
- package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +1 -1
- package/desktop/cmp/viewmanager/dialog/ViewPanelModel.ts +1 -1
- package/mobile/cmp/panel/Panel.ts +3 -3
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
### 💥 Breaking Changes
|
|
14
14
|
|
|
15
|
+
* Renamed `LoadSupport.loadModel` to `LoadSupport.loadObserver` for clarity. This property is a
|
|
16
|
+
`TaskObserver` instance, not a `HoistModel`. The getter methods `HoistModel.loadModel` and
|
|
17
|
+
`HoistService.loadModel` remain as aliases but are now deprecated and scheduled for removal in
|
|
18
|
+
v82. Applications should update their code to use `loadObserver` instead of `loadModel`.
|
|
15
19
|
* Renamed `GridModel.applyColumnStateChanges()` to `updateColumnState()` for clarity and better
|
|
16
20
|
symmetry with `setColumnState()`. The prior method remains as an alias but is now deprecated and
|
|
17
21
|
scheduled for removal in v82.
|
|
@@ -229,7 +229,7 @@ export class InstancesTabModel extends HoistModel {
|
|
|
229
229
|
params: {instance: instance.name}
|
|
230
230
|
})
|
|
231
231
|
.finally(() => this.loadAsync())
|
|
232
|
-
.linkTo({observer: this.
|
|
232
|
+
.linkTo({observer: this.loadObserver, message: 'Attempting instance shutdown'})
|
|
233
233
|
.catchDefault();
|
|
234
234
|
}
|
|
235
235
|
|
|
@@ -140,7 +140,7 @@ export class ConnPoolMonitorModel extends BaseInstanceModel {
|
|
|
140
140
|
await XH.fetchJson({
|
|
141
141
|
url: 'connectionPoolMonitorAdmin/takeSnapshot',
|
|
142
142
|
params: {instance: this.instanceName}
|
|
143
|
-
}).linkTo(this.
|
|
143
|
+
}).linkTo(this.loadObserver);
|
|
144
144
|
await this.refreshAsync();
|
|
145
145
|
XH.successToast('Updated snapshot loaded.');
|
|
146
146
|
} catch (e) {
|
|
@@ -153,7 +153,7 @@ export class ConnPoolMonitorModel extends BaseInstanceModel {
|
|
|
153
153
|
await XH.fetchJson({
|
|
154
154
|
url: 'connectionPoolMonitorAdmin/resetStats',
|
|
155
155
|
params: {instance: this.instanceName}
|
|
156
|
-
}).linkTo(this.
|
|
156
|
+
}).linkTo(this.loadObserver);
|
|
157
157
|
await this.refreshAsync();
|
|
158
158
|
XH.successToast('Connection pool stats reset.');
|
|
159
159
|
} catch (e) {
|
|
@@ -203,7 +203,7 @@ export class LogDisplayModel extends HoistModel {
|
|
|
203
203
|
if (
|
|
204
204
|
tailActive &&
|
|
205
205
|
olderThan(this.lastLoadCompleted, 5 * SECONDS) &&
|
|
206
|
-
!this.
|
|
206
|
+
!this.loadObserver.isPending &&
|
|
207
207
|
this.parent.isVisible
|
|
208
208
|
) {
|
|
209
209
|
this.loadLog();
|
|
@@ -61,7 +61,7 @@ export class MemoryMonitorModel extends BaseInstanceModel {
|
|
|
61
61
|
await XH.fetchJson({
|
|
62
62
|
url: 'memoryMonitorAdmin/takeSnapshot',
|
|
63
63
|
params: {instance: this.instanceName}
|
|
64
|
-
}).linkTo(this.
|
|
64
|
+
}).linkTo(this.loadObserver);
|
|
65
65
|
await this.loadAsync();
|
|
66
66
|
XH.successToast('Updated snapshot loaded');
|
|
67
67
|
} catch (e) {
|
|
@@ -74,7 +74,7 @@ export class MemoryMonitorModel extends BaseInstanceModel {
|
|
|
74
74
|
await XH.fetchJson({
|
|
75
75
|
url: 'memoryMonitorAdmin/requestGc',
|
|
76
76
|
params: {instance: this.instanceName}
|
|
77
|
-
}).linkTo(this.
|
|
77
|
+
}).linkTo(this.loadObserver);
|
|
78
78
|
await this.loadAsync();
|
|
79
79
|
XH.successToast('GC run complete');
|
|
80
80
|
} catch (e) {
|
|
@@ -101,7 +101,7 @@ export class MemoryMonitorModel extends BaseInstanceModel {
|
|
|
101
101
|
instance: this.instanceName,
|
|
102
102
|
filename
|
|
103
103
|
}
|
|
104
|
-
}).linkTo(this.
|
|
104
|
+
}).linkTo(this.loadObserver);
|
|
105
105
|
await this.loadAsync();
|
|
106
106
|
XH.successToast('Heap dumped successfully to ' + filename);
|
|
107
107
|
} catch (e) {
|
|
@@ -149,7 +149,7 @@ export class ClusterObjectsModel extends HoistModel {
|
|
|
149
149
|
body: {
|
|
150
150
|
names: cacheRecords.map(it => it.id)
|
|
151
151
|
}
|
|
152
|
-
}).linkTo(this.
|
|
152
|
+
}).linkTo(this.loadObserver);
|
|
153
153
|
|
|
154
154
|
await this.refreshAsync();
|
|
155
155
|
XH.successToast(`${pluralize('Hibernate Cache', count, true)} cleared.`);
|
|
@@ -179,7 +179,7 @@ export class ClusterObjectsModel extends HoistModel {
|
|
|
179
179
|
try {
|
|
180
180
|
await XH.fetchJson({
|
|
181
181
|
url: 'clusterObjectsAdmin/clearAllHibernateCaches'
|
|
182
|
-
}).linkTo(this.
|
|
182
|
+
}).linkTo(this.loadObserver);
|
|
183
183
|
|
|
184
184
|
await this.refreshAsync();
|
|
185
185
|
XH.successToast('All Hibernate Caches cleared.');
|
|
@@ -106,7 +106,7 @@ export class AlertBannerModel extends HoistModel {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
async saveAsync() {
|
|
109
|
-
return this.saveInternalAsync().linkTo(this.
|
|
109
|
+
return this.saveInternalAsync().linkTo(this.loadObserver).catchDefault();
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
resetForm() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HoistBase, LoadSupport, LoadSpec, Loadable, PlainObject } from './';
|
|
1
|
+
import { HoistBase, LoadSupport, LoadSpec, Loadable, PlainObject, TaskObserver } from './';
|
|
2
2
|
/**
|
|
3
3
|
* Core superclass for Services in Hoist. Services are special classes used in both Hoist and
|
|
4
4
|
* application code as centralized points for managing app-wide state and loading / processing
|
|
@@ -42,7 +42,8 @@ export declare class HoistService extends HoistBase implements Loadable {
|
|
|
42
42
|
* `LoadSupport` will automatically be created and installed to support the extensions below.
|
|
43
43
|
*/
|
|
44
44
|
loadSupport: LoadSupport;
|
|
45
|
-
get
|
|
45
|
+
get loadObserver(): TaskObserver;
|
|
46
|
+
get loadModel(): TaskObserver;
|
|
46
47
|
get lastLoadRequested(): Date;
|
|
47
48
|
get lastLoadCompleted(): Date;
|
|
48
49
|
get lastLoadException(): any;
|
|
@@ -13,7 +13,7 @@ import { LoadSpec, Loadable } from './';
|
|
|
13
13
|
export declare class LoadSupport extends HoistBase implements Loadable {
|
|
14
14
|
lastRequested: LoadSpec;
|
|
15
15
|
lastSucceeded: LoadSpec;
|
|
16
|
-
|
|
16
|
+
loadObserver: TaskObserver;
|
|
17
17
|
lastLoadRequested: Date;
|
|
18
18
|
lastLoadCompleted: Date;
|
|
19
19
|
lastLoadException: any;
|
|
@@ -6,9 +6,9 @@ import { LoadSpec } from './';
|
|
|
6
6
|
export interface Loadable {
|
|
7
7
|
/**
|
|
8
8
|
* For tracking the loading of this object.
|
|
9
|
-
* Note that this
|
|
9
|
+
* Note that this object will *not* track auto-refreshes.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
loadObserver: TaskObserver;
|
|
12
12
|
/** Date when last load was initiated. */
|
|
13
13
|
lastLoadRequested: Date;
|
|
14
14
|
/** Date when last load was completed. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultHoistProps, HoistBase, LoadSpecConfig, PlainObject } from '../';
|
|
1
|
+
import { DefaultHoistProps, HoistBase, LoadSpecConfig, PlainObject, TaskObserver } from '../';
|
|
2
2
|
import { Loadable, LoadSpec, LoadSupport } from '../load';
|
|
3
3
|
import { ModelSelector } from './';
|
|
4
4
|
import { Class } from 'type-fest';
|
|
@@ -63,7 +63,8 @@ export declare abstract class HoistModel extends HoistBase implements Loadable {
|
|
|
63
63
|
* See the class-level comments above for additional details.
|
|
64
64
|
*/
|
|
65
65
|
loadSupport: LoadSupport;
|
|
66
|
-
get
|
|
66
|
+
get loadObserver(): TaskObserver;
|
|
67
|
+
get loadModel(): TaskObserver;
|
|
67
68
|
get lastLoadRequested(): Date;
|
|
68
69
|
get lastLoadCompleted(): Date;
|
|
69
70
|
get lastLoadException(): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoadSupport, LoadSpec, Loadable, PlainObject } from '@xh/hoist/core';
|
|
1
|
+
import { LoadSupport, LoadSpec, Loadable, PlainObject, TaskObserver } from '@xh/hoist/core';
|
|
2
2
|
import { Store, StoreConfig } from './Store';
|
|
3
3
|
export interface UrlStoreConfig extends StoreConfig {
|
|
4
4
|
/** URL from which to load data. */
|
|
@@ -14,7 +14,8 @@ export declare class UrlStore extends Store implements Loadable {
|
|
|
14
14
|
dataRoot: string;
|
|
15
15
|
loadSupport: LoadSupport;
|
|
16
16
|
constructor({ url, dataRoot, ...storeConfig }: UrlStoreConfig);
|
|
17
|
-
get
|
|
17
|
+
get loadObserver(): TaskObserver;
|
|
18
|
+
get loadModel(): TaskObserver;
|
|
18
19
|
get lastLoadRequested(): Date;
|
|
19
20
|
get lastLoadCompleted(): Date;
|
|
20
21
|
get lastLoadException(): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormModel } from '@xh/hoist/cmp/form';
|
|
2
|
-
import { HoistModel, PlainObject } from '@xh/hoist/core';
|
|
2
|
+
import { HoistModel, PlainObject, TaskObserver } from '@xh/hoist/core';
|
|
3
3
|
import { RestGridEditor, RestGridModel } from '@xh/hoist/desktop/cmp/rest';
|
|
4
4
|
import { RestField } from '../data/RestField';
|
|
5
5
|
/**
|
|
@@ -24,7 +24,8 @@ export declare class RestFormModel extends HoistModel {
|
|
|
24
24
|
get editors(): RestGridEditor[];
|
|
25
25
|
get gridModel(): import("../../../../cmp/grid").GridModel;
|
|
26
26
|
get store(): import("@xh/hoist/desktop/cmp/rest").RestStore;
|
|
27
|
-
get
|
|
27
|
+
get loadObserver(): TaskObserver;
|
|
28
|
+
get loadModel(): TaskObserver;
|
|
28
29
|
constructor(parent: RestGridModel);
|
|
29
30
|
getStoreField(field: string): RestField;
|
|
30
31
|
getFormFieldModel(field: string): import("@xh/hoist/cmp/form").BaseFieldModel;
|
package/core/HoistService.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
-
import {HoistBase, managed, LoadSupport, LoadSpec, Loadable, PlainObject} from './';
|
|
7
|
+
import {HoistBase, managed, LoadSupport, LoadSpec, Loadable, PlainObject, TaskObserver} from './';
|
|
8
|
+
import {apiDeprecated} from '@xh/hoist/utils/js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Core superclass for Services in Hoist. Services are special classes used in both Hoist and
|
|
@@ -65,8 +66,15 @@ export class HoistService extends HoistBase implements Loadable {
|
|
|
65
66
|
@managed
|
|
66
67
|
loadSupport: LoadSupport;
|
|
67
68
|
|
|
69
|
+
get loadObserver(): TaskObserver {
|
|
70
|
+
return this.loadSupport?.loadObserver;
|
|
71
|
+
}
|
|
68
72
|
get loadModel() {
|
|
69
|
-
|
|
73
|
+
apiDeprecated('HoistService.loadModel', {
|
|
74
|
+
v: 'v82',
|
|
75
|
+
msg: 'Use HoistService.loadObserver instead.'
|
|
76
|
+
});
|
|
77
|
+
return this.loadSupport?.loadObserver;
|
|
70
78
|
}
|
|
71
79
|
get lastLoadRequested() {
|
|
72
80
|
return this.loadSupport?.lastLoadRequested;
|
package/core/load/LoadSupport.ts
CHANGED
|
@@ -32,7 +32,7 @@ export class LoadSupport extends HoistBase implements Loadable {
|
|
|
32
32
|
lastSucceeded: LoadSpec = null;
|
|
33
33
|
|
|
34
34
|
@managed
|
|
35
|
-
|
|
35
|
+
loadObserver: TaskObserver = TaskObserver.trackLast();
|
|
36
36
|
|
|
37
37
|
@observable.ref
|
|
38
38
|
lastLoadRequested: Date = null;
|
|
@@ -71,13 +71,13 @@ export class LoadSupport extends HoistBase implements Loadable {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async doLoadAsync(loadSpec: LoadSpec) {
|
|
74
|
-
let {target,
|
|
74
|
+
let {target, loadObserver} = this;
|
|
75
75
|
|
|
76
76
|
// Auto-refresh:
|
|
77
|
-
// Skip if we have a pending triggered refresh, and never link to
|
|
77
|
+
// Skip if we have a pending triggered refresh, and never link to loadObserver
|
|
78
78
|
if (loadSpec.isAutoRefresh) {
|
|
79
|
-
if (
|
|
80
|
-
|
|
79
|
+
if (loadObserver.isPending) return;
|
|
80
|
+
loadObserver = null;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
runInAction(() => (this.lastLoadRequested = new Date()));
|
|
@@ -87,7 +87,7 @@ export class LoadSupport extends HoistBase implements Loadable {
|
|
|
87
87
|
|
|
88
88
|
return target
|
|
89
89
|
.doLoadAsync(loadSpec)
|
|
90
|
-
.linkTo(
|
|
90
|
+
.linkTo(loadObserver)
|
|
91
91
|
.catch(e => {
|
|
92
92
|
exception = e;
|
|
93
93
|
throw e;
|
package/core/load/Loadable.ts
CHANGED
|
@@ -13,9 +13,9 @@ import {LoadSpec} from './';
|
|
|
13
13
|
export interface Loadable {
|
|
14
14
|
/**
|
|
15
15
|
* For tracking the loading of this object.
|
|
16
|
-
* Note that this
|
|
16
|
+
* Note that this object will *not* track auto-refreshes.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
loadObserver: TaskObserver;
|
|
19
19
|
|
|
20
20
|
/** Date when last load was initiated. */
|
|
21
21
|
lastLoadRequested: Date;
|
package/core/model/HoistModel.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
import {action, computed, comparer, makeObservable, observable} from '@xh/hoist/mobx';
|
|
8
|
-
import {warnIf} from '@xh/hoist/utils/js';
|
|
8
|
+
import {apiDeprecated, warnIf} from '@xh/hoist/utils/js';
|
|
9
9
|
import {isFunction} from 'lodash';
|
|
10
|
-
import {DefaultHoistProps, HoistBase, LoadSpecConfig, managed, PlainObject} from '../';
|
|
10
|
+
import {DefaultHoistProps, HoistBase, LoadSpecConfig, managed, PlainObject, TaskObserver} from '../';
|
|
11
11
|
import {instanceManager} from '../impl/InstanceManager';
|
|
12
12
|
import {Loadable, LoadSpec, LoadSupport} from '../load';
|
|
13
13
|
import {ModelSelector} from './';
|
|
@@ -97,8 +97,15 @@ export abstract class HoistModel extends HoistBase implements Loadable {
|
|
|
97
97
|
@managed
|
|
98
98
|
loadSupport: LoadSupport;
|
|
99
99
|
|
|
100
|
+
get loadObserver(): TaskObserver {
|
|
101
|
+
return this.loadSupport?.loadObserver;
|
|
102
|
+
}
|
|
100
103
|
get loadModel() {
|
|
101
|
-
|
|
104
|
+
apiDeprecated('HoistModel.loadModel', {
|
|
105
|
+
v: 'v82',
|
|
106
|
+
msg: 'Use HoistModel.loadObserver instead.'
|
|
107
|
+
});
|
|
108
|
+
return this.loadSupport?.loadObserver;
|
|
102
109
|
}
|
|
103
110
|
get lastLoadRequested() {
|
|
104
111
|
return this.loadSupport?.lastLoadRequested;
|
package/data/UrlStore.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {XH, managed, LoadSupport, LoadSpec, Loadable, PlainObject} from '@xh/hoist/core';
|
|
8
|
+
import {XH, managed, LoadSupport, LoadSpec, Loadable, PlainObject, TaskObserver} from '@xh/hoist/core';
|
|
9
|
+
import {apiDeprecated} from '@xh/hoist/utils/js';
|
|
9
10
|
|
|
10
11
|
import {Store, StoreConfig} from './Store';
|
|
11
12
|
|
|
@@ -33,8 +34,15 @@ export class UrlStore extends Store implements Loadable {
|
|
|
33
34
|
this.dataRoot = dataRoot;
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
get loadObserver(): TaskObserver {
|
|
38
|
+
return this.loadSupport.loadObserver;
|
|
39
|
+
}
|
|
36
40
|
get loadModel() {
|
|
37
|
-
|
|
41
|
+
apiDeprecated('UrlStore.loadModel', {
|
|
42
|
+
v: 'v82',
|
|
43
|
+
msg: 'Use UrlStore.loadObserver instead.'
|
|
44
|
+
});
|
|
45
|
+
return this.loadSupport.loadObserver;
|
|
38
46
|
}
|
|
39
47
|
get lastLoadRequested() {
|
|
40
48
|
return this.loadSupport.lastLoadRequested;
|
|
@@ -255,15 +255,15 @@ function parseLoadDecorator(propVal: any, propName: string, ctxModel: HoistModel
|
|
|
255
255
|
if (isValidElement(propVal)) return propVal;
|
|
256
256
|
if (propVal === true) return cmp({isDisplayed: true});
|
|
257
257
|
if (propVal === 'onLoad') {
|
|
258
|
-
const
|
|
259
|
-
if (!
|
|
258
|
+
const loadObserver = ctxModel?.loadObserver;
|
|
259
|
+
if (!loadObserver) {
|
|
260
260
|
logWarn(
|
|
261
261
|
`Cannot use 'onLoad' for '${propName}'. The linked context model (${ctxModel?.constructor.name} ${ctxModel?.xhId}) must enable LoadSupport to support this feature.`,
|
|
262
262
|
Panel
|
|
263
263
|
);
|
|
264
264
|
return null;
|
|
265
265
|
}
|
|
266
|
-
return cmp({bind:
|
|
266
|
+
return cmp({bind: loadObserver, spinner: true});
|
|
267
267
|
}
|
|
268
268
|
return cmp({bind: propVal, spinner: true});
|
|
269
269
|
}
|
|
@@ -99,9 +99,9 @@ const innerToolbar = hoistCmp.factory({
|
|
|
99
99
|
|
|
100
100
|
function getMaskFromProp(model, mask) {
|
|
101
101
|
if (isValidElement(mask)) {
|
|
102
|
-
mask = cloneElement<MaskProps>(mask, {bind: model.
|
|
102
|
+
mask = cloneElement<MaskProps>(mask, {bind: model.loadObserver});
|
|
103
103
|
} else if (mask === true) {
|
|
104
|
-
mask = model.
|
|
104
|
+
mask = model.loadObserver;
|
|
105
105
|
}
|
|
106
106
|
return mask;
|
|
107
107
|
}
|
|
@@ -208,7 +208,7 @@ export class RestGridModel extends HoistModel {
|
|
|
208
208
|
return this.store
|
|
209
209
|
.deleteRecordAsync(record)
|
|
210
210
|
.then(() => this.formModel.close())
|
|
211
|
-
.linkTo(this.
|
|
211
|
+
.linkTo(this.loadObserver)
|
|
212
212
|
.catchDefault();
|
|
213
213
|
}
|
|
214
214
|
|
|
@@ -224,7 +224,7 @@ export class RestGridModel extends HoistModel {
|
|
|
224
224
|
|
|
225
225
|
XH.toast({intent, message});
|
|
226
226
|
})
|
|
227
|
-
.linkTo(this.
|
|
227
|
+
.linkTo(this.loadObserver)
|
|
228
228
|
.catchDefault();
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -51,7 +51,7 @@ export class RestStore extends UrlStore {
|
|
|
51
51
|
.then(() => {
|
|
52
52
|
this.updateData({remove: [rec.id]});
|
|
53
53
|
})
|
|
54
|
-
.linkTo(this.
|
|
54
|
+
.linkTo(this.loadObserver);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async bulkDeleteRecordsAsync(records: StoreRecord[]) {
|
|
@@ -60,18 +60,18 @@ export class RestStore extends UrlStore {
|
|
|
60
60
|
resp = await XH.fetchJson({
|
|
61
61
|
url: `${url}/bulkDelete`,
|
|
62
62
|
params: {ids}
|
|
63
|
-
}).linkTo(this.
|
|
63
|
+
}).linkTo(this.loadObserver);
|
|
64
64
|
|
|
65
65
|
await this.loadAsync();
|
|
66
66
|
return resp;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
async addRecordAsync(rec: {id?: StoreRecordId; data: PlainObject}) {
|
|
70
|
-
return this.saveRecordInternalAsync(rec, true).linkTo(this.
|
|
70
|
+
return this.saveRecordInternalAsync(rec, true).linkTo(this.loadObserver);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async saveRecordAsync(rec: {id: StoreRecordId; data: PlainObject}) {
|
|
74
|
-
return this.saveRecordInternalAsync(rec, false).linkTo(this.
|
|
74
|
+
return this.saveRecordInternalAsync(rec, false).linkTo(this.loadObserver);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
async bulkUpdateRecordsAsync(ids: StoreRecordId[], newParams: PlainObject) {
|
|
@@ -81,7 +81,7 @@ export class RestStore extends UrlStore {
|
|
|
81
81
|
url: `${url}/bulkUpdate`,
|
|
82
82
|
body: {ids, newParams}
|
|
83
83
|
})
|
|
84
|
-
.linkTo(this.
|
|
84
|
+
.linkTo(this.loadObserver);
|
|
85
85
|
|
|
86
86
|
await this.loadAsync();
|
|
87
87
|
return resp;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
import {FormModel} from '@xh/hoist/cmp/form';
|
|
8
|
-
import {HoistModel, managed, PlainObject, XH} from '@xh/hoist/core';
|
|
8
|
+
import {HoistModel, managed, PlainObject, TaskObserver, XH} from '@xh/hoist/core';
|
|
9
9
|
import {required} from '@xh/hoist/data';
|
|
10
10
|
import {RestGridEditor, RestGridModel} from '@xh/hoist/desktop/cmp/rest';
|
|
11
11
|
import {action, makeObservable, observable} from '@xh/hoist/mobx';
|
|
12
|
-
import {mergeDeep, throwIf} from '@xh/hoist/utils/js';
|
|
12
|
+
import {apiDeprecated, mergeDeep, throwIf} from '@xh/hoist/utils/js';
|
|
13
13
|
import {isFunction, isNil} from 'lodash';
|
|
14
14
|
import {createRef} from 'react';
|
|
15
15
|
import {RestField} from '../data/RestField';
|
|
@@ -52,8 +52,15 @@ export class RestFormModel extends HoistModel {
|
|
|
52
52
|
get store() {
|
|
53
53
|
return this.parent.store;
|
|
54
54
|
}
|
|
55
|
+
override get loadObserver(): TaskObserver {
|
|
56
|
+
return this.store.loadSupport.loadObserver;
|
|
57
|
+
}
|
|
55
58
|
override get loadModel() {
|
|
56
|
-
|
|
59
|
+
apiDeprecated('RestFormModel.loadModel', {
|
|
60
|
+
v: 'v82',
|
|
61
|
+
msg: 'Use RestFormModel.loadObserver instead.'
|
|
62
|
+
});
|
|
63
|
+
return this.store.loadSupport.loadObserver;
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
constructor(parent: RestGridModel) {
|
|
@@ -169,7 +176,7 @@ export class RestFormModel extends HoistModel {
|
|
|
169
176
|
|
|
170
177
|
return saveFn()
|
|
171
178
|
.then(() => this.close())
|
|
172
|
-
.linkTo(this.
|
|
179
|
+
.linkTo(this.loadObserver)
|
|
173
180
|
.catchDefault();
|
|
174
181
|
}
|
|
175
182
|
|
|
@@ -42,7 +42,7 @@ export class ManageDialogModel extends HoistModel {
|
|
|
42
42
|
readonly updateTask = TaskObserver.trackLast();
|
|
43
43
|
|
|
44
44
|
get loadTask(): TaskObserver {
|
|
45
|
-
return this.viewManagerModel.
|
|
45
|
+
return this.viewManagerModel.loadObserver;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
get gridModel(): GridModel {
|
|
@@ -138,15 +138,15 @@ function parseLoadDecorator(propVal: any, propName: string, ctxModel: HoistModel
|
|
|
138
138
|
if (propVal === true) return cmp({isDisplayed: true});
|
|
139
139
|
if (isValidElement(propVal)) return propVal;
|
|
140
140
|
if (propVal === 'onLoad') {
|
|
141
|
-
const
|
|
142
|
-
if (!
|
|
141
|
+
const loadObserver = ctxModel?.loadObserver;
|
|
142
|
+
if (!loadObserver) {
|
|
143
143
|
logWarn(
|
|
144
144
|
`Cannot use 'onLoad' for '${propName}'. The linked context model (${ctxModel?.constructor.name} ${ctxModel?.xhId}) must enable LoadSupport to support this feature.`,
|
|
145
145
|
Panel
|
|
146
146
|
);
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
return cmp({bind:
|
|
149
|
+
return cmp({bind: loadObserver, spinner: true});
|
|
150
150
|
}
|
|
151
151
|
return cmp({bind: propVal, spinner: true});
|
|
152
152
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "79.0.0-SNAPSHOT.
|
|
3
|
+
"version": "79.0.0-SNAPSHOT.1766166832103",
|
|
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",
|