6
6
doNotAwait ,
7
7
omitNull ,
8
8
sameKeysAndValues ,
9
+ mapObject ,
9
10
} from "../../util/Util" ;
10
11
import * as ArrayUtils from "../../util/ArrayUtils" ;
11
12
import {
@@ -21,7 +22,10 @@ import {
21
22
type GlobalId ,
22
23
getSavedGlobalId ,
23
24
} from "../definitions/BaseRecord" ;
24
- import { type InventoryRecord } from "../definitions/InventoryRecord" ;
25
+ import {
26
+ type InventoryRecord ,
27
+ type ApiRecordType ,
28
+ } from "../definitions/InventoryRecord" ;
25
29
import { type AdjustableTableRowLabel } from "../definitions/Tables" ;
26
30
import getRootStore from "../stores/RootStore" ;
27
31
import { mkAlert } from "../contexts/Alert" ;
@@ -349,7 +353,8 @@ export default class Search implements SearchInterface {
349
353
return this . editLoading = = = "batch" && ! this . batchEditingRecords ;
350
354
}
351
355
352
- get batchEditingRecordsByType ( ) : | null
356
+ get batchEditingRecordsByType ( ) :
357
+ | null
353
358
| { | type : "container" , records : RsSet < ContainerModel > | }
354
359
| { | type : "sample" , records : RsSet < SampleModel > | }
355
360
| { | type : "subSample" , records : RsSet < SubSampleModel > | }
@@ -1168,7 +1173,16 @@ export default class Search implements SearchInterface {
1168
1173
link . setAttribute ( "rel" , downloadLink . rel ) ;
1169
1174
link . setAttribute ( "download" , fileName ) ;
1170
1175
link . click ( ) ; // trigger download
1171
- trackingStore . trackEvent ( "user:export:selection:Inventory" ) ;
1176
+ trackingStore . trackEvent ( "user:export:selection:Inventory" , {
1177
+ ...exportOptions ,
1178
+ count : {
1179
+ ...mapObject (
1180
+ ( _type : ApiRecordType , list ) => list . length ,
1181
+ ArrayUtils . groupBy ( ( { type } ) => type , records )
1182
+ ) ,
1183
+ total : records . length ,
1184
+ } ,
1185
+ } ) ;
1172
1186
} catch ( error ) {
1173
1187
uiStore . addAlert (
1174
1188
mkAlert ( {
0 commit comments