Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mutations.js « store « cycle_analytics « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8fd5c78339a20b53f267715102e3ec5d8eca455a (plain)
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
import { decorateData, decorateEvents } from '../utils';
import * as types from './mutation_types';

export default {
  [types.INITIALIZE_VSA](state, { requestPath }) {
    state.requestPath = requestPath;
  },
  [types.SET_SELECTED_STAGE](state, stage) {
    state.isLoadingStage = true;
    state.selectedStage = stage;
    state.isLoadingStage = false;
  },
  [types.SET_DATE_RANGE](state, { startDate }) {
    state.startDate = startDate;
  },
  [types.REQUEST_CYCLE_ANALYTICS_DATA](state) {
    state.isLoading = true;
    state.stages = [];
    state.hasError = false;
  },
  [types.RECEIVE_CYCLE_ANALYTICS_DATA_SUCCESS](state, data) {
    state.isLoading = false;
    const { stages, summary } = decorateData(data);
    state.stages = stages;
    state.summary = summary;
    state.hasError = false;
  },
  [types.RECEIVE_CYCLE_ANALYTICS_DATA_ERROR](state) {
    state.isLoading = false;
    state.stages = [];
    state.hasError = true;
  },
  [types.REQUEST_STAGE_DATA](state) {
    state.isLoadingStage = true;
    state.isEmptyStage = false;
    state.selectedStageEvents = [];
    state.hasError = false;
  },
  [types.RECEIVE_STAGE_DATA_SUCCESS](state, { events = [] }) {
    const { selectedStage } = state;
    state.isLoadingStage = false;
    state.isEmptyStage = !events.length;
    state.selectedStageEvents = decorateEvents(events, selectedStage);
    state.hasError = false;
  },
  [types.RECEIVE_STAGE_DATA_ERROR](state) {
    state.isLoadingStage = false;
    state.isEmptyStage = true;
    state.selectedStageEvents = [];
    state.hasError = true;
  },
};