diff options
author | Miguel Rincon <mrincon@gitlab.com> | 2019-08-15 09:58:10 -0500 |
---|---|---|
committer | Miguel Rincon <mrincon@gitlab.com> | 2019-08-16 15:58:32 -0500 |
commit | c2d311979b09f1a3c7f183537728d06a7fc89ed0 (patch) | |
tree | a0bafede7ce21ad99f8e835ec731a2c9a82435fb | |
parent | 7939ff72bcceec539d837cf483ed7ee633140f20 (diff) | |
download | gitlab-ce-c2d311979b09f1a3c7f183537728d06a7fc89ed0.tar.gz |
Fixes from review - code clarity
-rw-r--r-- | app/assets/javascripts/monitoring/components/charts/time_series.vue | 14 | ||||
-rw-r--r-- | spec/javascripts/monitoring/charts/time_series_spec.js | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue index 9f119f8f6c6..4a0e1593132 100644 --- a/app/assets/javascripts/monitoring/components/charts/time_series.vue +++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue @@ -223,20 +223,18 @@ export default { formatTooltipText(params) { this.tooltip.title = dateFormat(params.value, 'dd mmm yyyy, h:MMTT'); this.tooltip.content = []; - params.seriesData.forEach(seriesData => { - this.tooltip.isDeployment = seriesData.componentSubType === graphTypes.deploymentData; + params.seriesData.forEach(dataPoint => { + const [xVal, yVal] = dataPoint.value; + this.tooltip.isDeployment = dataPoint.componentSubType === graphTypes.deploymentData; if (this.tooltip.isDeployment) { const [deploy] = this.recentDeployments.filter( - deployment => deployment.createdAt === seriesData.value[0], + deployment => deployment.createdAt === xVal, ); this.tooltip.sha = deploy.sha.substring(0, 8); this.tooltip.commitUrl = deploy.commitUrl; } else { - const { seriesName, color } = seriesData; - // seriesData.value contains the chart's [x, y] value pair - // seriesData.value[1] is threfore the chart y value - const value = seriesData.value[1].toFixed(3); - + const { seriesName, color } = dataPoint; + const value = yVal.toFixed(3); this.tooltip.content.push({ name: seriesName, value, diff --git a/spec/javascripts/monitoring/charts/time_series_spec.js b/spec/javascripts/monitoring/charts/time_series_spec.js index fc866ad047c..740b7e0436b 100644 --- a/spec/javascripts/monitoring/charts/time_series_spec.js +++ b/spec/javascripts/monitoring/charts/time_series_spec.js @@ -289,7 +289,7 @@ describe('Time series component', () => { it('recieves a tooltip title', done => { const mockTitle = 'mockTitle'; - timeSeriesAreaChart.vm.tooltip.title = mockTitle; // TODO Currently yields "Failed: $listeners is readonly."" + timeSeriesAreaChart.vm.tooltip.title = mockTitle; timeSeriesAreaChart.vm.$nextTick(() => { expect(shallowWrapperContainsSlotText(glChart, 'tooltipTitle', mockTitle)).toBe(true); |