Skip to content

Commit 5fdec57

Browse files
authored
feat: Add row parser (#644)
* feat: adding explore table data source * refactor: revert changes * feat: adding a shareable explore value parser * refactor: addressing comments * feat: adding a row parser * refactor: addressing comments * refactor: remove row parser
1 parent 706d1c5 commit 5fdec57

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed
Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1+
import { MetricAggregation } from '@hypertrace/distributed-tracing';
12
import { TableCellParser } from '../table-cell-parser';
23
import { TableCellParserBase } from '../table-cell-parser-base';
34
import { 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+
}

0 commit comments

Comments
 (0)