gitlab-org--gitlab-foss/app/assets/javascripts/groups/components/item_stats.vue

83 lines
2.0 KiB
Vue
Raw Normal View History

<script>
import { GlBadge } from '@gitlab/ui';
import isProjectPendingRemoval from 'ee_else_ce/groups/mixins/is_project_pending_removal';
2018-10-24 19:17:03 +00: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';
2018-10-24 19:17:03 +00:00
export default {
components: {
timeAgoTooltip,
itemStatsValue,
GlBadge,
2018-10-24 19:17:03 +00:00
},
mixins: [isProjectPendingRemoval],
2018-10-24 19:17:03 +00:00
props: {
item: {
type: Object,
required: true,
},
2018-10-24 19:17:03 +00:00
},
computed: {
visibilityIcon() {
return VISIBILITY_TYPE_ICON[this.item.visibility];
},
2018-10-24 19:17:03 +00:00
visibilityTooltip() {
if (this.item.type === ITEM_TYPE.GROUP) {
return GROUP_VISIBILITY_TYPE[this.item.visibility];
}
return PROJECT_VISIBILITY_TYPE[this.item.visibility];
},
2018-10-24 19:17:03 +00:00
isProject() {
return this.item.type === ITEM_TYPE.PROJECT;
},
isGroup() {
return this.item.type === ITEM_TYPE.GROUP;
},
},
};
</script>
<template>
<div class="stats gl-text-gray-500">
<item-stats-value
v-if="isGroup"
:title="__('Subgroups')"
2018-01-04 16:03:25 +00:00
:value="item.subgroupCount"
css-class="number-subgroups gl-ml-5"
icon-name="folder-o"
/>
<item-stats-value
v-if="isGroup"
:title="__('Projects')"
2018-01-04 16:03:25 +00:00
:value="item.projectCount"
css-class="number-projects gl-ml-5"
2018-06-11 09:49:47 +00:00
icon-name="bookmark"
/>
<item-stats-value
v-if="isGroup"
:title="__('Members')"
2018-01-04 16:03:25 +00:00
:value="item.memberCount"
css-class="number-users gl-ml-5"
2018-06-11 09:49:47 +00:00
icon-name="users"
/>
<item-stats-value
v-if="isProject"
2018-06-11 09:49:47 +00:00
:value="item.starCount"
css-class="project-stars"
icon-name="star"
/>
<div v-if="isProjectPendingRemoval">
<gl-badge variant="warning">{{ __('pending removal') }}</gl-badge>
</div>
2018-11-16 20:07:38 +00:00
<div v-if="isProject" class="last-updated">
<time-ago-tooltip :time="item.updatedAt" tooltip-placement="bottom" />
</div>
</div>
</template>