File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
projects/components/src/table/cells/data-parsers Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { MetricAggregation } from '@hypertrace/distributed-tracing' ;
1
2
import { TableCellParser } from '../table-cell-parser' ;
2
3
import { TableCellParserBase } from '../table-cell-parser-base' ;
3
4
import { CoreTableCellParserType } from '../types/core-table-cell-parser-type' ;
4
5
5
6
@TableCellParser ( {
6
7
type : CoreTableCellParserType . String
7
8
} )
8
- export class TableCellStringParser extends TableCellParserBase < string , string , string > {
9
- public parseValue ( cellData : string ) : string {
10
- return cellData ;
9
+ export class TableCellStringParser extends TableCellParserBase < string , CellValue , CellValue > {
10
+ public parseValue ( cellData : CellData ) : CellValue {
11
+ return this . extractValue ( cellData ) ;
11
12
}
12
13
13
- public parseFilterValue ( cellData : string ) : string {
14
+ private extractValue ( cellData : CellData ) : CellValue {
15
+ switch ( typeof cellData ) {
16
+ case 'object' :
17
+ return cellData ?. value ?? undefined ;
18
+ case 'string' :
19
+ default :
20
+ return cellData ;
21
+ }
22
+ }
23
+
24
+ public parseFilterValue ( cellData : string ) : CellValue {
14
25
return this . parseValue ( cellData ) ;
15
26
}
16
27
}
28
+
29
+ type CellData = string | null | Partial < NullableValueMetricAggregation > ;
30
+ type CellValue = string | undefined ;
31
+
32
+ interface NullableValueMetricAggregation extends Omit < MetricAggregation , 'value' > {
33
+ value : string | null ;
34
+ }
You can’t perform that action at this time.
0 commit comments