rundetails: add run cancel button
This commit is contained in:
parent
74cd268431
commit
b10a7f18e1
|
@ -43,6 +43,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
class="button is-danger"
|
||||||
|
v-if="run.phase == 'queued'"
|
||||||
|
@click="cancelRun(run.id)"
|
||||||
|
>Cancel</button>
|
||||||
<button
|
<button
|
||||||
class="button is-danger"
|
class="button is-danger"
|
||||||
v-if="run.phase == 'running'"
|
v-if="run.phase == 'running'"
|
||||||
|
@ -94,7 +99,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { stopRun, restartRun } from "@/util/data.js";
|
import { cancelRun, stopRun, restartRun } from "@/util/data.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RunDetail",
|
name: "RunDetail",
|
||||||
|
@ -141,6 +146,7 @@ export default {
|
||||||
return "unknown";
|
return "unknown";
|
||||||
},
|
},
|
||||||
stopRun: stopRun,
|
stopRun: stopRun,
|
||||||
|
cancelRun: cancelRun,
|
||||||
restartRun(runid, fromStart) {
|
restartRun(runid, fromStart) {
|
||||||
this.dropdownActive = false;
|
this.dropdownActive = false;
|
||||||
restartRun(runid, fromStart);
|
restartRun(runid, fromStart);
|
||||||
|
|
|
@ -170,6 +170,17 @@ export async function restartRun(runid, fromStart) {
|
||||||
return await fetch(apiurl(path), init)
|
return await fetch(apiurl(path), init)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function cancelRun(runid) {
|
||||||
|
let path = "/runs/" + runid + "/actions"
|
||||||
|
let init = {
|
||||||
|
method: "PUT",
|
||||||
|
body: JSON.stringify({
|
||||||
|
action_type: "cancel"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return await fetch(apiurl(path), init)
|
||||||
|
}
|
||||||
|
|
||||||
export async function stopRun(runid) {
|
export async function stopRun(runid) {
|
||||||
let path = "/runs/" + runid + "/actions"
|
let path = "/runs/" + runid + "/actions"
|
||||||
let init = {
|
let init = {
|
||||||
|
|
Loading…
Reference in New Issue