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

details_header.vue « details « 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: bfb097601d5134e28732944a54c790ec1fdc073e (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
<script>
import { isEmpty } from 'lodash';
import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue';
import TitleArea from '~/vue_shared/components/registry/title_area.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import {
  ROOT_IMAGE_TEXT,
  EMPTY_ARTIFACTS_LABEL,
  artifactsLabel,
} from '~/packages_and_registries/harbor_registry/constants/index';

export default {
  name: 'DetailsHeader',
  components: { TitleArea, MetadataItem },
  mixins: [timeagoMixin],
  props: {
    imagesDetail: {
      type: Object,
      required: true,
    },
  },
  computed: {
    artifactCountText() {
      if (isEmpty(this.imagesDetail)) {
        return EMPTY_ARTIFACTS_LABEL;
      }
      return artifactsLabel(this.imagesDetail.artifactCount);
    },
    repositoryFullName() {
      return this.imagesDetail.name || ROOT_IMAGE_TEXT;
    },
  },
};
</script>

<template>
  <title-area>
    <template #title>
      <span data-testid="title">
        {{ repositoryFullName }}
      </span>
    </template>
    <template #metadata-tags-count>
      <metadata-item icon="package" :text="artifactCountText" data-testid="artifacts-count" />
    </template>
  </title-area>
</template>