2017-06-14 09:04:50 -04:00
|
|
|
<script>
|
2018-06-27 10:28:05 -04:00
|
|
|
import iconTimerSvg from 'icons/_icon_timer.svg';
|
|
|
|
import '../../lib/utils/datetime_utility';
|
|
|
|
import tooltip from '../../vue_shared/directives/tooltip';
|
|
|
|
import timeagoMixin from '../../vue_shared/mixins/timeago';
|
2017-06-14 09:04:50 -04:00
|
|
|
|
2018-06-27 10:28:05 -04:00
|
|
|
export default {
|
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
|
|
|
mixins: [timeagoMixin],
|
|
|
|
props: {
|
|
|
|
finishedTime: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2018-01-04 19:18:35 -05:00
|
|
|
},
|
2018-06-27 10:28:05 -04:00
|
|
|
duration: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
2017-06-14 09:04:50 -04:00
|
|
|
},
|
2018-06-27 10:28:05 -04:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
iconTimerSvg,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasDuration() {
|
|
|
|
return this.duration > 0;
|
2017-06-14 09:04:50 -04:00
|
|
|
},
|
2018-06-27 10:28:05 -04:00
|
|
|
hasFinishedTime() {
|
|
|
|
return this.finishedTime !== '';
|
|
|
|
},
|
|
|
|
durationFormated() {
|
|
|
|
const date = new Date(this.duration * 1000);
|
2017-06-14 09:04:50 -04:00
|
|
|
|
2018-06-27 10:28:05 -04:00
|
|
|
let hh = date.getUTCHours();
|
|
|
|
let mm = date.getUTCMinutes();
|
|
|
|
let ss = date.getSeconds();
|
2017-06-14 09:04:50 -04:00
|
|
|
|
2018-06-27 10:28:05 -04:00
|
|
|
// left pad
|
|
|
|
if (hh < 10) {
|
|
|
|
hh = `0${hh}`;
|
|
|
|
}
|
|
|
|
if (mm < 10) {
|
|
|
|
mm = `0${mm}`;
|
|
|
|
}
|
|
|
|
if (ss < 10) {
|
|
|
|
ss = `0${ss}`;
|
|
|
|
}
|
2017-06-14 09:04:50 -04:00
|
|
|
|
2018-06-27 10:28:05 -04:00
|
|
|
return `${hh}:${mm}:${ss}`;
|
2017-06-14 09:04:50 -04:00
|
|
|
},
|
2018-06-27 10:28:05 -04:00
|
|
|
},
|
|
|
|
};
|
2017-06-14 09:04:50 -04:00
|
|
|
</script>
|
|
|
|
<template>
|
2017-06-16 08:00:28 -04:00
|
|
|
<div class="table-section section-15 pipelines-time-ago">
|
2018-11-16 15:07:38 -05:00
|
|
|
<div class="table-mobile-header" role="rowheader">{{ s__('Pipeline|Duration') }}</div>
|
2017-06-16 08:00:28 -04:00
|
|
|
<div class="table-mobile-content">
|
2018-11-16 15:07:38 -05:00
|
|
|
<p v-if="hasDuration" class="duration">
|
|
|
|
<span v-html="iconTimerSvg"> </span> {{ durationFormated }}
|
2017-06-16 08:00:28 -04:00
|
|
|
</p>
|
2017-06-14 09:04:50 -04:00
|
|
|
|
2018-11-16 15:07:38 -05:00
|
|
|
<p v-if="hasFinishedTime" class="finished-at d-none d-sm-none d-md-block">
|
|
|
|
<i class="fa fa-calendar" aria-hidden="true"> </i>
|
2017-06-14 09:04:50 -04:00
|
|
|
|
2017-06-16 08:00:28 -04:00
|
|
|
<time
|
2017-06-06 16:46:31 -04:00
|
|
|
v-tooltip
|
2018-06-11 05:49:47 -04:00
|
|
|
:title="tooltipTitle(finishedTime)"
|
2017-06-16 08:00:28 -04:00
|
|
|
data-placement="top"
|
2018-10-30 08:59:33 -04:00
|
|
|
data-container="body"
|
|
|
|
>
|
2018-01-04 19:18:35 -05:00
|
|
|
{{ timeFormated(finishedTime) }}
|
2017-06-16 08:00:28 -04:00
|
|
|
</time>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-01-04 19:18:35 -05:00
|
|
|
</template>
|