2017-12-22 02:34:15 -05:00
|
|
|
<script>
|
2020-10-16 17:09:08 -04:00
|
|
|
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
|
2017-12-22 02:34:15 -05:00
|
|
|
|
2018-10-24 15:17:03 -04:00
|
|
|
export default {
|
|
|
|
components: {
|
2020-08-24 11:10:11 -04:00
|
|
|
GlIcon,
|
2018-10-24 15:17:03 -04:00
|
|
|
},
|
|
|
|
directives: {
|
2020-10-16 17:09:08 -04:00
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-10-24 15:17:03 -04:00
|
|
|
},
|
|
|
|
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
|
2020-10-16 17:09:08 -04:00
|
|
|
v-gl-tooltip
|
2017-12-22 02:34:15 -05:00
|
|
|
: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
|
|
|
>
|
2020-10-02 08:09:03 -04:00
|
|
|
<gl-icon :name="iconName" />
|
|
|
|
<span v-if="isValuePresent" class="stat-value" data-testid="itemStatValue"> {{ value }} </span>
|
2017-12-22 02:34:15 -05:00
|
|
|
</span>
|
|
|
|
</template>
|