Commit eed3c858 authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Fix monitor charts zoom error

Monitor dashboard charts throw error when
zoomed quickly and breaks the page
parent 689b6ee3
...@@ -253,6 +253,7 @@ export default { ...@@ -253,6 +253,7 @@ export default {
this.tooltip.title = dateFormat(params.value, dateFormats.default); this.tooltip.title = dateFormat(params.value, dateFormats.default);
this.tooltip.content = []; this.tooltip.content = [];
params.seriesData.forEach(dataPoint => { params.seriesData.forEach(dataPoint => {
if (dataPoint.value) {
const [xVal, yVal] = dataPoint.value; const [xVal, yVal] = dataPoint.value;
this.tooltip.isDeployment = dataPoint.componentSubType === graphTypes.deploymentData; this.tooltip.isDeployment = dataPoint.componentSubType === graphTypes.deploymentData;
if (this.tooltip.isDeployment) { if (this.tooltip.isDeployment) {
...@@ -271,6 +272,7 @@ export default { ...@@ -271,6 +272,7 @@ export default {
color, color,
}); });
} }
}
}); });
}, },
setSvg(name) { setSvg(name) {
......
---
title: Fixed monitor charts from throwing error when zoomed
merge_request: 20331
author:
type: fixed
...@@ -116,6 +116,19 @@ describe('Time series component', () => { ...@@ -116,6 +116,19 @@ describe('Time series component', () => {
}); });
}); });
it('does not throw error if data point is outside the zoom range', () => {
const seriesDataWithoutValue = generateSeriesData('line');
expect(
timeSeriesChart.vm.formatTooltipText({
...seriesDataWithoutValue,
seriesData: seriesDataWithoutValue.seriesData.map(data => ({
...data,
value: undefined,
})),
}),
).toBeUndefined();
});
describe('when series is of line type', () => { describe('when series is of line type', () => {
beforeEach(done => { beforeEach(done => {
timeSeriesChart.vm.formatTooltipText(generateSeriesData('line')); timeSeriesChart.vm.formatTooltipText(generateSeriesData('line'));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment