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

tags_list.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: b34d3a950c0e4525031089374bb00e62bd81f24c (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
<script>
import { GlEmptyState } from '@gitlab/ui';
import RegistryList from '~/packages_and_registries/shared/components/registry_list.vue';
import TagsLoader from '~/packages_and_registries/shared/components/tags_loader.vue';
import TagsListRow from '~/packages_and_registries/harbor_registry/components/tags/tags_list_row.vue';
import {
  NO_ARTIFACTS_TITLE,
  NO_TAGS_MATCHING_FILTERS_TITLE,
  NO_TAGS_MATCHING_FILTERS_DESCRIPTION,
} from '~/packages_and_registries/harbor_registry/constants';

export default {
  name: 'TagsList',
  components: {
    GlEmptyState,
    TagsLoader,
    TagsListRow,
    RegistryList,
  },
  inject: ['noContainersImage'],
  props: {
    tags: {
      type: Array,
      required: true,
    },
    pageInfo: {
      type: Object,
      required: true,
    },
    isLoading: {
      type: Boolean,
      default: false,
      required: false,
    },
  },
  computed: {
    hasNoTags() {
      return this.tags.length === 0;
    },
    emptyStateTitle() {
      return this.filter ? NO_TAGS_MATCHING_FILTERS_TITLE : NO_ARTIFACTS_TITLE;
    },
    emptyStateDescription() {
      return this.filter ? NO_TAGS_MATCHING_FILTERS_DESCRIPTION : '';
    },
  },
  methods: {
    fetchNextPage() {
      this.$emit('next-page');
    },
    fetchPreviousPage() {
      this.$emit('prev-page');
    },
  },
};
</script>

<template>
  <div>
    <tags-loader v-if="isLoading" />
    <gl-empty-state
      v-else-if="hasNoTags"
      :title="emptyStateTitle"
      :svg-path="noContainersImage"
      :description="emptyStateDescription"
      class="gl-mx-auto gl-my-0"
    />
    <registry-list
      v-else
      :pagination="pageInfo"
      :items="tags"
      hidden-delete
      id-property="name"
      @prev-page="fetchPreviousPage"
      @next-page="fetchNextPage"
    >
      <template #default="{ item }">
        <tags-list-row :tag="item" />
      </template>
    </registry-list>
  </div>
</template>