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

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

export default {
  [types.REQUEST_METRIC_IMAGES](state) {
    state.isLoadingMetricImages = true;
  },
  [types.RECEIVE_METRIC_IMAGES_SUCCESS](state, images) {
    state.metricImages = images || [];
    state.isLoadingMetricImages = false;
  },
  [types.RECEIVE_METRIC_IMAGES_ERROR](state) {
    state.isLoadingMetricImages = false;
  },
  [types.REQUEST_METRIC_UPLOAD](state) {
    state.isUploadingImage = true;
  },
  [types.RECEIVE_METRIC_UPLOAD_SUCCESS](state, image) {
    state.metricImages.push(image);
    state.isUploadingImage = false;
  },
  [types.RECEIVE_METRIC_UPLOAD_ERROR](state) {
    state.isUploadingImage = false;
  },
  [types.RECEIVE_METRIC_UPDATE_SUCCESS](state, image) {
    state.isUploadingImage = false;
    const metricIndex = state.metricImages.findIndex((img) => img.id === image.id);
    if (metricIndex >= 0) {
      state.metricImages.splice(metricIndex, 1, image);
    }
  },
  [types.RECEIVE_METRIC_DELETE_SUCCESS](state, imageId) {
    const metricIndex = state.metricImages.findIndex((image) => image.id === imageId);
    state.metricImages.splice(metricIndex, 1);
  },
  [types.SET_INITIAL_DATA](state, { modelIid, projectId }) {
    state.modelIid = modelIid;
    state.projectId = projectId;
  },
};