From a3918d967256a638630e0f1b1415ecd9035db076 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Fri, 17 May 2019 17:22:11 +0200 Subject: [PATCH] rundetail: show new restarted run --- src/components/run.vue | 2 +- src/components/rundetail.vue | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/components/run.vue b/src/components/run.vue index 4000c00..e9c6eb2 100644 --- a/src/components/run.vue +++ b/src/components/run.vue @@ -1,6 +1,6 @@ @@ -111,18 +114,24 @@ import vClickOutside from "v-click-outside"; import { cancelRun, stopRun, restartRun } from "@/util/data.js"; +import { userLocalRunLink, projectRunLink } from "@/util/link.js"; + export default { name: "RunDetail", directives: { clickOutside: vClickOutside.directive }, props: { + ownertype: String, + ownername: String, + projectref: Array, run: Object }, data() { return { stopRunError: null, cancelRunError: null, + restartRunError: null, dropdownActive: false }; }, @@ -130,6 +139,7 @@ export default { resetErrors() { this.stopRunError = null; this.cancelRunError = null; + this.restartRunError = null; }, toggleDropdown() { this.dropdownActive = !this.dropdownActive; @@ -169,7 +179,7 @@ export default { let { error } = await stopRun(runid); if (error) { - this.cancelRunError = error; + this.stopRunError = error; return; } @@ -186,9 +196,26 @@ export default { this.run.phase = "cancelled"; }, - restartRun(runid, fromStart) { + async restartRun(runid, fromStart) { this.dropdownActive = false; - restartRun(runid, fromStart); + let { data, error } = await restartRun(runid, fromStart); + if (error) { + this.restartRunError = error; + return; + } + + let runLink; + if (this.projectref) { + runLink = projectRunLink( + this.ownertype, + this.ownername, + this.projectref, + data.id + ); + } else { + runLink = userLocalRunLink(this.ownername, data.id); + } + this.$router.push(runLink); } } };