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

84 lines
1.9 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"
icon-name="folder"
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"
/>
<item-stats-value
:icon-name="visibilityIcon"
:title="visibilityTooltip"
2018-11-08 19:23:39 +05:30
css-class="item-visibility"
tooltip-placement="left"
2018-03-17 18:26:18 +05:30
/>
2018-12-23 12:14:25 +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>