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

actions.js « list « store « error_tracking « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 13b15549d81998eb340282ad50c233daf9d511fd (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
import Service from '../../services';
import * as types from './mutation_types';
import createFlash from '~/flash';
import Poll from '~/lib/utils/poll';
import { __, sprintf } from '~/locale';

let eTagPoll;

export function startPolling({ commit, dispatch }, endpoint) {
  commit(types.SET_LOADING, true);

  eTagPoll = new Poll({
    resource: Service,
    method: 'getSentryData',
    data: { endpoint },
    successCallback: ({ data }) => {
      if (!data) {
        return;
      }
      commit(types.SET_ERRORS, data.errors);
      commit(types.SET_EXTERNAL_URL, data.external_url);
      commit(types.SET_LOADING, false);
      dispatch('stopPolling');
    },
    errorCallback: ({ response }) => {
      let errorMessage = '';
      if (response && response.data && response.data.message) {
        errorMessage = response.data.message;
      }
      commit(types.SET_LOADING, false);
      createFlash(
        sprintf(__(`Failed to load errors from Sentry. Error message: %{errorMessage}`), {
          errorMessage,
        }),
      );
    },
  });

  eTagPoll.makeRequest();
}

export const stopPolling = () => {
  if (eTagPoll) eTagPoll.stop();
};

export function restartPolling({ commit }) {
  commit(types.SET_ERRORS, []);
  commit(types.SET_EXTERNAL_URL, '');
  commit(types.SET_LOADING, true);

  if (eTagPoll) eTagPoll.restart();
}

export function setIndexPath({ commit }, path) {
  commit(types.SET_INDEX_PATH, path);
}

export function loadRecentSearches({ commit }) {
  commit(types.LOAD_RECENT_SEARCHES);
}

export function addRecentSearch({ commit }, searchQuery) {
  commit(types.ADD_RECENT_SEARCH, searchQuery);
}

export function clearRecentSearches({ commit }) {
  commit(types.CLEAR_RECENT_SEARCHES);
}

export default () => {};