2018-03-17 18:26:18 +05:30
|
|
|
<script>
|
2020-01-01 13:55:28 +05:30
|
|
|
import { GlBadge } from '@gitlab/ui';
|
2020-10-24 23:57:45 +05:30
|
|
|
import isProjectPendingRemoval from 'ee_else_ce/groups/mixins/is_project_pending_removal';
|
2018-12-13 13:39:08 +05:30
|
|
|
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';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
timeAgoTooltip,
|
|
|
|
itemStatsValue,
|
2020-01-01 13:55:28 +05:30
|
|
|
GlBadge,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
2020-01-01 13:55:28 +05:30
|
|
|
mixins: [isProjectPendingRemoval],
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
visibilityIcon() {
|
|
|
|
return VISIBILITY_TYPE_ICON[this.item.visibility];
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
visibilityTooltip() {
|
|
|
|
if (this.item.type === ITEM_TYPE.GROUP) {
|
|
|
|
return GROUP_VISIBILITY_TYPE[this.item.visibility];
|
|
|
|
}
|
|
|
|
return PROJECT_VISIBILITY_TYPE[this.item.visibility];
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
isProject() {
|
|
|
|
return this.item.type === ITEM_TYPE.PROJECT;
|
|
|
|
},
|
|
|
|
isGroup() {
|
|
|
|
return this.item.type === ITEM_TYPE.GROUP;
|
|
|
|
},
|
|
|
|
},
|
2021-11-11 11:23:49 +05:30
|
|
|
methods: {
|
|
|
|
displayValue(value) {
|
|
|
|
return this.isGroup && value !== undefined;
|
|
|
|
},
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
};
|
2018-03-17 18:26:18 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-10-24 23:57:45 +05:30
|
|
|
<div class="stats gl-text-gray-500">
|
2018-03-17 18:26:18 +05:30
|
|
|
<item-stats-value
|
2021-11-11 11:23:49 +05:30
|
|
|
v-if="displayValue(item.subgroupCount)"
|
2018-03-17 18:26:18 +05:30
|
|
|
:title="__('Subgroups')"
|
|
|
|
:value="item.subgroupCount"
|
2020-06-23 00:09:42 +05:30
|
|
|
css-class="number-subgroups gl-ml-5"
|
2022-06-21 17:19:12 +05:30
|
|
|
icon-name="subgroup"
|
2021-11-11 11:23:49 +05:30
|
|
|
data-testid="subgroups-count"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
|
|
|
<item-stats-value
|
2021-11-11 11:23:49 +05:30
|
|
|
v-if="displayValue(item.projectCount)"
|
2018-03-17 18:26:18 +05:30
|
|
|
:title="__('Projects')"
|
|
|
|
:value="item.projectCount"
|
2020-06-23 00:09:42 +05:30
|
|
|
css-class="number-projects gl-ml-5"
|
2022-06-21 17:19:12 +05:30
|
|
|
icon-name="project"
|
2021-11-11 11:23:49 +05:30
|
|
|
data-testid="projects-count"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
|
|
|
<item-stats-value
|
|
|
|
v-if="isGroup"
|
2022-05-07 20:08:51 +05:30
|
|
|
:title="__('Direct members')"
|
2018-03-17 18:26:18 +05:30
|
|
|
:value="item.memberCount"
|
2020-06-23 00:09:42 +05:30
|
|
|
css-class="number-users gl-ml-5"
|
2018-11-08 19:23:39 +05:30
|
|
|
icon-name="users"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
|
|
|
<item-stats-value
|
|
|
|
v-if="isProject"
|
2018-11-08 19:23:39 +05:30
|
|
|
:value="item.starCount"
|
2018-03-17 18:26:18 +05:30
|
|
|
css-class="project-stars"
|
|
|
|
icon-name="star"
|
|
|
|
/>
|
2020-01-01 13:55:28 +05:30
|
|
|
<div v-if="isProjectPendingRemoval">
|
2021-09-30 23:02:18 +05:30
|
|
|
<gl-badge variant="warning">{{ __('pending deletion') }}</gl-badge>
|
2020-01-01 13:55:28 +05:30
|
|
|
</div>
|
2019-02-15 15:39:39 +05:30
|
|
|
<div v-if="isProject" class="last-updated">
|
2022-03-02 08:16:31 +05:30
|
|
|
<time-ago-tooltip :time="item.lastActivityAt" tooltip-placement="bottom" />
|
2018-03-17 18:26:18 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|