Fix completed event

This commit is contained in:
Richard Bowman 2024-01-11 00:56:45 +00:00
parent 6b466c80a9
commit 9a2b830ff5

View file

@ -235,18 +235,18 @@ export default {
); );
if (response.status == "completed") { if (response.status == "completed") {
this.$emit("response", response); this.$emit("response", response);
this.$emit("completed", response.output);
} else if (response.status == "cancelled") { } else if (response.status == "cancelled") {
this.$emit("cancelled", response); this.$emit("cancelled", response);
this.modalNotify(`The action '${this.submitLabel}' was cancelled.`); this.modalNotify(`The action '${this.submitLabel}' was cancelled.`);
} }
this.$emit("finished");
} catch (error) { } catch (error) {
this.$emit("error", error | Error("Unknown error")); this.$emit("error", error | Error("Unknown error"));
this.$emit("finished");
} finally { } finally {
// Reset taskRunning and taskId // Reset taskRunning and taskId
this.taskRunning = false; this.taskRunning = false;
this.taskStarted = false; this.taskStarted = false;
this.$emit("finished");
// Update the form data if we're self-updating // Update the form data if we're self-updating
if (this.selfUpdate) { if (this.selfUpdate) {
this.getFormData(); this.getFormData();
@ -300,19 +300,12 @@ export default {
return new Promise(checkCondition); return new Promise(checkCondition);
}, },
pollProgress: function() {
axios.get(this.taskUrl).then(response => {
this.progress = response.data.progress;
});
},
hideModal() { hideModal() {
UIkit.modal(this.$refs.statusModal).hide(); UIkit.modal(this.$refs.statusModal).hide();
}, },
terminateTask: function() { terminateTask: function() {
console.log(`deleting task at ${this.taskUrl}`); axios.delete(this.taskUrl, { baseURL: this.$store.getters.baseUri });
axios.delete(this.taskUrl);
} }
} }
}; };