summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/packages_and_registries/dependency_proxy/components/manifest_row.vue
blob: 78880b6e3f496ac18759ab9690a616f79bfc6c6d (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
<script>
import { GlSprintf } from '@gitlab/ui';
import ListItem from '~/vue_shared/components/registry/list_item.vue';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { s__ } from '~/locale';

export default {
  name: 'ManifestRow',
  components: {
    GlSprintf,
    ListItem,
    TimeagoTooltip,
  },
  props: {
    manifest: {
      type: Object,
      required: true,
    },
  },
  computed: {
    name() {
      return this.manifest?.imageName.split(':')[0];
    },
    version() {
      return this.manifest?.imageName.split(':')[1];
    },
  },
  i18n: {
    cachedAgoMessage: s__('DependencyProxy|Cached %{time}'),
  },
};
</script>

<template>
  <list-item>
    <template #left-primary> {{ name }} </template>
    <template #left-secondary> {{ version }} </template>
    <template #right-primary> &nbsp; </template>
    <template #right-secondary>
      <timeago-tooltip :time="manifest.createdAt" data-testid="cached-message">
        <template #default="{ timeAgo }">
          <gl-sprintf :message="$options.i18n.cachedAgoMessage">
            <template #time>{{ timeAgo }}</template>
          </gl-sprintf>
        </template>
      </timeago-tooltip>
    </template>
  </list-item>
</template>