diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 21:09:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 21:09:44 +0300 |
commit | 2c156e3c7bbade01c36eee18327f1ced6eebea79 (patch) | |
tree | 115fa8dbf6bc05037378b380311d31acb805f54c /app/assets/javascripts/diffs/store/actions.js | |
parent | 8e129497b2565b8c595ef4f806d9a9595ca654e5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/diffs/store/actions.js')
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index bd85105ccb4..18bbdf402ee 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -1,8 +1,10 @@ import Vue from 'vue'; import Cookies from 'js-cookie'; +import Poll from '~/lib/utils/poll'; import axios from '~/lib/utils/axios_utils'; +import httpStatusCodes from '~/lib/utils/http_status'; import createFlash from '~/flash'; -import { s__ } from '~/locale'; +import { __, s__ } from '~/locale'; import { handleLocationHash, historyPushState, scrollToElement } from '~/lib/utils/common_utils'; import { mergeUrlParams, getLocationHash } from '~/lib/utils/url_utility'; import TreeWorker from '../workers/tree_worker'; @@ -43,6 +45,7 @@ export const setBaseConfig = ({ commit }, options) => { endpoint, endpointMetadata, endpointBatch, + endpointCoverage, projectPath, dismissEndpoint, showSuggestPopover, @@ -52,6 +55,7 @@ export const setBaseConfig = ({ commit }, options) => { endpoint, endpointMetadata, endpointBatch, + endpointCoverage, projectPath, dismissEndpoint, showSuggestPopover, @@ -170,6 +174,26 @@ export const fetchDiffFilesMeta = ({ commit, state }) => { .catch(() => worker.terminate()); }; +export const fetchCoverageFiles = ({ commit, state }) => { + const coveragePoll = new Poll({ + resource: { + getCoverageReports: endpoint => axios.get(endpoint), + }, + data: state.endpointCoverage, + method: 'getCoverageReports', + successCallback: ({ status, data }) => { + if (status === httpStatusCodes.OK) { + commit(types.SET_COVERAGE_DATA, data); + + coveragePoll.stop(); + } + }, + errorCallback: () => createFlash(__('Something went wrong on our end. Please try again!')), + }); + + coveragePoll.makeRequest(); +}; + export const setHighlightedRow = ({ commit }, lineCode) => { const fileHash = lineCode.split('_')[0]; commit(types.SET_HIGHLIGHTED_ROW, lineCode); |