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

publish_method.vue « list « components « package_registry « packages_and_registries « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8ecf433f3abe596052677be22736a41752916c5c (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
<script>
import { GlIcon, GlLink } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';

export default {
  name: 'PublishMethod',
  components: {
    ClipboardButton,
    GlIcon,
    GlLink,
  },
  props: {
    pipeline: {
      type: Object,
      required: false,
      default: null,
    },
  },
  computed: {
    hasPipeline() {
      return Boolean(this.pipeline);
    },
    packageShaShort() {
      return this.pipeline?.sha?.substring(0, 8);
    },
  },
  i18n: {
    COPY_COMMIT_SHA: __('Copy commit SHA'),
    MANUALLY_PUBLISHED: s__('PackageRegistry|Manually Published'),
  },
};
</script>

<template>
  <div class="gl-display-flex gl-align-items-center">
    <template v-if="hasPipeline">
      <gl-icon name="git-merge" class="gl-mr-2" />
      <span data-testid="pipeline-ref" class="gl-mr-2">{{ pipeline.ref }}</span>

      <gl-icon name="commit" class="gl-mr-2" />
      <gl-link data-testid="pipeline-sha" :href="pipeline.commitPath" class="gl-mr-2">{{
        packageShaShort
      }}</gl-link>

      <clipboard-button
        :text="pipeline.sha"
        :title="$options.i18n.COPY_COMMIT_SHA"
        category="tertiary"
        size="small"
      />
    </template>

    <template v-else>
      <gl-icon name="upload" class="gl-mr-2" />
      <span data-testid="manually-published">
        {{ $options.i18n.MANUALLY_PUBLISHED }}
      </span>
    </template>
  </div>
</template>