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
|
<script>
import { sprintf } from '~/locale';
import TitleArea from '~/vue_shared/components/registry/title_area.vue';
import {
HARBOR_REGISTRY_TITLE,
LIST_INTRO_TEXT,
imagesCountInfoText,
} from '~/packages_and_registries/harbor_registry/constants';
import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue';
export default {
name: 'HarborListHeader',
components: {
TitleArea,
MetadataItem,
},
props: {
imagesCount: {
type: Number,
default: 0,
required: false,
},
helpPagePath: {
type: String,
default: '',
required: false,
},
metadataLoading: {
type: Boolean,
required: false,
default: false,
},
},
i18n: {
HARBOR_REGISTRY_TITLE,
},
computed: {
imagesCountText() {
const pluralisedString = imagesCountInfoText(this.imagesCount);
return sprintf(pluralisedString, { count: this.imagesCount });
},
infoMessages() {
return [{ text: LIST_INTRO_TEXT, link: this.helpPagePath }];
},
},
};
</script>
<template>
<title-area
:title="$options.i18n.HARBOR_REGISTRY_TITLE"
:info-messages="infoMessages"
:metadata-loading="metadataLoading"
>
<template #right-actions>
<slot name="commands"></slot>
</template>
<template #metadata-count>
<metadata-item
v-if="imagesCount"
data-testid="images-count"
icon="container-image"
:text="imagesCountText"
/>
</template>
</title-area>
</template>
|