From f85243acfe76738c29647806a4cc62191e2df378 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 15 May 2019 14:59:52 +0200 Subject: [PATCH] rundetail: handle api errors --- src/components/rundetail.vue | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/components/rundetail.vue b/src/components/rundetail.vue index 079a337..2f2246f 100644 --- a/src/components/rundetail.vue +++ b/src/components/rundetail.vue @@ -95,6 +95,12 @@ +
+
{{ stopRunError }}
+
+
+
{{ cancelRunError }}
+
@@ -109,10 +115,16 @@ export default { }, data() { return { + stopRunError: null, + cancelRunError: null, dropdownActive: false }; }, methods: { + resetErrors() { + this.stopRunError = null; + this.cancelRunError = null; + }, toggleDropdown() { this.dropdownActive = !this.dropdownActive; }, @@ -146,13 +158,27 @@ export default { if (task.status == "running") return "running"; return "unknown"; }, - stopRun(runid) { + async stopRun(runid) { + this.resetErrors(); + + let { error } = await stopRun(runid); + if (error) { + this.cancelRunError = error; + return; + } + this.run.stopping = true; - stopRun(runid); }, - cancelRun(runid) { + async cancelRun(runid) { + this.resetErrors(); + + let { error } = await cancelRun(runid); + if (error) { + this.cancelRunError = error; + return; + } + this.run.phase = "cancelled"; - cancelRun(runid); }, restartRun(runid, fromStart) { this.dropdownActive = false;