Skip to content

Commit

Permalink
fixing blank page (elastic#86640)
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Dec 22, 2020
1 parent 2d361f0 commit b03fa69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ describe('getThrouputChartSelector', () => {
expect(throughputTimeseries).toEqual({ throughputTimeseries: [] });
});

it('returns default values when timeseries is empty', () => {
const throughputTimeseries = getThrouputChartSelector({
theme,
throuputChart: { throughputTimeseries: [] },
});
expect(throughputTimeseries).toEqual({ throughputTimeseries: [] });
});

it('return throughput time series', () => {
const throughputTimeseries = getThrouputChartSelector({
theme,
Expand Down
12 changes: 1 addition & 11 deletions x-pack/plugins/apm/public/selectors/throuput_chart_selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { difference, zipObject } from 'lodash';
import { EuiTheme } from '../../../observability/public';
import { asTransactionRate } from '../../common/utils/formatters';
import { TimeSeries } from '../../typings/timeseries';
import { getEmptySeries } from '../components/shared/charts/helper/get_empty_series';
import { APIReturnType } from '../services/rest/createCallApmApi';
import { httpStatusCodeToColor } from '../utils/httpStatusCodeToColor';

Expand All @@ -34,7 +33,7 @@ export function getThrouputChartSelector({
};
}

export function getThroughputTimeseries({
function getThroughputTimeseries({
throuputChart,
theme,
}: {
Expand All @@ -45,15 +44,6 @@ export function getThroughputTimeseries({
const bucketKeys = throughputTimeseries.map(({ key }) => key);
const getColor = getColorByKey(bucketKeys, theme);

if (!throughputTimeseries.length) {
const start = throughputTimeseries[0].dataPoints[0].x;
const end =
throughputTimeseries[0].dataPoints[
throughputTimeseries[0].dataPoints.length - 1
].x;
return getEmptySeries(start, end);
}

return throughputTimeseries.map((bucket) => {
return {
title: bucket.key,
Expand Down

0 comments on commit b03fa69

Please sign in to comment.