Added CSM data download button
This commit is contained in:
parent
07c4399bbf
commit
9822965335
1 changed files with 53 additions and 1 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
<!--Show auto calibrate if default plugin is enabled-->
|
<!--Show auto calibrate if default plugin is enabled-->
|
||||||
<div v-if="'calibrate_xy' in recalibrationLinks" class="uk-margin-small">
|
<div v-if="'calibrate_xy' in recalibrationLinks" class="uk-margin-small">
|
||||||
<taskSubmitter
|
<taskSubmitter
|
||||||
|
:button-primary="true"
|
||||||
:can-terminate="false"
|
:can-terminate="false"
|
||||||
:requires-confirmation="true"
|
:requires-confirmation="true"
|
||||||
:confirmation-message="
|
:confirmation-message="
|
||||||
|
|
@ -21,6 +22,15 @@
|
||||||
>
|
>
|
||||||
</taskSubmitter>
|
</taskSubmitter>
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
v-if="'get_calibration' in recalibrationLinks"
|
||||||
|
v-show="dataAvailable"
|
||||||
|
type="button"
|
||||||
|
class="uk-button uk-button-default uk-width-1-1"
|
||||||
|
@click="getCalibrationData()"
|
||||||
|
>
|
||||||
|
Download calibration data
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -41,7 +51,8 @@ export default {
|
||||||
return {
|
return {
|
||||||
settings: null,
|
settings: null,
|
||||||
recalibrationLinks: {},
|
recalibrationLinks: {},
|
||||||
isCalibrating: false
|
isCalibrating: false,
|
||||||
|
dataAvailable: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -61,11 +72,16 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
updateSettings: function() {
|
updateSettings: function() {
|
||||||
|
// Update links
|
||||||
axios
|
axios
|
||||||
.get(this.settingsUri)
|
.get(this.settingsUri)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.settings =
|
this.settings =
|
||||||
response.data.extensions["org.openflexure.camera_stage_mapping"];
|
response.data.extensions["org.openflexure.camera_stage_mapping"];
|
||||||
|
// Check if existing calibration data is available
|
||||||
|
if ("get_calibration" in this.recalibrationLinks) {
|
||||||
|
this.checkCalibrationData();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.modalError(error); // Let mixin handle error
|
this.modalError(error); // Let mixin handle error
|
||||||
|
|
@ -73,6 +89,42 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkCalibrationData: function() {
|
||||||
|
axios
|
||||||
|
.get(this.recalibrationLinks.get_calibration.href)
|
||||||
|
.then(response => {
|
||||||
|
console.log("CSM data:");
|
||||||
|
console.log(response.data);
|
||||||
|
if (Object.keys(response.data).length === 0) {
|
||||||
|
this.dataAvailable = false;
|
||||||
|
} else {
|
||||||
|
this.dataAvailable = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getCalibrationData: function() {
|
||||||
|
axios
|
||||||
|
.get(this.recalibrationLinks.get_calibration.href)
|
||||||
|
.then(response => {
|
||||||
|
if (response.data != {}) {
|
||||||
|
const data = JSON.stringify(response.data);
|
||||||
|
const url = window.URL.createObjectURL(new Blob([data]));
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute("download", "csm_calibration.json");
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.modalError(error); // Let mixin handle error
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
updateRecalibrationLinks: function() {
|
updateRecalibrationLinks: function() {
|
||||||
axios
|
axios
|
||||||
.get(this.pluginsUri) // Get a list of plugins
|
.get(this.pluginsUri) // Get a list of plugins
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue