Replace tasksubmitter with action-button

I've changed tasksubmitter to accept a "thing" and "action" rather than a single URL. This seems more in keeping with
propertyControl, and eliminates the need for loads of
computed properties.

I've also deleted (rather than just commenting out) chunks of the web app that are no longer in use. These may be
reinstated in the future - but we can get them from git
history. It's less confusing not to have vestigial
code in the repo.

This builds OK but is not, as yet, tested with hardware.
This commit is contained in:
Richard Bowman 2024-02-29 21:44:39 +00:00
parent 612b88d58c
commit cbd8b090ec
22 changed files with 225 additions and 2325 deletions

View file

@ -5,39 +5,41 @@
</div>
<div v-show="backendOK">
<ul uk-accordion="multiple: true">
<li>
<a class="uk-accordion-title" href="#">Settings</a>
<div class="uk-accordion-content">
<div class="uk-margin">
<propertyControl
thing-name="background_detect"
property-name="tolerance"
label="Tolerance"
/>
</div>
<div class="uk-margin">
<propertyControl
thing-name="background_detect"
property-name="fraction"
label="Sample coverage required (%)"
/>
</div>
<div class="uk-margin">
<taskSubmitter
:submit-url="backgroundFractionUri"
submit-label="Check coverage"
:can-terminate="false"
:poll-interval="0.1"
@response="alertBackgroundFraction"
@error="backgroundDetectError"
/>
</div>
<li>
<a class="uk-accordion-title" href="#">Settings</a>
<div class="uk-accordion-content">
<div class="uk-margin">
<propertyControl
thing-name="background_detect"
property-name="tolerance"
label="Tolerance"
/>
</div>
</li>
</ul>
<div class="uk-margin">
<propertyControl
thing-name="background_detect"
property-name="fraction"
label="Sample coverage required (%)"
/>
</div>
<div class="uk-margin">
<action-button
thing="background_detect"
action="background_fraction"
submit-label="Check coverage"
:can-terminate="false"
:poll-interval="0.1"
@response="alertBackgroundFraction"
@error="backgroundDetectError"
/>
</div>
</div>
</li>
</ul>
<div class="uk-margin">
<taskSubmitter
:submit-url="setBackgroundUri"
<action-button
thing="background_detect"
action="set_background"
submit-label="Set background"
:can-terminate="false"
:poll-interval="0.1"
@ -45,8 +47,9 @@
/>
</div>
<div class="uk-margin">
<taskSubmitter
:submit-url="labelImageUri"
<action-button
thing="background_detect"
action="image_is_sample"
submit-label="Check current image"
:can-terminate="false"
:poll-interval="0.1"
@ -59,29 +62,18 @@
</template>
<script>
import taskSubmitter from "../../genericComponents/taskSubmitter";
import ActionButton from "../../labThingsComponents/actionButton.vue";
import propertyControl from "../../labThingsComponents/propertyControl.vue";
export default {
components: {
taskSubmitter,
ActionButton,
propertyControl
},
computed: {
labelImageUri() {
return this.thingActionUrl("background_detect", "image_is_sample");
},
backgroundFractionUri() {
return this.thingActionUrl("background_detect", "background_fraction");
},
setBackgroundUri() {
return this.thingActionUrl("background_detect", "set_background");
},
backendOK() {
return (
(this.backgroundFractionUri != null) & (this.setBackgroundUri != null)
);
return this.thingAvailable("background_detect");
}
},