Make calibrateXYUri a computed property

This makes it properly reactive again.
This commit is contained in:
Richard Bowman 2023-12-01 01:46:11 +00:00
parent f97dcb6abc
commit 65c881fea1

View file

@ -9,7 +9,7 @@
:confirmation-message=" :confirmation-message="
'Start recalibration of the stage to the camera? This may take a while, and the microscope will be locked during this time.' 'Start recalibration of the stage to the camera? This may take a while, and the microscope will be locked during this time.'
" "
:submit-url="thingUri + 'calibrate_xy'" :submit-url="calibrateXYUri"
:submit-label="'Auto-Calibrate using camera'" :submit-label="'Auto-Calibrate using camera'"
@response="onRecalibrateResponse" @response="onRecalibrateResponse"
@error="modalError" @error="modalError"
@ -28,7 +28,6 @@
</template> </template>
<script> <script>
import axios from "axios";
import taskSubmitter from "../../../genericComponents/taskSubmitter"; import taskSubmitter from "../../../genericComponents/taskSubmitter";
// Export main app // Export main app
@ -55,18 +54,24 @@ export default {
properties() { properties() {
return this.$store.getters["wot/thingDescription"]("camera_stage_mapping") return this.$store.getters["wot/thingDescription"]("camera_stage_mapping")
.properties; .properties;
},
calibrateXYUri() {
return this.thingActionUrl("camera_stage_mapping", "calibrate_xy");
} }
}, },
methods: { methods: {
getCalibrationData: async function() { getCalibrationData: async function() {
try { try {
let response = await axios.get(this.thingUri + "last_calibration"); let data = this.readThingProperty(
if (response.data == {}) { "camera_stage_mapping",
"last_calibration"
);
if (data == {}) {
throw "No calibration data available."; throw "No calibration data available.";
} }
const data = JSON.stringify(response.data); const dataStr = JSON.stringify(data);
const url = window.URL.createObjectURL(new Blob([data])); const url = window.URL.createObjectURL(new Blob([dataStr]));
const link = document.createElement("a"); const link = document.createElement("a");
link.href = url; link.href = url;
link.setAttribute("download", "csm_calibration.json"); link.setAttribute("download", "csm_calibration.json");