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

pipelines_table_wrapper.vue « pipelines « commit « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f9b95c233adbd9df47161120e9452602eb644303 (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
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import getMergeRequestPipelines from '~/ci/merge_requests/graphql/queries/get_merge_request_pipelines.query.graphql';
import { createAlert } from '~/alert';
import { __ } from '~/locale';
import { getQueryHeaders } from '~/ci/pipeline_details/graph/utils';
import { graphqlEtagMergeRequestPipelines } from '~/ci/pipeline_details/utils';

export default {
  components: {
    GlLoadingIcon,
  },
  inject: ['graphqlPath', 'mergeRequestId', 'targetProjectFullPath'],
  data() {
    return {
      pipelines: [],
    };
  },
  apollo: {
    pipelines: {
      query: getMergeRequestPipelines,
      context() {
        return getQueryHeaders(this.graphqlResourceEtag);
      },
      pollInterval: 10000,
      variables() {
        return {
          fullPath: this.targetProjectFullPath,
          mergeRequestIid: String(this.mergeRequestId),
        };
      },
      update(data) {
        return data?.project?.mergeRequest?.pipelines?.nodes || [];
      },
      error() {
        createAlert({ message: this.$options.i18n.fetchError });
      },
    },
  },
  computed: {
    graphqlResourceEtag() {
      return graphqlEtagMergeRequestPipelines(this.graphqlPath, this.mergeRequestId);
    },
    isLoading() {
      return this.$apollo.queries.pipelines.loading;
    },
  },
  i18n: {
    fetchError: __("There was an error fetching this merge request's pipelines."),
  },
};
</script>
<template>
  <div class="gl-mt-3">
    <gl-loading-icon v-if="isLoading" size="lg" />
    <ul v-else>
      <li v-for="pipeline in pipelines" :key="pipeline.id">{{ pipeline.path }}</li>
    </ul>
  </div>
</template>