From c8effcc334ca23b3227cff2bdf6103a21495ed85 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Mon, 8 Apr 2019 17:45:30 +0200 Subject: [PATCH] rundetails: move api functions to data.js --- src/components/rundetail.vue | 35 ++++++----------------------------- src/util/data.js | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/components/rundetail.vue b/src/components/rundetail.vue index 41612c6..6eeb545 100644 --- a/src/components/rundetail.vue +++ b/src/components/rundetail.vue @@ -32,12 +32,12 @@ From start From failed tasks @@ -45,7 +45,7 @@ @@ -93,7 +93,7 @@ diff --git a/src/util/data.js b/src/util/data.js index b8e83ca..c1f6659 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -72,6 +72,31 @@ export async function deleteUserToken(username, tokenname) { return res.text(); } +export async function restartRun(runid, fromStart) { + let path = "/runs/" + runid + "/actions" + let init = { + method: "PUT", + body: JSON.stringify({ + action_type: "restart", + from_start: fromStart + }) + } + let res = await fetch(apiurl(path), init) + return res.json(); +} + +export async function stopRun(runid) { + let path = "/runs/" + runid + "/actions" + let init = { + method: "PUT", + body: JSON.stringify({ + action_type: "stop" + }) + } + let res = await fetch(apiurl(path), init) + return res.json(); +} + export async function approveTask(runid, taskid) { let path = "/runs/" + runid + "/tasks/" + taskid + "/actions" let init = {