debian-mirror-gitlab/app/assets/javascripts/cycle_analytics/components/total_time_component.vue

38 lines
958 B
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-12-13 13:39:08 +05:30
export default {
props: {
time: {
type: Object,
required: false,
default: () => ({}),
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
},
computed: {
hasData() {
return Object.keys(this.time).length;
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
<span class="total-time">
<template v-if="hasData">
<template v-if="time.days">
2019-02-15 15:39:39 +05:30
{{ time.days }} <span> {{ n__('day', 'days', time.days) }} </span>
2018-03-17 18:26:18 +05:30
</template>
<template v-if="time.hours">
2019-02-15 15:39:39 +05:30
{{ time.hours }} <span> {{ n__('Time|hr', 'Time|hrs', time.hours) }} </span>
2018-03-17 18:26:18 +05:30
</template>
<template v-if="time.mins && !time.days">
2019-02-15 15:39:39 +05:30
{{ time.mins }} <span> {{ n__('Time|min', 'Time|mins', time.mins) }} </span>
2018-03-17 18:26:18 +05:30
</template>
2019-02-15 15:39:39 +05:30
<template v-if="(time.seconds && hasData === 1) || time.seconds === 0">
{{ time.seconds }} <span> {{ s__('Time|s') }} </span>
2018-03-17 18:26:18 +05:30
</template>
</template>
<template v-else>
--
</template>
</span>
</template>