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

mutations.js « store « settings « registry « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f562137db1ae2fbefeb25b3a1c0f315a11cd8e6c (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
import * as types from './mutation_types';

export default {
  [types.SET_INITIAL_STATE](state, initialState) {
    state.projectId = initialState.projectId;
    state.formOptions = {
      cadence: JSON.parse(initialState.cadenceOptions),
      keepN: JSON.parse(initialState.keepNOptions),
      olderThan: JSON.parse(initialState.olderThanOptions),
    };
  },
  [types.UPDATE_SETTINGS](state, data) {
    state.settings = { ...state.settings, ...data.settings };
  },
  [types.SET_SETTINGS](state, settings) {
    state.settings = settings;
    state.original = Object.freeze(settings);
  },
  [types.SET_IS_DISABLED](state, isDisabled) {
    state.isDisabled = isDisabled;
  },
  [types.RESET_SETTINGS](state) {
    state.settings = { ...state.original };
  },
  [types.TOGGLE_LOADING](state) {
    state.isLoading = !state.isLoading;
  },
};