From 1ba1a3082b09e4bb4ee8e2dc9373580dd996c615 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Wed, 5 Nov 2025 17:05:34 +0000 Subject: [PATCH 01/19] More consitent use of mixins for interaactiong with thing descriptions --- webapp/src/App.vue | 2 +- .../modalComponents/calibrationWizard.vue | 4 +--- .../aboutComponents/statusPane.vue | 20 +++++++++-------- .../tabContentComponents/powerContent.vue | 6 ++--- .../tabContentComponents/scanListContent.vue | 7 +----- .../CSMCalibrationSettings.vue | 4 ++-- .../cameraCalibrationSettings.vue | 2 +- webapp/src/main.js | 22 +++++++++++++++---- webapp/src/wot-client.js | 7 ++++++ 9 files changed, 45 insertions(+), 29 deletions(-) diff --git a/webapp/src/App.vue b/webapp/src/App.vue index b798e568..cc28983b 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -214,7 +214,7 @@ export default { try { await this.$store.dispatch("wot/fetchThingDescriptions", `${baseUri}/thing_descriptions/`); for (let requiredThing of ["camera", "stage"]) { - if (!this.$store.getters["wot/thingAvailable"](requiredThing)) { + if (!this.thingAvailable(requiredThing)) { throw new Error(`No ${requiredThing} found, the GUI won't work without one.`); } } diff --git a/webapp/src/components/modalComponents/calibrationWizard.vue b/webapp/src/components/modalComponents/calibrationWizard.vue index 6deb09ed..687263d8 100644 --- a/webapp/src/components/modalComponents/calibrationWizard.vue +++ b/webapp/src/components/modalComponents/calibrationWizard.vue @@ -78,13 +78,11 @@ export default { const calibrateableThings = Object.keys(this.availableCalibrationTasks); for (const name of calibrateableThings) { - try { + if (this.thingPropertyAvailable(name, "calibration_required")) { const thingNeedsCal = await this.readThingProperty(name, "calibration_required"); if (thingNeedsCal) { needsCalibration.push(name); } - } catch (e) { - console.error(`${name}: missing calibration_required property`, e); } } diff --git a/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue b/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue index 2a045bb2..3a04754d 100644 --- a/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue +++ b/webapp/src/components/tabContentComponents/aboutComponents/statusPane.vue @@ -34,18 +34,16 @@
Camera:
-
- {{ things.camera.title }} +
+ {{ cameraType }}
-
No camera configured
-
+
Stage:
-
- {{ things.stage.title }} +
+ {{ stageType }}
-
No stage configured

@@ -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; }, }, diff --git a/webapp/src/components/tabContentComponents/powerContent.vue b/webapp/src/components/tabContentComponents/powerContent.vue index ecb1c419..a1a6de49 100644 --- a/webapp/src/components/tabContentComponents/powerContent.vue +++ b/webapp/src/components/tabContentComponents/powerContent.vue @@ -10,7 +10,7 @@