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

stuck_block.vue « components « job_details « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b8ff0b032cc523048d9c0b8914aee49ae1112be3 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<script>
import { GlAlert, GlBadge, GlLink, GlSprintf } from '@gitlab/ui';
import { s__ } from '~/locale';
import { DOCS_URL } from 'jh_else_ce/lib/utils/url_utility';
/**
 * Renders Stuck Runners block for job's view.
 */
export default {
  components: {
    GlAlert,
    GlBadge,
    GlLink,
    GlSprintf,
  },
  props: {
    hasOfflineRunnersForProject: {
      type: Boolean,
      required: true,
    },
    tags: {
      type: Array,
      required: false,
      default: () => [],
    },
    runnersPath: {
      type: String,
      required: true,
    },
  },
  computed: {
    hasNoRunnersWithCorrespondingTags() {
      return this.tags.length > 0;
    },
    protectedBranchSettingsDocsLink() {
      return `${DOCS_URL}/runner/security/index.html#reduce-the-security-risk-of-using-privileged-containers`;
    },
    stuckData() {
      if (this.hasNoRunnersWithCorrespondingTags) {
        return {
          text: s__(
            `Job|This job is stuck because of one of the following problems. There are no active runners online, no runners for the %{linkStart}protected branch%{linkEnd}, or no runners that match all of the job's tags:`,
          ),
          dataTestId: 'job-stuck-with-tags',
          showTags: true,
        };
      }
      if (this.hasOfflineRunnersForProject) {
        return {
          text: s__(`Job|This job is stuck because the project
                doesn't have any runners online assigned to it.`),
          dataTestId: 'job-stuck-no-runners',
          showTags: false,
        };
      }

      return {
        text: s__(`Job|This job is stuck because you don't
              have any active runners that can run this job.`),
        dataTestId: 'job-stuck-no-active-runners',
        showTags: false,
      };
    },
  },
};
</script>
<template>
  <gl-alert variant="warning" :dismissible="false">
    <p class="gl-mb-0" :data-testid="stuckData.dataTestId">
      <gl-sprintf :message="stuckData.text">
        <template #link="{ content }">
          <a
            class="gl-display-inline-block"
            :href="protectedBranchSettingsDocsLink"
            target="_blank"
          >
            {{ content }}
          </a>
        </template>
      </gl-sprintf>
      <template v-if="stuckData.showTags">
        <gl-badge v-for="tag in tags" :key="tag" size="sm" variant="info">
          {{ tag }}
        </gl-badge>
      </template>
    </p>
    {{ __('Go to project') }}
    <gl-link v-if="runnersPath" :href="runnersPath">
      {{ __('CI settings') }}
    </gl-link>
  </gl-alert>
</template>