Remove custom error for background. Do not allow check if background is not set.
This commit is contained in:
parent
7f4b4ed1f3
commit
d376eee5d5
2 changed files with 23 additions and 9 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
:disabled="isDisabled"
|
||||||
:hidden="taskStarted"
|
:hidden="taskStarted"
|
||||||
class="uk-button uk-width-1-1"
|
class="uk-button uk-width-1-1"
|
||||||
:class="[buttonPrimary ? 'uk-button-primary' : 'uk-button-default']"
|
:class="[buttonPrimary ? 'uk-button-primary' : 'uk-button-default']"
|
||||||
|
|
@ -132,7 +133,12 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false
|
||||||
}
|
},
|
||||||
|
isDisabled: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
:can-terminate="false"
|
:can-terminate="false"
|
||||||
:poll-interval="0.1"
|
:poll-interval="0.1"
|
||||||
@response="alertBackgroundSet"
|
@response="alertBackgroundSet"
|
||||||
|
@error="modalError"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
|
|
@ -25,10 +26,11 @@
|
||||||
thing="camera"
|
thing="camera"
|
||||||
action="image_is_sample"
|
action="image_is_sample"
|
||||||
submit-label="Check Current Image"
|
submit-label="Check Current Image"
|
||||||
|
:isDisabled="!backgroundDetectorStatus.ready"
|
||||||
:can-terminate="false"
|
:can-terminate="false"
|
||||||
:poll-interval="0.1"
|
:poll-interval="0.1"
|
||||||
@response="alertImageLabel"
|
@response="alertImageLabel"
|
||||||
@error="backgroundDetectError"
|
@error="modalError"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -40,7 +42,13 @@ import ActionButton from "../../labThingsComponents/actionButton.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ActionButton
|
ActionButton,
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
backgroundDetectorStatus: undefined,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -50,13 +58,13 @@ export default {
|
||||||
alertImageLabel(r) {
|
alertImageLabel(r) {
|
||||||
let label = r.output[0] ? "sample" : "background";
|
let label = r.output[0] ? "sample" : "background";
|
||||||
this.modalNotify(`Current image is ${label} (${r.output[1]})`);
|
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"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue