2017-10-04 10:10:24 -04:00
|
|
|
<script>
|
2019-12-17 10:08:15 -05:00
|
|
|
import { GlBadge } from '@gitlab/ui';
|
2020-08-17 17:09:56 -04:00
|
|
|
import isProjectPendingRemoval from 'ee_else_ce/groups/mixins/is_project_pending_removal';
|
2018-10-24 15:17:03 -04:00
|
|
|
import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
|
|
|
|
import {
|
|
|
|
ITEM_TYPE,
|
|
|
|
VISIBILITY_TYPE_ICON,
|
|
|
|
GROUP_VISIBILITY_TYPE,
|
|
|
|
PROJECT_VISIBILITY_TYPE,
|
|
|
|
} from '../constants';
|
|
|
|
import itemStatsValue from './item_stats_value.vue';
|
2017-10-04 10:10:24 -04:00
|
|
|
|
2018-10-24 15:17:03 -04:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
timeAgoTooltip,
|
|
|
|
itemStatsValue,
|
2019-12-17 10:08:15 -05:00
|
|
|
GlBadge,
|
2018-10-24 15:17:03 -04:00
|
|
|
},
|
2019-12-17 10:08:15 -05:00
|
|
|
mixins: [isProjectPendingRemoval],
|
2018-10-24 15:17:03 -04:00
|
|
|
props: {
|
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
2018-10-24 15:17:03 -04:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
visibilityIcon() {
|
|
|
|
return VISIBILITY_TYPE_ICON[this.item.visibility];
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
2018-10-24 15:17:03 -04:00
|
|
|
visibilityTooltip() {
|
|
|
|
if (this.item.type === ITEM_TYPE.GROUP) {
|
|
|
|
return GROUP_VISIBILITY_TYPE[this.item.visibility];
|
|
|
|
}
|
|
|
|
return PROJECT_VISIBILITY_TYPE[this.item.visibility];
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
2018-10-24 15:17:03 -04:00
|
|
|
isProject() {
|
|
|
|
return this.item.type === ITEM_TYPE.PROJECT;
|
|
|
|
},
|
|
|
|
isGroup() {
|
|
|
|
return this.item.type === ITEM_TYPE.GROUP;
|
|
|
|
},
|
|
|
|
},
|
2021-08-24 14:10:53 -04:00
|
|
|
methods: {
|
|
|
|
displayValue(value) {
|
|
|
|
return this.isGroup && value !== undefined;
|
|
|
|
},
|
|
|
|
},
|
2018-10-24 15:17:03 -04:00
|
|
|
};
|
2017-10-04 10:10:24 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-08-17 17:09:56 -04:00
|
|
|
<div class="stats gl-text-gray-500">
|
2017-12-22 02:35:10 -05:00
|
|
|
<item-stats-value
|
2021-08-24 14:10:53 -04:00
|
|
|
v-if="displayValue(item.subgroupCount)"
|
2018-01-04 11:17:40 -05:00
|
|
|
:title="__('Subgroups')"
|
2018-01-04 11:03:25 -05:00
|
|
|
:value="item.subgroupCount"
|
2020-06-02 02:08:01 -04:00
|
|
|
css-class="number-subgroups gl-ml-5"
|
2022-04-06 11:08:23 -04:00
|
|
|
icon-name="group"
|
2021-08-24 14:10:53 -04:00
|
|
|
data-testid="subgroups-count"
|
2017-12-22 02:35:10 -05:00
|
|
|
/>
|
|
|
|
<item-stats-value
|
2021-08-24 14:10:53 -04:00
|
|
|
v-if="displayValue(item.projectCount)"
|
2018-01-04 11:17:40 -05:00
|
|
|
:title="__('Projects')"
|
2018-01-04 11:03:25 -05:00
|
|
|
:value="item.projectCount"
|
2020-06-02 02:08:01 -04:00
|
|
|
css-class="number-projects gl-ml-5"
|
2022-04-06 11:08:23 -04:00
|
|
|
icon-name="project"
|
2021-08-24 14:10:53 -04:00
|
|
|
data-testid="projects-count"
|
2017-12-22 02:35:10 -05:00
|
|
|
/>
|
|
|
|
<item-stats-value
|
2017-10-04 10:10:24 -04:00
|
|
|
v-if="isGroup"
|
2022-02-28 13:14:03 -05:00
|
|
|
:title="__('Direct members')"
|
2018-01-04 11:03:25 -05:00
|
|
|
:value="item.memberCount"
|
2020-06-02 02:08:01 -04:00
|
|
|
css-class="number-users gl-ml-5"
|
2018-06-11 05:49:47 -04:00
|
|
|
icon-name="users"
|
2017-12-22 02:35:10 -05:00
|
|
|
/>
|
2017-12-26 03:33:41 -05:00
|
|
|
<item-stats-value
|
2017-10-04 10:10:24 -04:00
|
|
|
v-if="isProject"
|
2018-06-11 05:49:47 -04:00
|
|
|
:value="item.starCount"
|
2017-12-26 03:33:41 -05:00
|
|
|
css-class="project-stars"
|
|
|
|
icon-name="star"
|
|
|
|
/>
|
2019-12-17 10:08:15 -05:00
|
|
|
<div v-if="isProjectPendingRemoval">
|
2021-07-13 23:08:27 -04:00
|
|
|
<gl-badge variant="warning">{{ __('pending deletion') }}</gl-badge>
|
2019-12-17 10:08:15 -05:00
|
|
|
</div>
|
2018-11-16 15:07:38 -05:00
|
|
|
<div v-if="isProject" class="last-updated">
|
2022-01-10 10:14:26 -05:00
|
|
|
<time-ago-tooltip :time="item.lastActivityAt" tooltip-placement="bottom" />
|
2017-12-22 02:35:10 -05:00
|
|
|
</div>
|
2017-10-04 10:10:24 -04:00
|
|
|
</div>
|
|
|
|
</template>
|