File tree 4 files changed +14
-2
lines changed
4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,13 @@ export const convertResponse = (
8
8
const preparedMetrics = data
9
9
. map ( ( { datapoints, target} ) => {
10
10
const metricDescription = metrics . find ( ( metric ) => metric . target === target ) ;
11
- const chartData = datapoints . map ( ( datapoint ) => datapoint [ 0 ] || 0 ) ;
12
11
13
12
if ( ! metricDescription ) {
14
13
return undefined ;
15
14
}
16
15
16
+ const chartData = datapoints . map ( ( datapoint ) => datapoint [ 0 ] ) ;
17
+
17
18
return {
18
19
...metricDescription ,
19
20
data : chartData ,
Original file line number Diff line number Diff line change 1
1
import { formatBytes } from '../../utils/bytesParsers' ;
2
+ import { EMPTY_DATA_PLACEHOLDER } from '../../utils/constants' ;
2
3
import { roundToPrecision } from '../../utils/dataFormatters/dataFormatters' ;
3
4
import { formatToMs } from '../../utils/timeParsers' ;
4
5
import { isNumeric } from '../../utils/utils' ;
@@ -18,11 +19,19 @@ export const getDefaultDataFormatter = (dataType?: ChartDataType) => {
18
19
}
19
20
} ;
20
21
22
+ // Values in y axis won't be null and will always be present and properly formatted
23
+ // EMPTY_DATA_PLACEHOLDER is actually empty data format for values in a tooltip
21
24
function formatChartValueToMs ( value : ChartValue ) {
25
+ if ( value === null ) {
26
+ return EMPTY_DATA_PLACEHOLDER ;
27
+ }
22
28
return formatToMs ( roundToPrecision ( convertToNumber ( value ) , 2 ) ) ;
23
29
}
24
30
25
31
function formatChartValueToSize ( value : ChartValue ) {
32
+ if ( value === null ) {
33
+ return EMPTY_DATA_PLACEHOLDER ;
34
+ }
26
35
return formatBytes ( { value : convertToNumber ( value ) , precision : 3 } ) ;
27
36
}
28
37
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export interface MetricDescription {
15
15
}
16
16
17
17
export interface PreparedMetric extends MetricDescription {
18
- data : number [ ] ;
18
+ data : ( number | null ) [ ] ;
19
19
}
20
20
21
21
export interface PreparedMetricsData {
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ export const COLORS_PRIORITY = {
71
71
72
72
export const TENANT_OVERVIEW_TABLES_LIMIT = 5 ;
73
73
74
+ export const EMPTY_DATA_PLACEHOLDER = '—' ;
75
+
74
76
// ==== Titles ====
75
77
export const DEVELOPER_UI_TITLE = 'Developer UI' ;
76
78
export const CLUSTER_DEFAULT_TITLE = 'Cluster' ;
You can’t perform that action at this time.
0 commit comments