From d376eee5d5d734e14e3c0891b031853538ce8be1 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Sun, 27 Jul 2025 20:46:37 +0100 Subject: [PATCH] Remove custom error for background. Do not allow check if background is not set. --- .../labThingsComponents/actionButton.vue | 8 ++++++- .../paneBackgroundDetect.vue | 24 ++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/webapp/src/components/labThingsComponents/actionButton.vue b/webapp/src/components/labThingsComponents/actionButton.vue index 73ca9537..b33233a2 100644 --- a/webapp/src/components/labThingsComponents/actionButton.vue +++ b/webapp/src/components/labThingsComponents/actionButton.vue @@ -18,6 +18,7 @@
@@ -25,10 +26,11 @@ thing="camera" action="image_is_sample" submit-label="Check Current Image" + :isDisabled="!backgroundDetectorStatus.ready" :can-terminate="false" :poll-interval="0.1" @response="alertImageLabel" - @error="backgroundDetectError" + @error="modalError" />
@@ -40,7 +42,13 @@ import ActionButton from "../../labThingsComponents/actionButton.vue"; export default { components: { - ActionButton + ActionButton, + }, + + data() { + return { + backgroundDetectorStatus: undefined, + }; }, methods: { @@ -50,13 +58,13 @@ export default { alertImageLabel(r) { let label = r.output[0] ? "sample" : "background"; this.modalNotify(`Current image is ${label} (${r.output[1]})`); - }, - backgroundDetectError() { - this.modalError( - "Background detection failed, most likely you need to set a background image." + - " There may be more information in the log." - ); } + }, + async created() { + this.backgroundDetectorStatus = await this.readThingProperty( + "camera", + "background_detector_status" + ); } };