More consitent use of mixins for interaactiong with thing descriptions

This commit is contained in:
Julian Stirling 2025-11-05 17:05:34 +00:00
parent 40b3d993ee
commit 1ba1a3082b
9 changed files with 45 additions and 29 deletions

View file

@ -34,18 +34,16 @@
<div class="uk-margin-small-bottom">
<b>Camera:</b>
<br />
<div v-if="'camera' in things">
{{ things.camera.title }}
<div>
{{ cameraType }}
</div>
<div v-else class="uk-text-danger"><b>No camera configured</b></div>
</div>
<div>
<div v-if="stageType">
<b>Stage:</b>
<br />
<div v-if="'stage' in things">
{{ things.stage.title }}
<div>
{{ stageType }}
</div>
<div v-else class="uk-text-danger"><b>No stage configured</b></div>
</div>
<hr />
@ -71,8 +69,12 @@ export default {
},
computed: {
things: function () {
return this.$store.getters["wot/thingDescriptions"];
cameraType() {
// No need to check as the microscope won't start up without a camera defined
return this.thingDescription("camera").title;
},
stageType() {
return this.thingAvailable("stage") ? this.thingDescription("stage").title : undefined;
},
},

View file

@ -10,7 +10,7 @@
</p>
<div class="buttons-container">
<button
v-show="'shutdown' in things.system.actions"
v-show="shutdownAvailable"
class="uk-button uk-button-primary uk-width-1-3 shutdown-button"
@click="systemRequest('shutdown')"
>
@ -42,8 +42,8 @@ export default {
},
computed: {
things: function () {
return this.$store.getters["wot/thingDescriptions"];
shutdownAvailable() {
return this.thingActionAvailable("system", "shutdown");
},
},

View file

@ -119,12 +119,7 @@ export default {
computed: {
scansUri() {
return this.$store.getters["wot/thingPropertyUrl"](
"smart_scan",
"scans",
"readproperty",
true,
);
return this.thingPropertyUrl("smart_scan", "scans");
},
scansEmpty() {
return this.scans.length == 0;

View file

@ -69,10 +69,10 @@ export default {
computed: {
actions() {
return this.$store.getters["wot/thingDescription"]("camera_stage_mapping").actions;
return this.thingDescription("camera_stage_mapping").actions;
},
properties() {
return this.$store.getters["wot/thingDescription"]("camera_stage_mapping").properties;
return this.thingDescription("camera_stage_mapping").properties;
},
},

View file

@ -52,7 +52,7 @@ export default {
computed: {
actions() {
return this.$store.getters["wot/thingDescription"]("camera").actions;
return this.thingDescription("camera").actions;
},
},