diff --git a/webapp/src/App.vue b/webapp/src/App.vue index c06e4ce9..e1234a92 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -42,7 +42,6 @@ import appContent from "./components/appContent.vue"; import loadingContent from "./components/loadingContent.vue"; -import axios from "axios"; var Mousetrap = require("mousetrap"); Mousetrap.prototype.stopCallback = function(e, element) { @@ -311,9 +310,17 @@ export default { // TODO: more robust check - e.g. use a microscope Thing // TODO: should we purge existing consumedThings? try { - await axios.get(`${baseUri}/things/`); - await this.getThingDescription("stage"); - await this.getThingDescription("camera"); + await this.$store.dispatch( + "wot/fetchThingDescriptions", + `${baseUri}/thing_descriptions/` + ); + for (let requiredThing of ["camera", "stage"]) { + if (!this.$store.getters["wot/thingAvailable"](requiredThing)) { + throw new Error( + `No ${requiredThing} found, the GUI won't work without one.` + ); + } + } this.$store.commit("setConnected"); this.$store.commit("setErrorMessage", null); } catch (error) { @@ -322,7 +329,6 @@ export default { this.$store.commit("changeWaiting", false); } }, - handleExit: function() { this.$root.$emit("globalTogglePreview", false); }, diff --git a/webapp/src/components/tabContentComponents/settingsComponents/CSMSettings.vue b/webapp/src/components/tabContentComponents/settingsComponents/CSMSettings.vue index 2be31e21..91038230 100644 --- a/webapp/src/components/tabContentComponents/settingsComponents/CSMSettings.vue +++ b/webapp/src/components/tabContentComponents/settingsComponents/CSMSettings.vue @@ -51,6 +51,11 @@ export default { }, computed: { + thingDescriptionUri: function() { + return this.$store.getters["wot/thingDescription"]( + "camera_stage_mapping" + ); + } }, mounted() { @@ -94,30 +99,6 @@ export default { }); }, - updateThingDescription: function() { - this.thingDescription = - axios - .get(this.pluginsUri) // Get a list of plugins - .then(response => { - var plugins = response.data; - var foundExtension = plugins.find( - e => e.title === "org.openflexure.camera_stage_mapping" - ); - // if camera-stage mapping extension is enabled - if (foundExtension) { - // Get plugin action link - this.recalibrationLinks = foundExtension.links; - // Update whether calibration data is available - this.updateCalibrationDataAvailability(); - } else { - this.recalibrationLinks = {}; - } - }) - .catch(error => { - this.modalError(error); // Let mixin handle error - }); - }, - onRecalibrateResponse: function() { this.modalNotify("Finished stage-to-camera calibration."); // Update local settings diff --git a/webapp/src/components/tabContentComponents/settingsComponents/stageSettings.vue b/webapp/src/components/tabContentComponents/settingsComponents/stageSettings.vue index cda328a4..aab40c7c 100644 --- a/webapp/src/components/tabContentComponents/settingsComponents/stageSettings.vue +++ b/webapp/src/components/tabContentComponents/settingsComponents/stageSettings.vue @@ -14,19 +14,16 @@ export default { components: {}, data: function() { - return { - thingDescription: {} - }; + return {}; }, computed: { stageType: function() { return this.thingDescription.title; + }, + thingDescription: function() { + return this.$store.getters["wot/thingDescription"]("stage"); } - }, - - mounted: async function() { - this.thingDescription = await this.getThingDescription("stage"); } }; diff --git a/webapp/src/components/tabContentComponents/streamContent.vue b/webapp/src/components/tabContentComponents/streamContent.vue index 48c3b33a..78fbfaa7 100644 --- a/webapp/src/components/tabContentComponents/streamContent.vue +++ b/webapp/src/components/tabContentComponents/streamContent.vue @@ -58,7 +58,7 @@ export default { }, streamImgUri: function() { return `${this.$store.getters.baseUri}/camera/mjpeg_stream`; - }, + } }, mounted() {