diff options
author | Phil Hughes <me@iamphill.com> | 2017-06-14 13:04:51 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-06-14 13:04:51 +0000 |
commit | 79dc74b0a3386b35e986b0f9b214f64f2adebc92 (patch) | |
tree | 9a72dee40745012d850c6e641c55f109111c482c /app/assets/javascripts/pipelines/components/time_ago.js | |
parent | d6fee79421615e0c482915aeb7ed8eeb6da40c3a (diff) | |
parent | 8868efd0f38df1f537878ee3ea5061dcfd5fa163 (diff) | |
download | gitlab-ce-79dc74b0a3386b35e986b0f9b214f64f2adebc92.tar.gz |
Merge branch 'vue-pipelines-code' into 'master'
Move vue components to vue files and match docs
See merge request !12146
Diffstat (limited to 'app/assets/javascripts/pipelines/components/time_ago.js')
-rw-r--r-- | app/assets/javascripts/pipelines/components/time_ago.js | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/app/assets/javascripts/pipelines/components/time_ago.js b/app/assets/javascripts/pipelines/components/time_ago.js deleted file mode 100644 index 188f74cc705..00000000000 --- a/app/assets/javascripts/pipelines/components/time_ago.js +++ /dev/null @@ -1,98 +0,0 @@ -import iconTimerSvg from 'icons/_icon_timer.svg'; -import '../../lib/utils/datetime_utility'; - -export default { - props: { - finishedTime: { - type: String, - required: true, - }, - - duration: { - type: Number, - required: true, - }, - }, - - data() { - return { - iconTimerSvg, - }; - }, - - updated() { - $(this.$refs.tooltip).tooltip('fixTitle'); - }, - - computed: { - hasDuration() { - return this.duration > 0; - }, - - hasFinishedTime() { - return this.finishedTime !== ''; - }, - - localTimeFinished() { - return gl.utils.formatDate(this.finishedTime); - }, - - durationFormated() { - const date = new Date(this.duration * 1000); - - let hh = date.getUTCHours(); - let mm = date.getUTCMinutes(); - let ss = date.getSeconds(); - - // left pad - if (hh < 10) { - hh = `0${hh}`; - } - if (mm < 10) { - mm = `0${mm}`; - } - if (ss < 10) { - ss = `0${ss}`; - } - - return `${hh}:${mm}:${ss}`; - }, - - finishedTimeFormated() { - const timeAgo = gl.utils.getTimeago(); - - return timeAgo.format(this.finishedTime); - }, - }, - - template: ` - <td class="pipelines-time-ago"> - <p - class="duration" - v-if="hasDuration"> - <span - v-html="iconTimerSvg"> - </span> - {{durationFormated}} - </p> - - <p - class="finished-at" - v-if="hasFinishedTime"> - - <i - class="fa fa-calendar" - aria-hidden="true" /> - - <time - ref="tooltip" - data-toggle="tooltip" - data-placement="top" - data-container="body" - :title="localTimeFinished"> - {{finishedTimeFormated}} - </time> - </p> - </td> - `, -}; |