@xh/hoist 73.0.0-SNAPSHOT.1746554302414 → 73.0.0-SNAPSHOT.1746559391577

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.
@@ -139,6 +139,12 @@ export const deviceIcon: ColumnSpec = {
139
139
  }
140
140
  };
141
141
 
142
+ export const elapsedRenderer = numberRenderer({
143
+ label: 'ms',
144
+ nullDisplay: '-',
145
+ formatConfig: {thousandSeparated: false, mantissa: 0}
146
+ });
147
+
142
148
  export const elapsed: ColumnSpec = {
143
149
  field: {
144
150
  name: 'elapsed',
@@ -146,12 +152,17 @@ export const elapsed: ColumnSpec = {
146
152
  aggregator: 'AVG'
147
153
  },
148
154
  width: 130,
149
- align: 'right',
150
- renderer: numberRenderer({
151
- label: 'ms',
152
- nullDisplay: '-',
153
- formatConfig: {thousandSeparated: false, mantissa: 0}
154
- })
155
+ renderer: elapsedRenderer
156
+ };
157
+
158
+ export const elapsedMax: ColumnSpec = {
159
+ field: {
160
+ name: 'elapsedMax',
161
+ type: 'int',
162
+ aggregator: 'MAX'
163
+ },
164
+ width: 130,
165
+ renderer: elapsedRenderer
155
166
  };
156
167
 
157
168
  export const entryCount: ColumnSpec = {
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import {exportFilename, getAppModel} from '@xh/hoist/admin/AdminUtils';
8
8
  import * as Col from '@xh/hoist/admin/columns';
9
+ import {elapsedRenderer} from '@xh/hoist/admin/columns';
9
10
  import {
10
11
  ActivityTrackingDataFieldSpec,
11
12
  DataFieldsEditorModel
@@ -16,7 +17,7 @@ import {ColumnRenderer, ColumnSpec, GridModel, TreeStyle} from '@xh/hoist/cmp/gr
16
17
  import {GroupingChooserModel} from '@xh/hoist/cmp/grouping';
17
18
  import {HoistModel, LoadSpec, managed, PlainObject, XH} from '@xh/hoist/core';
18
19
  import {Cube, CubeFieldSpec, FieldSpec, StoreRecord} from '@xh/hoist/data';
19
- import {dateRenderer, dateTimeSecRenderer, fmtNumber, numberRenderer} from '@xh/hoist/format';
20
+ import {dateRenderer, dateTimeSecRenderer, numberRenderer} from '@xh/hoist/format';
20
21
  import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
21
22
  import {LocalDate} from '@xh/hoist/utils/datetime';
22
23
  import {compact, get, isEmpty, isEqual, round} from 'lodash';
@@ -329,6 +330,7 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
329
330
  Col.dayRange.field,
330
331
  Col.device.field,
331
332
  Col.elapsed.field,
333
+ Col.elapsedMax.field,
332
334
  Col.entryCount.field,
333
335
  Col.impersonating.field,
334
336
  Col.instance.field,
@@ -349,7 +351,11 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
349
351
  private createFilterChooserModel(): FilterChooserModel {
350
352
  // TODO - data fields?
351
353
  const ret = new FilterChooserModel({
352
- persistWith: {...this.persistWith, persistFavorites: false},
354
+ persistWith: {
355
+ ...this.persistWith,
356
+ // Faves persisted to local storage (vs trapped within a single VM view)
357
+ persistFavorites: {localStorageKey: 'xhAdminActivityTabState'}
358
+ },
353
359
  fieldSpecs: [
354
360
  {field: 'appEnvironment', displayName: 'Environment'},
355
361
  {field: 'appVersion'},
@@ -358,16 +364,7 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
358
364
  {field: 'correlationId'},
359
365
  {field: 'data'},
360
366
  {field: 'device'},
361
- {
362
- field: 'elapsed',
363
- valueRenderer: v => {
364
- return fmtNumber(v, {
365
- label: 'ms',
366
- formatConfig: {thousandSeparated: false, mantissa: 0}
367
- });
368
- },
369
- fieldType: 'number'
370
- },
367
+ {field: 'elapsed', fieldType: 'number', valueRenderer: elapsedRenderer},
371
368
  {field: 'instance'},
372
369
  {field: 'loadId'},
373
370
  {field: 'msg', displayName: 'Message'},
@@ -403,7 +400,11 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
403
400
 
404
401
  private createGroupingChooserModel(): GroupingChooserModel {
405
402
  return new GroupingChooserModel({
406
- persistWith: {...this.persistWith, persistFavorites: false},
403
+ persistWith: {
404
+ ...this.persistWith,
405
+ // Faves persisted to local storage (vs trapped within a single VM view)
406
+ persistFavorites: {localStorageKey: 'xhAdminActivityTabState'}
407
+ },
407
408
  dimensions: this.cube.dimensions,
408
409
  initialValue: ['username', 'category']
409
410
  });
@@ -440,7 +441,8 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
440
441
  {...Col.browser, hidden},
441
442
  {...Col.userAgent, hidden},
442
443
  {...Col.impersonating, hidden},
443
- {...Col.elapsed, headerName: 'Elapsed (avg)', hidden},
444
+ {...Col.elapsed, displayName: 'Elapsed (avg)', hidden},
445
+ {...Col.elapsedMax, displayName: 'Elapsed (max)', hidden},
444
446
  {...Col.dayRange, hidden},
445
447
  {...Col.entryCount},
446
448
  {field: 'count', hidden},
@@ -464,6 +466,9 @@ export class ActivityTrackingModel extends HoistModel implements ActivityDetailP
464
466
  raw.month = raw.day.format(this._monthFormat);
465
467
  raw.dayRange = {min: raw.day, max: raw.day};
466
468
 
469
+ // Workaround lack of support for multiple aggregations on the same field.
470
+ raw.elapsedMax = raw.elapsed;
471
+
467
472
  const data = JSON.parse(raw.data);
468
473
  if (isEmpty(data)) return;
469
474
 
@@ -26,6 +26,7 @@ import {activityDetailView} from './detail/ActivityDetailView';
26
26
  import './ActivityTracking.scss';
27
27
 
28
28
  export const activityTrackingPanel = hoistCmp.factory({
29
+ displayName: 'ActivityTrackingPanel',
29
30
  model: creates(ActivityTrackingModel),
30
31
 
31
32
  render({model}) {
@@ -45,14 +45,9 @@ export class AggChartModel extends HoistModel {
45
45
  if (!activityTrackingModel) return [];
46
46
 
47
47
  const ret: SelectOption[] = [
48
- {
49
- label: 'Entries [count]',
50
- value: 'entryCount'
51
- },
52
- {
53
- label: 'Elapsed ms [avg]',
54
- value: 'elapsed'
55
- }
48
+ {label: 'Entries [count]', value: 'entryCount'},
49
+ {label: 'Elapsed [avg]', value: 'elapsed'},
50
+ {label: 'Elapsed [max]', value: 'elapsedMax'}
56
51
  ];
57
52
 
58
53
  if (secondaryDim) {
@@ -88,10 +83,16 @@ export class AggChartModel extends HoistModel {
88
83
  this.markPersist('metric', {...persistWith, path: 'chartMetric'});
89
84
  this.markPersist('incWeekends', {...persistWith, path: 'chartIncWeekends'});
90
85
 
91
- this.addReaction({
92
- track: () => [this.data, this.metric, this.incWeekends],
93
- run: () => this.loadChart()
94
- });
86
+ this.addReaction(
87
+ {
88
+ track: () => [this.data, this.metric, this.incWeekends],
89
+ run: () => this.loadChart()
90
+ },
91
+ {
92
+ track: () => this.selectableMetrics,
93
+ run: () => this.onSelectableMetricsChange()
94
+ }
95
+ );
95
96
  }
96
97
 
97
98
  //-----------------
@@ -215,4 +216,11 @@ export class AggChartModel extends HoistModel {
215
216
  private getDisplayName(fieldName: string) {
216
217
  return this.activityTrackingModel?.getDisplayName(fieldName) ?? fieldName;
217
218
  }
219
+
220
+ private onSelectableMetricsChange(): void {
221
+ const {metric} = this;
222
+ if (!this.selectableMetrics.some(it => it.value === metric)) {
223
+ this.metric = this.selectableMetrics[0]?.value;
224
+ }
225
+ }
218
226
  }
@@ -14,6 +14,7 @@ import {Icon} from '@xh/hoist/icon/Icon';
14
14
  import {AggChartModel} from './AggChartModel';
15
15
 
16
16
  export const aggChartPanel = hoistCmp.factory({
17
+ displayName: 'AggChartPanel',
17
18
  model: creates(AggChartModel),
18
19
 
19
20
  render({model, ...props}) {
@@ -12,6 +12,7 @@ import {popover} from '@xh/hoist/kit/blueprint';
12
12
  import {isEmpty} from 'lodash';
13
13
 
14
14
  export const dataFieldsEditor = hoistCmp.factory({
15
+ displayName: 'DataFieldsEditor',
15
16
  model: uses(DataFieldsEditorModel),
16
17
 
17
18
  render({model}) {
@@ -22,6 +22,7 @@ import {isNil} from 'lodash';
22
22
  import {ActivityDetailModel} from './ActivityDetailModel';
23
23
 
24
24
  export const activityDetailView = hoistCmp.factory({
25
+ displayName: 'ActivityDetailView',
25
26
  model: creates(ActivityDetailModel),
26
27
 
27
28
  render({model, ...props}) {
@@ -12,7 +12,9 @@ export declare const day: ColumnSpec;
12
12
  export declare const dayRange: ColumnSpec;
13
13
  export declare const device: ColumnSpec;
14
14
  export declare const deviceIcon: ColumnSpec;
15
+ export declare const elapsedRenderer: (v: number) => import("react").ReactNode;
15
16
  export declare const elapsed: ColumnSpec;
17
+ export declare const elapsedMax: ColumnSpec;
16
18
  export declare const entryCount: ColumnSpec;
17
19
  export declare const entryId: ColumnSpec;
18
20
  export declare const error: ColumnSpec;
@@ -30,4 +30,5 @@ export declare class AggChartModel extends HoistModel {
30
30
  private loadChart;
31
31
  private getSeriesData;
32
32
  private getDisplayName;
33
+ private onSelectableMetricsChange;
33
34
  }
@@ -137,6 +137,10 @@
137
137
  color: var(--xh-text-color);
138
138
  }
139
139
 
140
+ .xh-toolbar--compact & {
141
+ height: 15px;
142
+ }
143
+
140
144
  // Matched to FilterChooser equivalent.
141
145
  & > .svg-inline--fa {
142
146
  width: 12px;
@@ -47,8 +47,10 @@ export interface GroupingChooserProps extends ButtonProps<GroupingChooserModel>
47
47
  * @see GroupingChooserModel
48
48
  */
49
49
  export const [GroupingChooser, groupingChooser] = hoistCmp.withFactory<GroupingChooserProps>({
50
+ displayName: 'GroupingChooser',
50
51
  model: uses(GroupingChooserModel),
51
52
  className: 'xh-grouping-chooser',
53
+
52
54
  render(
53
55
  {
54
56
  model,
@@ -103,15 +105,13 @@ export const [GroupingChooser, groupingChooser] = hoistCmp.withFactory<GroupingC
103
105
  ),
104
106
  content: favoritesIsOpen
105
107
  ? favoritesMenu({testId: favoritesMenuTestId})
106
- : editorIsOpen
107
- ? editor({
108
- popoverWidth,
109
- popoverMinHeight,
110
- popoverTitle,
111
- emptyText,
112
- testId: editorTestId
113
- })
114
- : null,
108
+ : editor({
109
+ popoverWidth,
110
+ popoverMinHeight,
111
+ popoverTitle,
112
+ emptyText,
113
+ testId: editorTestId
114
+ }),
115
115
  onInteraction: (nextOpenState, e) => {
116
116
  if (
117
117
  isOpen &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1746554302414",
3
+ "version": "73.0.0-SNAPSHOT.1746559391577",
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",