rundetail: show new restarted run

This commit is contained in:
Simone Gotti 2019-05-17 17:22:11 +02:00
parent 3232d6db45
commit a3918d9672
2 changed files with 31 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<RunDetail :run="run"/> <RunDetail :run="run" :ownertype="ownertype" :ownername="ownername" :projectref="projectref"/>
<div v-if="run"> <div v-if="run">
<div v-if="run.phase != 'setuperror'"> <div v-if="run.phase != 'setuperror'">
<div class="tabs"> <div class="tabs">

View File

@ -102,6 +102,9 @@
<div v-if="cancelRunError" class="message is-danger"> <div v-if="cancelRunError" class="message is-danger">
<div class="message-body">{{ cancelRunError }}</div> <div class="message-body">{{ cancelRunError }}</div>
</div> </div>
<div v-if="cancelRunError" class="message is-danger">
<div class="message-body">{{ cancelRunError }}</div>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -111,18 +114,24 @@ import vClickOutside from "v-click-outside";
import { cancelRun, stopRun, restartRun } from "@/util/data.js"; import { cancelRun, stopRun, restartRun } from "@/util/data.js";
import { userLocalRunLink, projectRunLink } from "@/util/link.js";
export default { export default {
name: "RunDetail", name: "RunDetail",
directives: { directives: {
clickOutside: vClickOutside.directive clickOutside: vClickOutside.directive
}, },
props: { props: {
ownertype: String,
ownername: String,
projectref: Array,
run: Object run: Object
}, },
data() { data() {
return { return {
stopRunError: null, stopRunError: null,
cancelRunError: null, cancelRunError: null,
restartRunError: null,
dropdownActive: false dropdownActive: false
}; };
}, },
@ -130,6 +139,7 @@ export default {
resetErrors() { resetErrors() {
this.stopRunError = null; this.stopRunError = null;
this.cancelRunError = null; this.cancelRunError = null;
this.restartRunError = null;
}, },
toggleDropdown() { toggleDropdown() {
this.dropdownActive = !this.dropdownActive; this.dropdownActive = !this.dropdownActive;
@ -169,7 +179,7 @@ export default {
let { error } = await stopRun(runid); let { error } = await stopRun(runid);
if (error) { if (error) {
this.cancelRunError = error; this.stopRunError = error;
return; return;
} }
@ -186,9 +196,26 @@ export default {
this.run.phase = "cancelled"; this.run.phase = "cancelled";
}, },
restartRun(runid, fromStart) { async restartRun(runid, fromStart) {
this.dropdownActive = false; 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);
} }
} }
}; };