Don't invoke stitching from the front-end

Stitching is now done automatically in a sub process by the
server. This is much cleaner - and all we need to do is poll for
file updates.

I've also styled the log display slightly better.
This commit is contained in:
Richard Bowman 2024-01-11 01:51:17 +00:00
parent 9a2b830ff5
commit 3de7aa2fb2
2 changed files with 12 additions and 44 deletions

View file

@ -1,5 +1,5 @@
<template>
<div ref="logContainer" class="log-container">
<div ref="logContainer" class="log-container uk-margin-left uk-margin-right uk-margin">
<div v-if="log">
<div v-for="(item, index) in log" :key="`log_entry_${index}`">
{{ item.message }}
@ -57,5 +57,8 @@ export default {
position: relative;
overflow-y: auto;
overflow-x: auto;
background-color: white;
padding: 0.5em;
border: 1px solid black;
}
</style>

View file

@ -49,6 +49,7 @@
</div>
</div>
<div v-show="scanning">
<mini-stream-display v-if="displayImageOnRight" />
<action-log-display
id="log-display"
:log="log"
@ -72,17 +73,6 @@
Close
</button>
</div>
<mini-stream-display v-if="displayImageOnRight" />
<div v-show="false">
<taskSubmitter
ref="stitchFromStageSubmitter"
:submit-url="stitchFromStageUri"
submit-label="Stitch image from stage coordinates"
:submit-data="stitchPayload"
@completed="lastStitchedImage = $event.href"
@update:taskStatus="stitchFromStageStatus = $event"
/>
</div>
</div>
<div class="view-component uk-width-expand">
<img v-if="displayImageOnRight" :src="lastStitchedImage" id="last-stitched-image"/>
@ -120,7 +110,7 @@ export default {
stitchFromStageStatus: "",
progress: null,
log: [],
lastStitchedImage: null
lastStitchedImage: null,
};
},
@ -131,35 +121,9 @@ export default {
smartScanUri() {
return this.thingActionUrl("smart_scan", "sample_scan");
},
stitchFromStageUri () {
return this.thingActionUrl("stitching", "stitch_scan_from_stage");
},
stitchUri () {
return this.thingActionUrl("stitching", "stitch_scan");
},
correlateUri () {
return this.thingActionUrl("stitching", "correlate_scan");
},
cancellable() {
return (this.taskStatus == "running") | (this.taskStatus == "pending");
},
correlatePayload() {
return {
scan_name: this.lastScanName
}
},
stitchPayload() {
return {
downsample: 2,
...this.correlatePayload
}
},
stitchFromStagePayload() {
return {
downsample: 2,
...this.correlatePayload
}
},
displayImageOnRight() {
return this.scanning & this.lastStitchedImage !== null;
}
@ -176,14 +140,15 @@ export default {
startScanning() {
this.lastStitchedImage = null;
this.scanning = true;
setTimeout(this.pollScan, 5000);
setTimeout(this.pollScan, 1000);
},
pollScan() {
async pollScan() {
if (this.cancellable) { // while the scan is running
if (!["pending", "running"].includes(this.stitchFromStageStatus)) {
this.$refs.stitchFromStageSubmitter.startTask()
let mtime = await this.readThingProperty("smart_scan", "latest_preview_stitch_time");
if (mtime !== null) {
this.lastStitchedImage = `${this.$store.getters.baseUri}/smart_scan/latest_preview_stitch.jpg?t=${mtime}`;
}
setTimeout(this.pollScan, 5000); // keep rescheduling until it's stopped
setTimeout(this.pollScan, 1000); // keep rescheduling until it's stopped
}
}
}