From 0cff7bdd04f24c10527438f26c069fd70695ec1c Mon Sep 17 00:00:00 2001 From: j433866 Date: Wed, 15 May 2019 16:24:49 +0100 Subject: [PATCH] Improve handling of OperationErrors. Make output filter refresh when changing stale or errored checkboxes --- src/web/Manager.mjs | 2 ++ src/web/OutputWaiter.mjs | 5 +++-- src/web/WorkerWaiter.mjs | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index 1f32665e..dd7f1a2a 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -205,6 +205,8 @@ class Manager { document.getElementById("output-show-pending").addEventListener("change", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-show-baking").addEventListener("change", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-show-baked").addEventListener("change", this.output.filterTabSearch.bind(this.output)); + document.getElementById("output-show-stale").addEventListener("change", this.output.filterTabSearch.bind(this.output)); + document.getElementById("output-show-errored").addEventListener("change", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-content-filter").addEventListener("change", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-content-filter").addEventListener("keyup", this.output.filterTabSearch.bind(this.output)); document.getElementById("output-num-results").addEventListener("change", this.output.filterTabSearch.bind(this.output)); diff --git a/src/web/OutputWaiter.mjs b/src/web/OutputWaiter.mjs index 5f8d44ee..d3cbc8c7 100755 --- a/src/web/OutputWaiter.mjs +++ b/src/web/OutputWaiter.mjs @@ -1287,13 +1287,13 @@ class OutputWaiter { if (output.status === "pending" && showPending || output.status === "baking" && showBaking || - output.status === "errored" && showErrored || + output.status === "error" && showErrored || output.status === "stale" && showStale || output.status === "inactive" && showStale) { const outDisplay = { "pending": "Not baked yet", "baking": "Baking", - "errored": "Errored", + "error": output.error || "Errored", "stale": "Stale (output is out of date)", "inactive": "Not baked yet" }; @@ -1303,6 +1303,7 @@ class OutputWaiter { }); } else if (output.status === "baked" && showBaked) { let data = this.getOutput(iNum, false).slice(0, 4096); + log.error(output); if (typeof data !== "string") { data = Utils.arrayBufferToStr(data); } diff --git a/src/web/WorkerWaiter.mjs b/src/web/WorkerWaiter.mjs index f9bcf281..c0bf8ac7 100644 --- a/src/web/WorkerWaiter.mjs +++ b/src/web/WorkerWaiter.mjs @@ -146,11 +146,12 @@ class WorkerWaiter { if (r.data.error) { this.app.handleError(r.data.error); this.manager.output.updateOutputError(r.data.error, inputNum, r.data.progress); - this.workerFinished(currentWorker); + } else if (r.data.progress !== this.manager.recipe.getConfig().length) { + this.manager.output.updateOutputError(r.data.result, inputNum, r.data.progress); } else { this.updateOutput(r.data, r.data.inputNum, r.data.bakeId, r.data.progress); - this.workerFinished(currentWorker); } + this.workerFinished(currentWorker); break; case "bakeError": this.app.handleError(r.data.error);