diff --git a/src/components/runs.vue b/src/components/runs.vue index 19ed9c1..497e92d 100644 --- a/src/components/runs.vue +++ b/src/components/runs.vue @@ -16,59 +16,74 @@ :class="runResultClass(run)" >
+ +
+
+ + {{run.annotations.branch}} +
+
+ + {{run.annotations.tag}} +
+
+ + PR #{{run.annotations.pull_request_id}} +
+
+
+ + direct run +
- {{run.name}} + {{run.name}} +
{{run.annotations.message.split(/\r?\n/)[0]}}
- - {{run.name}} + + {{run.name}} +
{{run.annotations.message.split(/\r?\n/)[0]}}
-
{{run.annotations.message}}
Waiting Approval - Still running - +
+
+ + {{ duration(run) }} +
+
+ + {{ endTimeHuman(run) }} +
@@ -89,6 +104,10 @@ import { fetchUser, fetchProject, fetchRuns } from "@/util/data.js"; import { userDirectRunLink, projectRunLink } from "@/util/link.js"; import { runResultClass } from "@/util/run.js"; +import * as moment from "moment"; +import momentDurationFormatSetup from "moment-duration-format"; + +momentDurationFormatSetup(moment); export default { components: {}, @@ -101,6 +120,7 @@ export default { }, data() { return { + now: moment(), fetchRunsError: null, runs: [], wantedRunsNumber: 25, @@ -212,9 +232,43 @@ export default { this.polling = setInterval(() => { this.fetchRuns(); }, 2000); + }, + duration(run) { + let formatString = "h:mm:ss[s]"; + let start = moment(run.start_time); + let end = moment(run.end_time); + + if (run.start_time === null) { + return moment.duration(0).format(formatString); + } + if (run.end_time === null) { + return moment.duration(this.now.diff(start)).format(formatString); + } + return moment.duration(end.diff(start)).format(formatString); + }, + endTime(run) { + let formatString = "lll"; + let end = moment(run.end_time); + + if (run.end_time === null) { + return ""; + } + return "Finished " + end.format(formatString); + }, + endTimeHuman(run) { + let end = moment(run.end_time); + + if (run.end_time === null) { + return ""; + } + return end.fromNow(); } }, created: function() { + window.setInterval(() => { + this.now = moment(); + }, 500); + this.update(); }, beforeDestroy() {