File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,13 @@ export const convertResponse = (
88 const preparedMetrics = data
99 . map ( ( { datapoints, target} ) => {
1010 const metricDescription = metrics . find ( ( metric ) => metric . target === target ) ;
11- const chartData = datapoints . map ( ( datapoint ) => datapoint [ 0 ] || 0 ) ;
1211
1312 if ( ! metricDescription ) {
1413 return undefined ;
1514 }
1615
16+ const chartData = datapoints . map ( ( datapoint ) => datapoint [ 0 ] ) ;
17+
1718 return {
1819 ...metricDescription ,
1920 data : chartData ,
Original file line number Diff line number Diff line change 11import { formatBytes } from '../../utils/bytesParsers' ;
2+ import { EMPTY_DATA_PLACEHOLDER } from '../../utils/constants' ;
23import { roundToPrecision } from '../../utils/dataFormatters/dataFormatters' ;
34import { formatToMs } from '../../utils/timeParsers' ;
45import { isNumeric } from '../../utils/utils' ;
@@ -18,11 +19,19 @@ export const getDefaultDataFormatter = (dataType?: ChartDataType) => {
1819 }
1920} ;
2021
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
2124function formatChartValueToMs ( value : ChartValue ) {
25+ if ( value === null ) {
26+ return EMPTY_DATA_PLACEHOLDER ;
27+ }
2228 return formatToMs ( roundToPrecision ( convertToNumber ( value ) , 2 ) ) ;
2329}
2430
2531function formatChartValueToSize ( value : ChartValue ) {
32+ if ( value === null ) {
33+ return EMPTY_DATA_PLACEHOLDER ;
34+ }
2635 return formatBytes ( { value : convertToNumber ( value ) , precision : 3 } ) ;
2736}
2837
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export interface MetricDescription {
1515}
1616
1717export interface PreparedMetric extends MetricDescription {
18- data : number [ ] ;
18+ data : ( number | null ) [ ] ;
1919}
2020
2121export interface PreparedMetricsData {
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ export const COLORS_PRIORITY = {
7171
7272export const TENANT_OVERVIEW_TABLES_LIMIT = 5 ;
7373
74+ export const EMPTY_DATA_PLACEHOLDER = '—' ;
75+
7476// ==== Titles ====
7577export const DEVELOPER_UI_TITLE = 'Developer UI' ;
7678export const CLUSTER_DEFAULT_TITLE = 'Cluster' ;
You can’t perform that action at this time.
0 commit comments