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

release_block_footer.vue « components « releases « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3881c83b5c2ce2096e30540b78cdbb377a4c34ec (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<script>
import { GlTooltipDirective, GlLink, GlIcon } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';

export default {
  name: 'ReleaseBlockFooter',
  components: {
    GlIcon,
    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: {
      type: Date,
      required: false,
      default: null,
    },
  },
  computed: {
    releasedAtTimeAgo() {
      return this.timeFormatted(this.releasedAt);
    },
    userImageAltDescription() {
      return this.author && this.author.username
        ? sprintf(__("%{username}'s avatar"), { username: this.author.username })
        : null;
    },
    createdTime() {
      const now = new Date();
      const isFuture = now < new Date(this.releasedAt);
      return isFuture ? __('Will be created') : __('Created');
    },
  },
};
</script>
<template>
  <div>
    <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" />
      <div v-gl-tooltip.bottom :title="commit.title">
        <gl-link v-if="commitPath" :href="commitPath">
          {{ commit.shortId }}
        </gl-link>
        <span v-else>{{ commit.shortId }}</span>
      </div>
    </div>

    <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" />
      <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"
      class="gl-float-left gl-display-flex gl-align-items-center js-author-date-info"
    >
      <span class="gl-text-secondary">{{ createdTime }}&nbsp;</span>
      <template v-if="releasedAt">
        <span
          v-gl-tooltip.bottom
          :title="tooltipTitle(releasedAt)"
          class="gl-text-secondary gl-flex-shrink-0"
        >
          {{ releasedAtTimeAgo }}&nbsp;
        </span>
      </template>

      <div v-if="author" class="gl-display-flex">
        <span class="gl-text-secondary">{{ __('by') }}&nbsp;</span>
        <user-avatar-link
          class="gl-my-n1 gl-display-flex"
          :link-href="author.webUrl"
          :img-src="author.avatarUrl"
          :img-alt="userImageAltDescription"
          :img-size="24"
          :tooltip-text="author.username"
          tooltip-placement="bottom"
        />
      </div>
    </div>
  </div>
</template>