debian-mirror-gitlab/app/assets/javascripts/groups/components/item_stats.vue

83 lines
2 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2020-01-01 13:55:28 +05:30
import { GlBadge } from '@gitlab/ui';
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';
2020-01-01 13:55:28 +05:30
import isProjectPendingRemoval from 'ee_else_ce/groups/mixins/is_project_pending_removal';
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;
},
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
<div class="stats">
<item-stats-value
v-if="isGroup"
:title="__('Subgroups')"
:value="item.subgroupCount"
2018-11-08 19:23:39 +05:30
css-class="number-subgroups"
2019-09-30 21:07:59 +05:30
icon-name="folder-o"
2018-03-17 18:26:18 +05:30
/>
<item-stats-value
v-if="isGroup"
:title="__('Projects')"
:value="item.projectCount"
2018-11-08 19:23:39 +05:30
css-class="number-projects"
icon-name="bookmark"
2018-03-17 18:26:18 +05:30
/>
<item-stats-value
v-if="isGroup"
:title="__('Members')"
:value="item.memberCount"
2018-11-08 19:23:39 +05:30
css-class="number-users"
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">
<gl-badge variant="warning">{{ __('pending removal') }}</gl-badge>
</div>
2019-02-15 15:39:39 +05:30
<div v-if="isProject" class="last-updated">
<time-ago-tooltip :time="item.updatedAt" tooltip-placement="bottom" />
2018-03-17 18:26:18 +05:30
</div>
</div>
</template>