All files / app/assets/javascripts/boards/components issue_time_estimate.vue

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53  13x 13x 13x                                     6x           6x               57x                                
<script>
import { GlTooltip, GlIcon } from '@gitlab/ui';
import { parseSeconds, stringifyTime } from '~/lib/utils/datetime_utility';
import { __ } from '~/locale';
 
export default {
  i18n: {
    timeEstimate: __('Time estimate'),
  },
  components: {
    GlIcon,
    GlTooltip,
  },
  inject: ['timeTrackingLimitToHours'],
  props: {
    estimate: {
      type: Number,
      required: true,
    },
  },
  computed: {
    title() {
      return stringifyTime(
        parseSeconds(this.estimate, { limitToHours: this.timeTrackingLimitToHours }),
        true,
      );
    },
    timeEstimate() {
      return stringifyTime(
        parseSeconds(this.estimate, { limitToHours: this.timeTrackingLimitToHours }),
      );
    },
  },
};
</script>
 
<template>
  <span>
    <span ref="issueTimeEstimate" class="board-card-info card-number">
      <gl-icon name="hourglass" class="board-card-info-icon gl-mr-2" />
      <time class="board-card-info-text">{{ timeEstimate }}</time>
    </span>
    <gl-tooltip
      :target="() => $refs.issueTimeEstimate"
      placement="bottom"
      class="js-issue-time-estimate"
    >
      <span class="gl-font-weight-bold gl-display-block">{{ $options.i18n.timeEstimate }}</span>
      {{ title }}
    </gl-tooltip>
  </span>
</template>