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

69 lines
1.2 KiB
Vue
Raw Normal View History

2017-12-22 02:34:15 -05:00
<script>
2018-10-24 15:17:03 -04:00
import tooltip from '~/vue_shared/directives/tooltip';
import icon from '~/vue_shared/components/icon.vue';
2017-12-22 02:34:15 -05:00
2018-10-24 15:17:03 -04:00
export default {
components: {
icon,
},
directives: {
tooltip,
},
props: {
title: {
type: String,
required: false,
default: '',
2017-12-22 02:34:15 -05:00
},
2018-10-24 15:17:03 -04:00
cssClass: {
type: String,
required: false,
default: '',
2017-12-22 02:34:15 -05:00
},
2018-10-24 15:17:03 -04:00
iconName: {
type: String,
required: true,
2017-12-22 02:34:15 -05:00
},
2018-10-24 15:17:03 -04:00
tooltipPlacement: {
type: String,
required: false,
default: 'bottom',
2017-12-22 02:34:15 -05:00
},
2018-10-24 15:17:03 -04:00
/**
* value could either be number or string
* as `memberCount` is always passed as string
* while `subgroupCount` & `projectCount`
* are always number
*/
value: {
type: [Number, String],
required: false,
default: '',
},
},
computed: {
isValuePresent() {
return this.value !== '';
},
},
};
2017-12-22 02:34:15 -05:00
</script>
<template>
<span
v-tooltip
:data-placement="tooltipPlacement"
:class="cssClass"
:title="title"
2018-06-11 05:49:47 -04:00
data-container="body"
2017-12-22 02:34:15 -05:00
>
2018-01-06 14:54:45 -05:00
<icon :name="iconName" />
2017-12-22 02:34:15 -05:00
<span
v-if="isValuePresent"
class="stat-value"
>
2018-01-06 14:54:45 -05:00
{{ value }}
2017-12-22 02:34:15 -05:00
</span>
</span>
</template>