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

tags_list_row.vue « tags « components « harbor_registry « packages_and_registries « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 63e046c1abc2a1f1110667e4946c9aaab60179e7 (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
<script>
import { GlSprintf } from '@gitlab/ui';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ListItem from '~/vue_shared/components/registry/list_item.vue';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { CREATED_AT_LABEL } from '~/packages_and_registries/harbor_registry/constants';
import { tagPullCommand } from '~/packages_and_registries/harbor_registry/utils';

export default {
  name: 'TagsListRow',
  components: {
    GlSprintf,
    ListItem,
    ClipboardButton,
    TimeAgoTooltip,
  },
  inject: ['harborIntegrationProjectName', 'repositoryUrl'],
  props: {
    tag: {
      type: Object,
      required: true,
    },
  },
  i18n: {
    createdAtLabel: CREATED_AT_LABEL,
  },
  methods: {
    getPullCommand(tagName) {
      if (tagName) {
        const { image } = this.$route.params;

        return tagPullCommand({
          imageName: image,
          tag: tagName,
          repositoryUrl: this.repositoryUrl,
          harborProjectName: this.harborIntegrationProjectName,
        });
      }

      return '';
    },
  },
};
</script>

<template>
  <list-item v-bind="$attrs">
    <template #left-primary>
      <div class="gl-display-flex gl-align-items-center">
        <div
          data-testid="name"
          class="gl-text-overflow-ellipsis gl-overflow-hidden gl-white-space-nowrap"
        >
          {{ tag.name }}
        </div>
        <clipboard-button
          :title="getPullCommand(tag.name)"
          :text="getPullCommand(tag.name)"
          category="tertiary"
        />
      </div>
    </template>

    <template #right-primary>
      <span data-testid="time">
        <gl-sprintf :message="$options.i18n.createdAtLabel">
          <template #timeInfo>
            <time-ago-tooltip :time="tag.pushTime" />
          </template>
        </gl-sprintf>
      </span>
    </template>
  </list-item>
</template>