Skip to content

Commit 395aa6f

Browse files
committed
Merge branch 'main' of github.com:hypertrace/hypertrace-ui into modal-and-textarea-styling
2 parents f89cb5c + 5fdec57 commit 395aa6f

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)