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

associations_list.vue « associations « components « users « admin « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 12f98a02809054cf8d6aea7725ce0d64ac0d5afb (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
<script>
import { GlAlert } from '@gitlab/ui';
import { s__ } from '~/locale';
import AssociationsListItem from './associations_list_item.vue';

export default {
  i18n: {
    errorMessage: s__(
      "AdminUsers|An error occurred while fetching this user's contributions, and the request cannot return the number of issues, merge requests, groups, and projects linked to this user. If you proceed with deleting the user, all their contributions will still be deleted.",
    ),
  },
  components: {
    AssociationsListItem,
    GlAlert,
  },
  props: {
    associationsCount: {
      type: [Object, Error],
      required: true,
    },
  },
  computed: {
    hasError() {
      return this.associationsCount instanceof Error;
    },
    hasAssociations() {
      return Object.values(this.associationsCount).some((count) => count > 0);
    },
  },
};
</script>

<template>
  <gl-alert v-if="hasError" class="gl-mb-5" variant="danger" :dismissible="false">{{
    $options.i18n.errorMessage
  }}</gl-alert>
  <ul v-else-if="hasAssociations" class="gl-mb-5">
    <associations-list-item
      v-if="associationsCount.groups_count"
      :message="n__('%{count} group', '%{count} groups', associationsCount.groups_count)"
      :count="associationsCount.groups_count"
    />
    <associations-list-item
      v-if="associationsCount.projects_count"
      :message="n__('%{count} project', '%{count} projects', associationsCount.projects_count)"
      :count="associationsCount.projects_count"
    />
    <associations-list-item
      v-if="associationsCount.issues_count"
      :message="n__('%{count} issue', '%{count} issues', associationsCount.issues_count)"
      :count="associationsCount.issues_count"
    />
    <associations-list-item
      v-if="associationsCount.merge_requests_count"
      :message="
        n__(
          '%{count} merge request',
          '%{count} merge requests',
          associationsCount.merge_requests_count,
        )
      "
      :count="associationsCount.merge_requests_count"
    />
  </ul>
</template>