Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | 162x 5x 133x 30x 5x 3x 3x 3x 5x 32x 32x 32x 30x 30x 30x 2x 87x 5x 4x 4x 5x 690x 678x 5x 91x 690x 91x 91x 690x 88x 3x 5x 682x 682x 5x 87x 682x 87x 87x 682x 87x 87x 5x 4x 4x 5x 151x 5x 89x 89x 89x 89x 86x 86x 3x 3x | import { getValueStreamStageMedian, getStageEvents, getStageCount, getStagesAndEvents, } from 'ee/api/analytics_api'; import { I18N_VSA_ERROR_STAGES, I18N_VSA_ERROR_STAGE_MEDIAN, I18N_VSA_ERROR_SELECTED_STAGE, } from '~/analytics/cycle_analytics/constants'; import { createAlert } from '~/alert'; import { normalizeHeaders, parseIntPagination } from '~/lib/utils/common_utils'; import { OVERVIEW_STAGE_CONFIG } from '../../constants'; import { checkForDataError, alertErrorIfStatusNotOk, throwIfUserForbidden } from '../../utils'; import * as types from '../mutation_types'; export const setSelectedStage = ({ commit }, stage) => commit(types.SET_SELECTED_STAGE, stage); export const setDefaultSelectedStage = ({ dispatch }) => dispatch('setSelectedStage', OVERVIEW_STAGE_CONFIG); export const requestStageData = ({ commit }) => commit(types.REQUEST_STAGE_DATA); export const receiveStageDataError = ({ commit }, error) => { const { message = '' } = error; alertErrorIfStatusNotOk({ error, message: I18N_VSA_ERROR_SELECTED_STAGE }); commit(types.RECEIVE_STAGE_DATA_ERROR, message); }; export const fetchStageData = ({ dispatch, getters, commit }, stageId) => { const { cycleAnalyticsRequestParams = {}, currentValueStreamId, namespacePath, paginationParams, } = getters; dispatch('requestStageData'); return getStageEvents({ namespacePath, valueStreamId: currentValueStreamId, stageId, params: { ...cycleAnalyticsRequestParams, ...paginationParams, }, }) .then(checkForDataError) .then(({ data, headers }) => { const { page = null, nextPage = null } = parseIntPagination(normalizeHeaders(headers)); commit(types.RECEIVE_STAGE_DATA_SUCCESS, data); commit(types.SET_PAGINATION, { ...paginationParams, page, hasNextPage: Boolean(nextPage) }); }) .catch((error) => dispatch('receiveStageDataError', error)); }; export const requestStageMedianValues = ({ commit }) => commit(types.REQUEST_STAGE_MEDIANS); export const receiveStageMedianValuesError = ({ commit }, error) => { commit(types.RECEIVE_STAGE_MEDIANS_ERROR, error); createAlert({ message: I18N_VSA_ERROR_STAGE_MEDIAN }); }; const fetchStageMedian = ({ namespacePath, valueStreamId, stageId, params }) => getValueStreamStageMedian({ namespacePath, valueStreamId, stageId }, params).then(({ data }) => { return { id: stageId, ...(data?.error ? { error: data.error, value: null, } : data), }; }); export const fetchStageMedianValues = ({ dispatch, commit, getters }) => { const { namespacePath, cycleAnalyticsRequestParams, activeStages, currentValueStreamId, } = getters; const stageIds = activeStages.map((s) => s.id); dispatch('requestStageMedianValues'); return Promise.all( stageIds.map((stageId) => fetchStageMedian({ namespacePath, valueStreamId: currentValueStreamId, stageId, params: cycleAnalyticsRequestParams, }), ), ) .then((data) => commit(types.RECEIVE_STAGE_MEDIANS_SUCCESS, data)) .catch((error) => dispatch('receiveStageMedianValuesError', error)); }; const fetchStageCount = ({ namespacePath, valueStreamId, stageId, params }) => getStageCount({ namespacePath, valueStreamId, stageId, params }).then(({ data }) => { return { id: stageId, ...(data?.error ? { error: data.error, value: null, } : data), }; }); export const fetchStageCountValues = ({ commit, getters }) => { const { namespacePath, cycleAnalyticsRequestParams, activeStages, currentValueStreamId, } = getters; const stageIds = activeStages.map((s) => s.id); commit(types.REQUEST_STAGE_COUNTS); return Promise.all( stageIds.map((stageId) => fetchStageCount({ namespacePath, valueStreamId: currentValueStreamId, stageId, params: cycleAnalyticsRequestParams, }), ), ) .then((data) => commit(types.RECEIVE_STAGE_COUNTS_SUCCESS, data)) .catch((error) => commit(types.RECEIVE_STAGE_COUNTS_ERROR, error)); }; export const requestGroupStages = ({ commit }) => commit(types.REQUEST_GROUP_STAGES); export const receiveGroupStagesError = ({ commit }, error) => { commit(types.RECEIVE_GROUP_STAGES_ERROR, error); createAlert({ message: I18N_VSA_ERROR_STAGES }); }; export const receiveGroupStagesSuccess = ({ commit }, stages) => commit(types.RECEIVE_GROUP_STAGES_SUCCESS, stages); export const fetchGroupStagesAndEvents = ({ dispatch, commit, getters }) => { const { currentValueStreamId: valueStreamId, namespacePath, cycleAnalyticsRequestParams: { created_after: createdAfter, project_ids }, } = getters; dispatch('requestGroupStages'); commit(types.SET_STAGE_EVENTS, []); return getStagesAndEvents({ namespacePath, valueStreamId, params: { start_date: createdAfter, project_ids, }, }) .then(({ data: { stages = [], events = [] } }) => { dispatch('receiveGroupStagesSuccess', stages); commit(types.SET_STAGE_EVENTS, events); }) .catch((error) => { throwIfUserForbidden(error); return dispatch('receiveGroupStagesError', error); }); }; |