Welcome to mirror list, hosted at ThFree Co, Russian Federation.

collapsed_state.js « time_tracking « components « issuable « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2101a4bb056c6723b5ababd8c940a03f9f0ecf72 (plain)
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
54
55
56
57
import stopwatchSvg from 'icons/_icon_stopwatch.svg';

import '../../../lib/utils/pretty_time';

export default {
  name: 'time-tracking-collapsed-state',
  props: {
    showComparisonState: {
      type: Boolean,
      required: true,
    },
    showSpentOnlyState: {
      type: Boolean,
      required: true,
    },
    showEstimateOnlyState: {
      type: Boolean,
      required: true,
    },
    showNoTimeTrackingState: {
      type: Boolean,
      required: true,
    },
    timeSpentHumanReadable: {
      type: String,
      required: false,
    },
    timeEstimateHumanReadable: {
      type: String,
      required: false,
    },
  },
  methods: {
    abbreviateTime(timeStr) {
      return gl.utils.prettyTime.abbreviateTime(timeStr);
    },
  },
  template: `
    <div class='sidebar-collapsed-icon'>
      ${stopwatchSvg}
      <div class='time-tracking-collapsed-summary'>
        <div class='compare' v-if='showComparisonState'>
          <span>{{ abbreviateTime(timeSpentHumanReadable) }} / {{ abbreviateTime(timeEstimateHumanReadable) }}</span>
        </div>
        <div class='estimate-only' v-if='showEstimateOnlyState'>
          <span class='bold'>-- / {{ abbreviateTime(timeEstimateHumanReadable) }}</span>
        </div>
        <div class='spend-only' v-if='showSpentOnlyState'>
          <span class='bold'>{{ abbreviateTime(timeSpentHumanReadable) }} / --</span>
        </div>
        <div class='no-tracking' v-if='showNoTimeTrackingState'>
          <span class='no-value'>None</span>
        </div>
      </div>
    </div>
    `,
};