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 appContent from "./components/appContent.vue";
|
||||||
import loadingContent from "./components/loadingContent.vue";
|
import loadingContent from "./components/loadingContent.vue";
|
||||||
|
|
||||||
import axios from "axios";
|
|
||||||
var Mousetrap = require("mousetrap");
|
var Mousetrap = require("mousetrap");
|
||||||
|
|
||||||
Mousetrap.prototype.stopCallback = function(e, element) {
|
Mousetrap.prototype.stopCallback = function(e, element) {
|
||||||
|
|
@ -311,9 +310,17 @@ export default {
|
||||||
// TODO: more robust check - e.g. use a microscope Thing
|
// TODO: more robust check - e.g. use a microscope Thing
|
||||||
// TODO: should we purge existing consumedThings?
|
// TODO: should we purge existing consumedThings?
|
||||||
try {
|
try {
|
||||||
await axios.get(`${baseUri}/things/`);
|
await this.$store.dispatch(
|
||||||
await this.getThingDescription("stage");
|
"wot/fetchThingDescriptions",
|
||||||
await this.getThingDescription("camera");
|
`${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("setConnected");
|
||||||
this.$store.commit("setErrorMessage", null);
|
this.$store.commit("setErrorMessage", null);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -322,7 +329,6 @@ export default {
|
||||||
this.$store.commit("changeWaiting", false);
|
this.$store.commit("changeWaiting", false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleExit: function() {
|
handleExit: function() {
|
||||||
this.$root.$emit("globalTogglePreview", false);
|
this.$root.$emit("globalTogglePreview", false);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
thingDescriptionUri: function() {
|
||||||
|
return this.$store.getters["wot/thingDescription"](
|
||||||
|
"camera_stage_mapping"
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
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() {
|
onRecalibrateResponse: function() {
|
||||||
this.modalNotify("Finished stage-to-camera calibration.");
|
this.modalNotify("Finished stage-to-camera calibration.");
|
||||||
// Update local settings
|
// Update local settings
|
||||||
|
|
|
||||||
|
|
@ -14,19 +14,16 @@ export default {
|
||||||
components: {},
|
components: {},
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {};
|
||||||
thingDescription: {}
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
stageType: function() {
|
stageType: function() {
|
||||||
return this.thingDescription.title;
|
return this.thingDescription.title;
|
||||||
|
},
|
||||||
|
thingDescription: function() {
|
||||||
|
return this.$store.getters["wot/thingDescription"]("stage");
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
mounted: async function() {
|
|
||||||
this.thingDescription = await this.getThingDescription("stage");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export default {
|
||||||
},
|
},
|
||||||
streamImgUri: function() {
|
streamImgUri: function() {
|
||||||
return `${this.$store.getters.baseUri}/camera/mjpeg_stream`;
|
return `${this.$store.getters.baseUri}/camera/mjpeg_stream`;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue