debian-mirror-gitlab/app/assets/javascripts/releases/components/release_block_footer.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

125 lines
3.1 KiB
Vue
Raw Normal View History

2019-12-26 22:10:19 +05:30
<script>
2020-11-24 15:15:51 +05:30
import { GlTooltipDirective, GlLink, GlIcon } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { __, sprintf } from '~/locale';
2019-12-26 22:10:19 +05:30
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
export default {
name: 'ReleaseBlockFooter',
components: {
2020-11-24 15:15:51 +05:30
GlIcon,
2019-12-26 22:10:19 +05:30
GlLink,
UserAvatarLink,
},
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [timeagoMixin],
props: {
commit: {
type: Object,
required: false,
default: null,
},
commitPath: {
type: String,
required: false,
default: '',
},
tagName: {
type: String,
required: false,
default: '',
},
tagPath: {
type: String,
required: false,
default: '',
},
author: {
type: Object,
required: false,
default: null,
},
releasedAt: {
2022-08-13 15:12:31 +05:30
type: Date,
2019-12-26 22:10:19 +05:30
required: false,
2022-08-13 15:12:31 +05:30
default: null,
2019-12-26 22:10:19 +05:30
},
},
computed: {
releasedAtTimeAgo() {
2020-01-01 13:55:28 +05:30
return this.timeFormatted(this.releasedAt);
2019-12-26 22:10:19 +05:30
},
userImageAltDescription() {
return this.author && this.author.username
? sprintf(__("%{username}'s avatar"), { username: this.author.username })
: null;
},
2020-05-24 23:13:21 +05:30
createdTime() {
const now = new Date();
const isFuture = now < new Date(this.releasedAt);
return isFuture ? __('Will be created') : __('Created');
},
2019-12-26 22:10:19 +05:30
},
};
</script>
<template>
<div>
2022-08-13 15:12:31 +05:30
<div
v-if="commit"
class="gl-float-left gl-mr-5 gl-display-flex gl-align-items-center js-commit-info"
>
<gl-icon ref="commitIcon" name="commit" class="gl-mr-2" />
2019-12-26 22:10:19 +05:30
<div v-gl-tooltip.bottom :title="commit.title">
<gl-link v-if="commitPath" :href="commitPath">
2020-04-08 14:13:33 +05:30
{{ commit.shortId }}
2019-12-26 22:10:19 +05:30
</gl-link>
2020-04-08 14:13:33 +05:30
<span v-else>{{ commit.shortId }}</span>
2019-12-26 22:10:19 +05:30
</div>
</div>
2022-08-13 15:12:31 +05:30
<div
v-if="tagName"
class="gl-float-left gl-mr-5 gl-display-flex gl-align-items-center js-tag-info"
>
<gl-icon name="tag" class="gl-mr-2" />
2019-12-26 22:10:19 +05:30
<div v-gl-tooltip.bottom :title="__('Tag')">
<gl-link v-if="tagPath" :href="tagPath">
{{ tagName }}
</gl-link>
<span v-else>{{ tagName }}</span>
</div>
</div>
<div
v-if="releasedAt || author"
2022-08-13 15:12:31 +05:30
class="gl-float-left gl-display-flex gl-align-items-center js-author-date-info"
2019-12-26 22:10:19 +05:30
>
2022-08-13 15:12:31 +05:30
<span class="gl-text-secondary">{{ createdTime }}&nbsp;</span>
2019-12-26 22:10:19 +05:30
<template v-if="releasedAt">
<span
v-gl-tooltip.bottom
:title="tooltipTitle(releasedAt)"
2022-08-13 15:12:31 +05:30
class="gl-text-secondary gl-flex-shrink-0"
2019-12-26 22:10:19 +05:30
>
{{ releasedAtTimeAgo }}&nbsp;
</span>
</template>
2022-08-13 15:12:31 +05:30
<div v-if="author" class="gl-display-flex">
<span class="gl-text-secondary">{{ __('by') }}&nbsp;</span>
2019-12-26 22:10:19 +05:30
<user-avatar-link
2022-08-13 15:12:31 +05:30
class="gl-my-n1 gl-display-flex"
2020-04-08 14:13:33 +05:30
:link-href="author.webUrl"
:img-src="author.avatarUrl"
2019-12-26 22:10:19 +05:30
:img-alt="userImageAltDescription"
2022-06-21 17:19:12 +05:30
:img-size="24"
2019-12-26 22:10:19 +05:30
:tooltip-text="author.username"
tooltip-placement="bottom"
/>
</div>
</div>
</div>
</template>