From cb916bb4a325ee981764b9793bade93c5862675a Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Sun, 7 Jan 2024 14:58:19 +0000 Subject: [PATCH] Image fraction and label as a thing property in webapp --- .../paneBackgroundDetect.vue | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue b/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue index 980378b3..ea95d517 100644 --- a/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue +++ b/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue @@ -10,6 +10,7 @@ submit-label="Set background" :can-terminate="false" :poll-interval="0.1" + @response="alertBackgroundSet" />
@@ -19,6 +20,13 @@ label="Tolerance" />
+
+ +
+
+ +
@@ -43,6 +60,9 @@ export default { }, computed: { + labelImageUri() { + return this.thingActionUrl("background_detect", "image_is_sample"); + }, backgroundFractionUri() { return this.thingActionUrl("background_detect", "background_fraction"); }, @@ -59,8 +79,15 @@ export default { methods: { alertBackgroundFraction(r) { let fraction = r.output; - let percentage = (fraction * 100).toFixed(1); - this.modalNotify(`Current image is ${percentage}% background.`); + // let percentage = (fraction * 100).toFixed(0); + this.modalNotify(`Current image is ${fraction.toFixed(0)}% background.`); + }, + alertBackgroundSet() { + this.modalNotify(`Background image has been updated`); + }, + alertImageLabel(r) { + let label = r.output===true? 'sample' : 'background' + this.modalNotify(`Current image is ${label}`); } } };