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
|
<script>
import { GlIcon, GlLink } from '@gitlab/ui';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import { getCommitLink } from '../utils';
export default {
name: 'PublishMethod',
components: {
ClipboardButton,
GlIcon,
GlLink,
},
props: {
packageEntity: {
type: Object,
required: true,
},
isGroup: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
hasPipeline() {
return Boolean(this.packageEntity.pipeline);
},
packageShaShort() {
return this.packageEntity.pipeline?.sha.substring(0, 8);
},
linkToCommit() {
return getCommitLink(this.packageEntity, this.isGroup);
},
},
};
</script>
<template>
<div class="gl-display-flex gl-align-items-center gl-mb-2">
<template v-if="hasPipeline">
<gl-icon name="git-merge" class="gl-mr-2" />
<span data-testid="pipeline-ref" class="gl-mr-2">{{ packageEntity.pipeline.ref }}</span>
<gl-icon name="commit" class="gl-mr-2" />
<gl-link data-testid="pipeline-sha" :href="linkToCommit" class="gl-mr-2">{{
packageShaShort
}}</gl-link>
<clipboard-button
:text="packageEntity.pipeline.sha"
:title="__('Copy commit SHA')"
css-class="gl-border-0 gl-py-0 gl-px-2"
/>
</template>
<template v-else>
<gl-icon name="upload" class="gl-mr-2" />
<span data-testid="manually-published">
{{ s__('PackageRegistry|Manually Published') }}
</span>
</template>
</div>
</template>
|