diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-19 21:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-19 21:08:54 +0300 |
commit | b9d98fe10a624d9a6033c516c970954b4fc09372 (patch) | |
tree | 74cb5f7f97f7d40c4a5970855217bd2ee226b9a7 /app/assets/javascripts/analytics | |
parent | 589b674b06c4acb5c357f6444fb0b7344585fdc5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/analytics')
-rw-r--r-- | app/assets/javascripts/analytics/instance_statistics/components/pipelines_chart.vue | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/app/assets/javascripts/analytics/instance_statistics/components/pipelines_chart.vue b/app/assets/javascripts/analytics/instance_statistics/components/pipelines_chart.vue index 279fcfe736f..b16d960402b 100644 --- a/app/assets/javascripts/analytics/instance_statistics/components/pipelines_chart.vue +++ b/app/assets/javascripts/analytics/instance_statistics/components/pipelines_chart.vue @@ -4,7 +4,11 @@ import { GlAlert } from '@gitlab/ui'; import { mapKeys, mapValues, pick, some, sum } from 'lodash'; import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue'; import { s__ } from '~/locale'; -import { formatDateAsMonth, getDayDifference } from '~/lib/utils/datetime_utility'; +import { + differenceInMonths, + formatDateAsMonth, + getDayDifference, +} from '~/lib/utils/datetime_utility'; import { getAverageByMonth, sortByDate, extractValues } from '../utils'; import pipelineStatsQuery from '../graphql/queries/pipeline_stats.query.graphql'; import { TODAY, START_DATE } from '../constants'; @@ -150,19 +154,14 @@ export default { max: this.$options.endDate, }; }, - differenceInMonths() { - const yearDiff = this.$options.endDate.getYear() - this.$options.startDate.getYear(); - const monthDiff = this.$options.endDate.getMonth() - this.$options.startDate.getMonth(); - - return monthDiff + 12 * yearDiff; - }, chartOptions() { + const { endDate, startDate, i18n } = this.$options; return { xAxis: { ...this.range, - name: this.$options.i18n.xAxisTitle, + name: i18n.xAxisTitle, type: 'time', - splitNumber: this.differenceInMonths + 1, + splitNumber: differenceInMonths(startDate, endDate) + 1, axisLabel: { interval: 0, showMinLabel: false, @@ -172,7 +171,7 @@ export default { }, }, yAxis: { - name: this.$options.i18n.yAxisTitle, + name: i18n.yAxisTitle, }, }; }, |