Handle missing stage in calibration modal
This commit is contained in:
parent
2616019af4
commit
55ac33796f
1 changed files with 51 additions and 14 deletions
|
|
@ -62,6 +62,14 @@
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="!canCSMCalibrated">
|
||||||
|
<p>
|
||||||
|
<b
|
||||||
|
>No stage connected. Please skip this step, or connect a valid
|
||||||
|
stage, then reboot your microscope.</b
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<p>
|
<p>
|
||||||
<b
|
<b
|
||||||
|
|
@ -164,7 +172,8 @@ export default {
|
||||||
return {
|
return {
|
||||||
ready: false,
|
ready: false,
|
||||||
stepValue: 0,
|
stepValue: 0,
|
||||||
settings: {}
|
settings: {},
|
||||||
|
config: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -172,6 +181,9 @@ export default {
|
||||||
settingsUri: function() {
|
settingsUri: function() {
|
||||||
return `${this.$store.getters.baseUri}/api/v2/instrument/settings`;
|
return `${this.$store.getters.baseUri}/api/v2/instrument/settings`;
|
||||||
},
|
},
|
||||||
|
configUri: function() {
|
||||||
|
return `${this.$store.getters.baseUri}/api/v2/instrument/configuration`;
|
||||||
|
},
|
||||||
availablePluginTitles: function() {
|
availablePluginTitles: function() {
|
||||||
return this.availablePlugins.map(a => a.title);
|
return this.availablePlugins.map(a => a.title);
|
||||||
},
|
},
|
||||||
|
|
@ -193,14 +205,24 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
canCSMCalibrated: function() {
|
canCSMCalibrated: function() {
|
||||||
return this.availablePluginTitles.includes(
|
// Assert CSM extension is enabled
|
||||||
|
var extensionEnabled = this.availablePluginTitles.includes(
|
||||||
"org.openflexure.camera_stage_mapping"
|
"org.openflexure.camera_stage_mapping"
|
||||||
);
|
);
|
||||||
|
// Assert real stage is connected
|
||||||
|
var stageConnected = this.config.stage.type !== "MissingStage";
|
||||||
|
// Combine
|
||||||
|
return stageConnected && extensionEnabled;
|
||||||
},
|
},
|
||||||
canLSTCalibrated: function() {
|
canLSTCalibrated: function() {
|
||||||
return this.availablePluginTitles.includes(
|
// Assert LST extension is enabled
|
||||||
|
var extensionEnabled = this.availablePluginTitles.includes(
|
||||||
"org.openflexure.calibration.picamera"
|
"org.openflexure.calibration.picamera"
|
||||||
);
|
);
|
||||||
|
// Assert real camera is connected
|
||||||
|
var cameraConnected = this.config.camera.type !== "MissingCamera";
|
||||||
|
// Combine
|
||||||
|
return cameraConnected && extensionEnabled;
|
||||||
},
|
},
|
||||||
isUseful: function() {
|
isUseful: function() {
|
||||||
var CSMUseful = this.canCSMCalibrated && !this.isCSMCalibrated;
|
var CSMUseful = this.canCSMCalibrated && !this.isCSMCalibrated;
|
||||||
|
|
@ -212,17 +234,21 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
show: function() {
|
show: function() {
|
||||||
// Get current settings
|
// Get current settings
|
||||||
this.getSettings().then(() => {
|
this.getSettings()
|
||||||
// Check if this calibration wizard can actually do anything useful
|
.then(() => {
|
||||||
console.log(this.isUseful);
|
return this.getConfig();
|
||||||
if (this.isUseful) {
|
})
|
||||||
this.ready = true;
|
.then(() => {
|
||||||
this.stepValue = 0;
|
// Check if this calibration wizard can actually do anything useful
|
||||||
// Show the modal
|
console.log(this.isUseful);
|
||||||
var el = this.$refs["calibrationModalEl"];
|
if (this.isUseful) {
|
||||||
this.showModalElement(el); // Calls the mixin
|
this.ready = true;
|
||||||
}
|
this.stepValue = 0;
|
||||||
});
|
// Show the modal
|
||||||
|
var el = this.$refs["calibrationModalEl"];
|
||||||
|
this.showModalElement(el); // Calls the mixin
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
|
|
@ -243,6 +269,17 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getConfig: function() {
|
||||||
|
return axios
|
||||||
|
.get(this.configUri)
|
||||||
|
.then(response => {
|
||||||
|
this.config = response.data;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
decrement: function() {
|
decrement: function() {
|
||||||
if (this.stepValue > 0) {
|
if (this.stepValue > 0) {
|
||||||
this.stepValue = this.stepValue - 1;
|
this.stepValue = this.stepValue - 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue