summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/actions/project.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide/stores/actions/project.js')
-rw-r--r--app/assets/javascripts/ide/stores/actions/project.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/project.js b/app/assets/javascripts/ide/stores/actions/project.js
index 75cfd9946d7..46af47d2f81 100644
--- a/app/assets/javascripts/ide/stores/actions/project.js
+++ b/app/assets/javascripts/ide/stores/actions/project.js
@@ -1,11 +1,7 @@
-import Visibility from 'visibilityjs';
import flash from '~/flash';
import { __ } from '~/locale';
import service from '../../services';
import * as types from '../mutation_types';
-import Poll from '../../../lib/utils/poll';
-
-let eTagPoll;
export const getProjectData = ({ commit, state }, { namespace, projectId, force = false } = {}) =>
new Promise((resolve, reject) => {
@@ -85,61 +81,3 @@ export const refreshLastCommitData = ({ commit }, { projectId, branchId } = {})
.catch(() => {
flash(__('Error loading last commit.'), 'alert', document, null, false, true);
});
-
-export const pollSuccessCallBack = ({ commit, state }, { data }) => {
- if (data.pipelines && data.pipelines.length) {
- const lastCommitHash =
- state.projects[state.currentProjectId].branches[state.currentBranchId].commit.id;
- const lastCommitPipeline = data.pipelines.find(
- pipeline => pipeline.commit.id === lastCommitHash,
- );
- commit(types.SET_LAST_COMMIT_PIPELINE, {
- projectId: state.currentProjectId,
- branchId: state.currentBranchId,
- pipeline: lastCommitPipeline || {},
- });
- }
-
- return data;
-};
-
-export const pipelinePoll = ({ getters, dispatch }) => {
- eTagPoll = new Poll({
- resource: service,
- method: 'lastCommitPipelines',
- data: {
- getters,
- },
- successCallback: ({ data }) => dispatch('pollSuccessCallBack', { data }),
- errorCallback: () => {
- flash(
- __('Something went wrong while fetching the latest pipeline status.'),
- 'alert',
- document,
- null,
- false,
- true,
- );
- },
- });
-
- if (!Visibility.hidden()) {
- eTagPoll.makeRequest();
- }
-
- Visibility.change(() => {
- if (!Visibility.hidden()) {
- eTagPoll.restart();
- } else {
- eTagPoll.stop();
- }
- });
-};
-
-export const stopPipelinePolling = () => {
- eTagPoll.stop();
-};
-
-export const restartPipelinePolling = () => {
- eTagPoll.restart();
-};