Skip to content
代码片段 群组 项目
提交 75fd87ff 编辑于 作者: Miguel Rincon's avatar Miguel Rincon
浏览文件

Use entire days in pipeline charts

In order to display entire days in the CI/CD
analytics chart, this change removes the time of
day and timezone from the dates sent to request
pipelines' information.
上级 54d97f57
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
......@@ -48,10 +48,13 @@ export default {
pipelineAnalytics: {
query: getPipelineAnalytics,
variables() {
// Use UTC time and take beginning of day
const today = new Date(new Date().setUTCHours(0, 0, 0, 0));
return {
fullPath: this.projectPath,
fromTime: getDateInPast(new Date(), this.dateRange),
toTime: new Date(),
fromTime: getDateInPast(today, this.dateRange),
toTime: today,
};
},
update(data) {
......
......@@ -5,7 +5,6 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises';
import { getDateInPast } from '~/lib/utils/datetime_utility';
import PipelineChartsNew from '~/projects/pipelines/charts/components/pipeline_charts_new.vue';
import StatisticsList from '~/projects/pipelines/charts/components/statistics_list.vue';
import PipelineDurationChart from '~/projects/pipelines/charts/components/pipeline_duration_chart.vue';
......@@ -21,7 +20,7 @@ jest.mock('~/alert');
const projectPath = 'gitlab-org/gitlab';
describe('~/projects/pipelines/charts/components/pipeline_charts_new.vue', () => {
useFakeDate();
useFakeDate('2022-02-15T08:30'); // a date with a time
let wrapper;
let getPipelineAnalyticsHandler;
......@@ -66,12 +65,11 @@ describe('~/projects/pipelines/charts/components/pipeline_charts_new.vue', () =>
it('is "Last 7 days" by default', () => {
expect(findGlCollapsibleListbox().props('selected')).toBe(7);
expect(getPipelineAnalyticsHandler).toHaveBeenCalledTimes(1);
expect(getPipelineAnalyticsHandler).toHaveBeenLastCalledWith({
fullPath: projectPath,
fromTime: getDateInPast(new Date(), 7),
toTime: new Date(),
fromTime: new Date('2022-02-08'),
toTime: new Date('2022-02-15'),
});
});
......@@ -83,8 +81,8 @@ describe('~/projects/pipelines/charts/components/pipeline_charts_new.vue', () =>
expect(getPipelineAnalyticsHandler).toHaveBeenCalledTimes(2);
expect(getPipelineAnalyticsHandler).toHaveBeenLastCalledWith({
fullPath: projectPath,
fromTime: getDateInPast(new Date(), 90),
toTime: new Date(),
fromTime: new Date('2021-11-17'),
toTime: new Date('2022-02-15'),
});
});
});
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册