gitlab-org--gitlab-foss/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js

36 lines
839 B
JavaScript
Raw Normal View History

import axios from '~/lib/utils/axios_utils';
2016-10-20 00:34:16 -04:00
export default class CycleAnalyticsService {
constructor(options) {
this.axios = axios.create({
baseURL: options.requestPath,
});
}
fetchCycleAnalyticsData(options = { startDate: 30 }) {
2019-07-24 09:59:23 -04:00
const { startDate, projectIds } = options;
return this.axios
.get('', {
params: {
2019-07-24 09:59:23 -04:00
'cycle_analytics[start_date]': startDate,
'cycle_analytics[project_ids]': projectIds,
},
})
.then(x => x.data);
}
fetchStageData(options) {
2019-07-24 09:59:23 -04:00
const { stage, startDate, projectIds } = options;
return this.axios
.get(`events/${stage.name}.json`, {
params: {
'cycle_analytics[start_date]': startDate,
2019-07-24 09:59:23 -04:00
'cycle_analytics[project_ids]': projectIds,
},
})
.then(x => x.data);
2016-11-18 19:38:29 -05:00
}
}