@xh/hoist 68.0.0-SNAPSHOT.1726062354143 → 68.0.0-SNAPSHOT.1726067879775
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/tabs/cluster/ClusterTabModel.ts +16 -4
- package/admin/tabs/monitor/MonitorTabModel.ts +4 -3
- package/build/types/admin/tabs/cluster/ClusterTabModel.d.ts +4 -2
- package/build/types/admin/tabs/monitor/MonitorTabModel.d.ts +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -22,6 +22,8 @@ import {TabContainerModel} from '@xh/hoist/cmp/tab';
|
|
|
22
22
|
import {HoistModel, LoadSpec, managed, PlainObject, XH} from '@xh/hoist/core';
|
|
23
23
|
import {RecordActionSpec} from '@xh/hoist/data';
|
|
24
24
|
import {Icon} from '@xh/hoist/icon';
|
|
25
|
+
import {Timer} from '@xh/hoist/utils/async';
|
|
26
|
+
import {SECONDS} from '@xh/hoist/utils/datetime';
|
|
25
27
|
import {ReactNode} from 'react';
|
|
26
28
|
|
|
27
29
|
export class ClusterTabModel extends HoistModel {
|
|
@@ -36,8 +38,9 @@ export class ClusterTabModel extends HoistModel {
|
|
|
36
38
|
recordsRequired: 1
|
|
37
39
|
};
|
|
38
40
|
|
|
39
|
-
@managed gridModel: GridModel = this.createGridModel();
|
|
40
|
-
@managed tabModel: TabContainerModel = this.createTabModel();
|
|
41
|
+
@managed readonly gridModel: GridModel = this.createGridModel();
|
|
42
|
+
@managed readonly tabModel: TabContainerModel = this.createTabModel();
|
|
43
|
+
@managed readonly timer: Timer;
|
|
41
44
|
|
|
42
45
|
get instance(): PlainObject {
|
|
43
46
|
return this.gridModel.selectedRecord?.data;
|
|
@@ -57,6 +60,7 @@ export class ClusterTabModel extends HoistModel {
|
|
|
57
60
|
let data = await XH.fetchJson({url: 'clusterAdmin/allInstances', loadSpec});
|
|
58
61
|
data = data.map(row => ({
|
|
59
62
|
...row,
|
|
63
|
+
isLocal: row.name == XH.environmentService.serverInstance,
|
|
60
64
|
usedHeapMb: row.memory?.usedHeapMb,
|
|
61
65
|
usedPctMax: row.memory?.usedPctMax
|
|
62
66
|
}));
|
|
@@ -64,6 +68,7 @@ export class ClusterTabModel extends HoistModel {
|
|
|
64
68
|
gridModel.loadData(data);
|
|
65
69
|
await gridModel.preSelectFirstAsync();
|
|
66
70
|
} catch (e) {
|
|
71
|
+
gridModel.clear();
|
|
67
72
|
XH.handleException(e);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
@@ -71,6 +76,12 @@ export class ClusterTabModel extends HoistModel {
|
|
|
71
76
|
constructor() {
|
|
72
77
|
super();
|
|
73
78
|
|
|
79
|
+
this.timer = Timer.create({
|
|
80
|
+
runFn: this.autoRefreshAsync,
|
|
81
|
+
interval: 5 * SECONDS,
|
|
82
|
+
delay: true
|
|
83
|
+
});
|
|
84
|
+
|
|
74
85
|
this.addReaction(
|
|
75
86
|
{
|
|
76
87
|
track: () => this.instanceName,
|
|
@@ -80,7 +91,7 @@ export class ClusterTabModel extends HoistModel {
|
|
|
80
91
|
},
|
|
81
92
|
{
|
|
82
93
|
track: () => XH.environmentService.serverInstance,
|
|
83
|
-
run:
|
|
94
|
+
run: this.refreshAsync
|
|
84
95
|
}
|
|
85
96
|
);
|
|
86
97
|
}
|
|
@@ -91,6 +102,7 @@ export class ClusterTabModel extends HoistModel {
|
|
|
91
102
|
idSpec: 'name',
|
|
92
103
|
fields: [
|
|
93
104
|
{name: 'name', type: 'string'},
|
|
105
|
+
{name: 'isLocal', type: 'bool'},
|
|
94
106
|
{name: 'isPrimary', type: 'bool'},
|
|
95
107
|
{name: 'isReady', type: 'bool'},
|
|
96
108
|
{name: 'wsConnections', type: 'int'},
|
|
@@ -178,7 +190,7 @@ export class ClusterTabModel extends HoistModel {
|
|
|
178
190
|
formatInstance(instance: PlainObject): ReactNode {
|
|
179
191
|
const content = [instance.name];
|
|
180
192
|
if (instance.isPrimary) content.push(badge({item: 'primary', intent: 'primary'}));
|
|
181
|
-
if (instance.
|
|
193
|
+
if (instance.isLocal) content.push(badge('local'));
|
|
182
194
|
return hbox(content);
|
|
183
195
|
}
|
|
184
196
|
|
|
@@ -18,7 +18,8 @@ export class MonitorTabModel extends HoistModel {
|
|
|
18
18
|
|
|
19
19
|
@observable.ref results: MonitorResults[] = [];
|
|
20
20
|
@observable lastRun: number = null;
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
@managed readonly timer: Timer;
|
|
22
23
|
|
|
23
24
|
@bindable @persist showInactive = false;
|
|
24
25
|
@bindable showEditorDialog = false;
|
|
@@ -60,14 +61,14 @@ export class MonitorTabModel extends HoistModel {
|
|
|
60
61
|
makeObservable(this);
|
|
61
62
|
|
|
62
63
|
this.timer = Timer.create({
|
|
63
|
-
runFn:
|
|
64
|
+
runFn: this.autoRefreshAsync,
|
|
64
65
|
interval: 5 * SECONDS,
|
|
65
66
|
delay: true
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
this.addReaction({
|
|
69
70
|
track: () => this.showInactive,
|
|
70
|
-
run:
|
|
71
|
+
run: this.refreshAsync
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -2,14 +2,16 @@ import { GridModel } from '@xh/hoist/cmp/grid';
|
|
|
2
2
|
import { TabContainerModel } from '@xh/hoist/cmp/tab';
|
|
3
3
|
import { HoistModel, LoadSpec, PlainObject } from '@xh/hoist/core';
|
|
4
4
|
import { RecordActionSpec } from '@xh/hoist/data';
|
|
5
|
+
import { Timer } from '@xh/hoist/utils/async';
|
|
5
6
|
import { ReactNode } from 'react';
|
|
6
7
|
export declare class ClusterTabModel extends HoistModel {
|
|
7
8
|
persistWith: {
|
|
8
9
|
localStorageKey: string;
|
|
9
10
|
};
|
|
10
11
|
shutdownAction: RecordActionSpec;
|
|
11
|
-
gridModel: GridModel;
|
|
12
|
-
tabModel: TabContainerModel;
|
|
12
|
+
readonly gridModel: GridModel;
|
|
13
|
+
readonly tabModel: TabContainerModel;
|
|
14
|
+
readonly timer: Timer;
|
|
13
15
|
get instance(): PlainObject;
|
|
14
16
|
get instanceName(): string;
|
|
15
17
|
get isMultiInstance(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "68.0.0-SNAPSHOT.
|
|
3
|
+
"version": "68.0.0-SNAPSHOT.1726067879775",
|
|
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",
|