2020-10-24 23:57:45 +05:30
|
|
|
<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>
|
2020-11-24 15:15:51 +05:30
|
|
|
<div class="gl-display-flex gl-align-items-center">
|
2020-10-24 23:57:45 +05:30
|
|
|
<template v-if="hasPipeline">
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="git-merge" class="gl-mr-2" />
|
|
|
|
<span data-testid="pipeline-ref" class="gl-mr-2">{{ packageEntity.pipeline.ref }}</span>
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="commit" class="gl-mr-2" />
|
|
|
|
<gl-link data-testid="pipeline-sha" :href="linkToCommit" class="gl-mr-2">{{
|
|
|
|
packageShaShort
|
|
|
|
}}</gl-link>
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
<clipboard-button
|
|
|
|
:text="packageEntity.pipeline.sha"
|
|
|
|
:title="__('Copy commit SHA')"
|
2020-11-24 15:15:51 +05:30
|
|
|
css-class="gl-border-0 gl-py-0 gl-px-2"
|
2020-10-24 23:57:45 +05:30
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-else>
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="upload" class="gl-mr-2" />
|
|
|
|
<span data-testid="manually-published">
|
|
|
|
{{ s__('PackageRegistry|Manually Published') }}
|
|
|
|
</span>
|
2020-10-24 23:57:45 +05:30
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|