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
|
<script>
import { __, s__ } from '~/locale';
import { RESOURCE_TYPE_GROUPS, RESOURCE_TYPE_PROJECTS } from '../../constants';
import AssociationCountCard from './association_count_card.vue';
export default {
name: 'AssociationCounts',
i18n: {
groups: __('Groups'),
projects: __('Projects'),
users: __('Users'),
viewAll: __('View all'),
manage: s__('Organization|Manage'),
},
components: { AssociationCountCard },
props: {
associationCounts: {
type: Object,
required: true,
},
groupsAndProjectsOrganizationPath: {
type: String,
required: true,
},
},
computed: {
groupsLinkHref() {
return `${this.groupsAndProjectsOrganizationPath}?display=${RESOURCE_TYPE_GROUPS}`;
},
projectsLinkHref() {
return `${this.groupsAndProjectsOrganizationPath}?display=${RESOURCE_TYPE_PROJECTS}`;
},
associationCountCards() {
return [
{
title: this.$options.i18n.groups,
iconName: 'group',
count: this.associationCounts.groups,
linkHref: this.groupsLinkHref,
},
{
title: this.$options.i18n.projects,
iconName: 'project',
count: this.associationCounts.projects,
linkHref: this.projectsLinkHref,
},
{
title: this.$options.i18n.users,
iconName: 'users',
count: this.associationCounts.users,
linkText: this.$options.i18n.manage,
// TODO: update `linkHref` prop to point to users route
// https://gitlab.com/gitlab-org/gitlab/-/issues/409313
linkHref: '/',
},
];
},
},
};
</script>
<template>
<div class="gl-display-grid gl-lg-grid-template-columns-4 gl-mt-5 gl-gap-5">
<association-count-card
v-for="props in associationCountCards"
:key="props.title"
v-bind="props"
class="gl-w-full"
/>
</div>
</template>
|