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

78 lines
1.8 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-12-13 13:39:08 +05:30
import icon from '~/vue_shared/components/icon.vue';
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: {
icon,
timeAgoTooltip,
itemStatsValue,
},
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"
/>
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>