Switch to using TDs in the store
This commit is contained in:
parent
8865d88e20
commit
c2ec060df9
4 changed files with 21 additions and 37 deletions
|
|
@ -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);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default {
|
|||
},
|
||||
streamImgUri: function() {
|
||||
return `${this.$store.getters.baseUri}/camera/mjpeg_stream`;
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue