summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/filtered_search_bar/store/modules/filters/mutations.js
blob: 056b1c6310f854157ffe9bb88e465a86fc755b92 (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
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
import * as types from './mutation_types';

export default {
  [types.SET_SELECTED_FILTERS](state, params) {
    const {
      selectedSourceBranch = null,
      selectedSourceBranchList = [],
      selectedTargetBranch = null,
      selectedTargetBranchList = [],
      selectedAuthor = null,
      selectedAuthorList = [],
      selectedMilestone = null,
      selectedMilestoneList = [],
      selectedAssignee = null,
      selectedAssigneeList = [],
      selectedLabel = null,
      selectedLabelList = [],
    } = params;
    state.branches.source.selected = selectedSourceBranch;
    state.branches.source.selectedList = selectedSourceBranchList;
    state.branches.target.selected = selectedTargetBranch;
    state.branches.target.selectedList = selectedTargetBranchList;
    state.authors.selected = selectedAuthor;
    state.authors.selectedList = selectedAuthorList;
    state.assignees.selected = selectedAssignee;
    state.assignees.selectedList = selectedAssigneeList;
    state.milestones.selected = selectedMilestone;
    state.milestones.selectedList = selectedMilestoneList;
    state.labels.selected = selectedLabel;
    state.labels.selectedList = selectedLabelList;
  },
  [types.SET_MILESTONES_ENDPOINT](state, milestonesEndpoint) {
    state.milestonesEndpoint = milestonesEndpoint;
  },
  [types.SET_LABELS_ENDPOINT](state, labelsEndpoint) {
    state.labelsEndpoint = labelsEndpoint;
  },
  [types.SET_GROUP_ENDPOINT](state, groupEndpoint) {
    state.groupEndpoint = groupEndpoint;
  },
  [types.SET_PROJECT_ENDPOINT](state, projectEndpoint) {
    state.projectEndpoint = projectEndpoint;
  },
  [types.REQUEST_MILESTONES](state) {
    state.milestones.isLoading = true;
  },
  [types.RECEIVE_MILESTONES_SUCCESS](state, data) {
    state.milestones.isLoading = false;
    state.milestones.data = data;
    state.milestones.errorCode = null;
  },
  [types.RECEIVE_MILESTONES_ERROR](state, errorCode) {
    state.milestones.isLoading = false;
    state.milestones.errorCode = errorCode;
    state.milestones.data = [];
  },
  [types.REQUEST_LABELS](state) {
    state.labels.isLoading = true;
  },
  [types.RECEIVE_LABELS_SUCCESS](state, data) {
    state.labels.isLoading = false;
    state.labels.data = data;
    state.labels.errorCode = null;
  },
  [types.RECEIVE_LABELS_ERROR](state, errorCode) {
    state.labels.isLoading = false;
    state.labels.errorCode = errorCode;
    state.labels.data = [];
  },
  [types.REQUEST_AUTHORS](state) {
    state.authors.isLoading = true;
  },
  [types.RECEIVE_AUTHORS_SUCCESS](state, data) {
    state.authors.isLoading = false;
    state.authors.data = data;
    state.authors.errorCode = null;
  },
  [types.RECEIVE_AUTHORS_ERROR](state, errorCode) {
    state.authors.isLoading = false;
    state.authors.errorCode = errorCode;
    state.authors.data = [];
  },
  [types.REQUEST_ASSIGNEES](state) {
    state.assignees.isLoading = true;
  },
  [types.RECEIVE_ASSIGNEES_SUCCESS](state, data) {
    state.assignees.isLoading = false;
    state.assignees.data = data;
    state.assignees.errorCode = null;
  },
  [types.RECEIVE_ASSIGNEES_ERROR](state, errorCode) {
    state.assignees.isLoading = false;
    state.assignees.errorCode = errorCode;
    state.assignees.data = [];
  },
  [types.REQUEST_BRANCHES](state) {
    state.branches.isLoading = true;
  },
  [types.RECEIVE_BRANCHES_SUCCESS](state, data) {
    state.branches.isLoading = false;
    state.branches.data = data;
    state.branches.errorCode = null;
  },
  [types.RECEIVE_BRANCHES_ERROR](state, errorCode) {
    state.branches.isLoading = false;
    state.branches.errorCode = errorCode;
    state.branches.data = [];
  },
};