2020-03-13 15:44:24 +05:30
|
|
|
<script>
|
2020-11-24 15:15:51 +05:30
|
|
|
import { GlTooltipDirective, GlLink, GlIcon } from '@gitlab/ui';
|
2020-03-13 15:44:24 +05:30
|
|
|
import { __, sprintf } from '~/locale';
|
|
|
|
import timeagoMixin from '~/vue_shared/mixins/timeago';
|
|
|
|
import ReleaseBlockAuthor from './release_block_author.vue';
|
|
|
|
import ReleaseBlockMilestones from './release_block_milestones.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ReleaseBlockMetadata',
|
|
|
|
components: {
|
2020-11-24 15:15:51 +05:30
|
|
|
GlIcon,
|
2020-03-13 15:44:24 +05:30
|
|
|
GlLink,
|
|
|
|
ReleaseBlockAuthor,
|
|
|
|
ReleaseBlockMilestones,
|
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
|
|
|
mixins: [timeagoMixin],
|
|
|
|
props: {
|
|
|
|
release: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
author() {
|
|
|
|
return this.release.author;
|
|
|
|
},
|
|
|
|
commit() {
|
|
|
|
return this.release.commit || {};
|
|
|
|
},
|
|
|
|
commitUrl() {
|
2020-04-08 14:13:33 +05:30
|
|
|
return this.release.commitPath;
|
2020-03-13 15:44:24 +05:30
|
|
|
},
|
|
|
|
hasAuthor() {
|
|
|
|
return Boolean(this.author);
|
|
|
|
},
|
|
|
|
releasedTimeAgo() {
|
2020-05-24 23:13:21 +05:30
|
|
|
const now = new Date();
|
|
|
|
const isFuture = now < new Date(this.release.releasedAt);
|
|
|
|
const time = this.timeFormatted(this.release.releasedAt);
|
|
|
|
return isFuture
|
|
|
|
? sprintf(__('will be released %{time}'), { time })
|
|
|
|
: sprintf(__('released %{time}'), { time });
|
2020-03-13 15:44:24 +05:30
|
|
|
},
|
|
|
|
shouldRenderMilestones() {
|
|
|
|
return Boolean(this.release.milestones?.length);
|
|
|
|
},
|
|
|
|
tagUrl() {
|
2020-04-08 14:13:33 +05:30
|
|
|
return this.release.tagPath;
|
2020-03-13 15:44:24 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="card-subtitle d-flex flex-wrap text-secondary">
|
2020-06-23 00:09:42 +05:30
|
|
|
<div class="gl-mr-3">
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="commit" class="align-middle" />
|
2020-03-13 15:44:24 +05:30
|
|
|
<gl-link v-if="commitUrl" v-gl-tooltip.bottom :title="commit.title" :href="commitUrl">
|
2020-04-08 14:13:33 +05:30
|
|
|
{{ commit.shortId }}
|
2020-03-13 15:44:24 +05:30
|
|
|
</gl-link>
|
2020-04-08 14:13:33 +05:30
|
|
|
<span v-else v-gl-tooltip.bottom :title="commit.title">{{ commit.shortId }}</span>
|
2020-03-13 15:44:24 +05:30
|
|
|
</div>
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
<div class="gl-mr-3">
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="tag" class="align-middle" />
|
2020-03-13 15:44:24 +05:30
|
|
|
<gl-link v-if="tagUrl" v-gl-tooltip.bottom :title="__('Tag')" :href="tagUrl">
|
2020-04-08 14:13:33 +05:30
|
|
|
{{ release.tagName }}
|
2020-03-13 15:44:24 +05:30
|
|
|
</gl-link>
|
2020-04-08 14:13:33 +05:30
|
|
|
<span v-else v-gl-tooltip.bottom :title="__('Tag')">{{ release.tagName }}</span>
|
2020-03-13 15:44:24 +05:30
|
|
|
</div>
|
|
|
|
|
|
|
|
<release-block-milestones v-if="shouldRenderMilestones" :milestones="release.milestones" />
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
<div class="gl-mr-2">
|
2020-03-13 15:44:24 +05:30
|
|
|
•
|
2020-05-24 23:13:21 +05:30
|
|
|
<span
|
|
|
|
v-gl-tooltip.bottom
|
|
|
|
class="js-release-date-info"
|
|
|
|
:title="tooltipTitle(release.releasedAt)"
|
|
|
|
>
|
2020-03-13 15:44:24 +05:30
|
|
|
{{ releasedTimeAgo }}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<release-block-author v-if="hasAuthor" :author="author" />
|
|
|
|
</div>
|
|
|
|
</template>
|