summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipelines/components/pipeline_url.vue
blob: be4b37f3c8c90ae86246c35efb799b66742c046c (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<script>
import { GlLink, GlTooltipDirective } from '@gitlab-org/gitlab-ui';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import popover from '~/vue_shared/directives/popover';

export default {
  components: {
    UserAvatarLink,
    GlLink,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
    popover,
  },
  props: {
    pipeline: {
      type: Object,
      required: true,
    },
    autoDevopsHelpPath: {
      type: String,
      required: true,
    },
  },
  computed: {
    user() {
      return this.pipeline.user;
    },
    popoverOptions() {
      return {
        html: true,
        trigger: 'focus',
        placement: 'top',
        title: `<div class="autodevops-title">
            This pipeline makes use of a predefined CI/CD configuration enabled by <b>Auto DevOps.</b>
          </div>`,
        content: `<a
            class="autodevops-link"
            href="${this.autoDevopsHelpPath}"
            target="_blank"
            rel="noopener noreferrer nofollow">
            Learn more about Auto DevOps
          </a>`,
      };
    },
  },
};
</script>
<template>
  <div class="table-section section-15 d-none d-sm-none d-md-block pipeline-tags">
    <gl-link
      :href="pipeline.path"
      class="js-pipeline-url-link"
    >
      <span class="pipeline-id">#{{ pipeline.id }}</span>
    </gl-link>
    <span>by</span>
    <user-avatar-link
      v-if="user"
      :link-href="pipeline.user.path"
      :img-src="pipeline.user.avatar_url"
      :tooltip-text="pipeline.user.name"
      class="js-pipeline-url-user"
    />
    <span
      v-if="!user"
      class="js-pipeline-url-api api">
      API
    </span>
    <div class="label-container">
      <span
        v-if="pipeline.flags.latest"
        v-gl-tooltip
        class="js-pipeline-url-latest badge badge-success"
        title="Latest pipeline for this branch"
      >
        latest
      </span>
      <span
        v-if="pipeline.flags.yaml_errors"
        v-gl-tooltip
        :title="pipeline.yaml_errors"
        class="js-pipeline-url-yaml badge badge-danger"
      >
        yaml invalid
      </span>
      <span
        v-if="pipeline.flags.failure_reason"
        v-gl-tooltip
        :title="pipeline.failure_reason"
        class="js-pipeline-url-failure badge badge-danger"
      >
        error
      </span>
      <gl-link
        v-if="pipeline.flags.auto_devops"
        v-popover="popoverOptions"
        tabindex="0"
        class="js-pipeline-url-autodevops badge badge-info autodevops-badge"
        role="button"
      >
        Auto DevOps
      </gl-link>
      <span
        v-if="pipeline.flags.stuck"
        class="js-pipeline-url-stuck badge badge-warning"
      >
        stuck
      </span>
    </div>
  </div>
</template>