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' ;
12import { TableCellParser } from '../table-cell-parser' ;
23import { TableCellParserBase } from '../table-cell-parser-base' ;
34import { CoreTableCellParserType } from '../types/core-table-cell-parser-type' ;
45
56@TableCellParser ( {
67 type : CoreTableCellParserType . String
78} )
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 ) ;
1112 }
1213
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 {
1425 return this . parseValue ( cellData ) ;
1526 }
1627}
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