summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/jobs/components/table/cells/pipeline_cell.vue
blob: 1a6d1a341b0bb37476dbefd060317dfa8cdd1e09 (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
<script>
import { GlAvatar, GlLink } from '@gitlab/ui';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';

export default {
  components: {
    GlAvatar,
    GlLink,
  },
  props: {
    job: {
      type: Object,
      required: true,
    },
  },
  computed: {
    pipelineId() {
      const id = getIdFromGraphQLId(this.job.pipeline.id);
      return `#${id}`;
    },
    pipelinePath() {
      return this.job.pipeline?.path;
    },
    pipelineUserAvatar() {
      return this.job.pipeline?.user?.avatarUrl;
    },
    userPath() {
      return this.job.pipeline?.user?.webPath;
    },
    showAvatar() {
      return this.job.pipeline?.user;
    },
  },
};
</script>

<template>
  <div>
    <div class="gl-text-truncate">
      <gl-link class="gl-text-gray-500!" :href="pipelinePath" data-testid="pipeline-id">
        {{ pipelineId }}
      </gl-link>
    </div>
    <div>
      <span>{{ __('created by') }}</span>
      <gl-link v-if="showAvatar" :href="userPath" data-testid="pipeline-user-link">
        <gl-avatar :src="pipelineUserAvatar" :size="16" />
      </gl-link>
      <span v-else>{{ __('API') }}</span>
    </div>
  </div>
</template>