Send more data back from smart scan to enable if a zip was created

This commit is contained in:
Julian Stirling 2026-07-02 14:40:34 +01:00
parent 1aed597f9c
commit 18e3978134
4 changed files with 78 additions and 15 deletions

View file

@ -134,7 +134,7 @@ export default {
},
},
emits: ["closeTask", "completed", "actionStartedExternally"],
emits: ["closeTask", "completed", "finished", "actionStartedExternally"],
data() {
return {

View file

@ -39,7 +39,7 @@
<div class="uk-width-1-1 uk-flex uk-flex-center">
<div class="uk-width-2-3">
<action-button
v-if="scanComplete"
v-if="scanComplete && imageCount >= 1"
thing="smart_scan"
action="download_zip"
submit-label="Download ZIP"
@ -51,7 +51,10 @@
/>
</div>
</div>
<h3 v-if="scanning" class="uk-margin-left">Scan ID: {{ lastScanName }}</h3>
<div class="uk-margin-left info-headings">
<h3 v-if="scanning" class="uk-margin-left">Scan ID: {{ lastScanName }}</h3>
<h3 v-if="scanning" class="uk-margin-left">Images captured: {{ imageCount }}</h3>
</div>
</template>
</actionTab>
</template>
@ -79,6 +82,8 @@ export default {
taskId: null,
taskUrl: null,
lastStitchedImage: null,
imageCount: null,
scanPhase: null,
scanComplete: false,
scan_name: "",
// This adds the parent name as value for prop streamId
@ -123,6 +128,8 @@ export default {
startScanning(id, url) {
this.lastStitchedImage = null;
this.lastScanName = null;
this.imageCount = 0;
this.scanPhase = null;
this.taskId = id;
this.taskUrl = url;
this.scanComplete = false;
@ -135,17 +142,27 @@ export default {
this.taskId = null;
this.taskUrl = null;
this.lastStitchedImage = null;
this.imageCount = null;
this.scanPhase = null;
this.scanComplete = false;
},
async pollScan() {
if (!this.scanComplete) {
// while the scan is running
let mtime = await this.readThingProperty("smart_scan", "latest_preview_stitch_time", true);
let scanDetails = await this.readThingProperty(
"smart_scan",
"latest_scan_live_details",
true,
);
this.lastScanName = scanDetails.name;
let mtime = scanDetails.stitch_timestamp;
this.imageCount = scanDetails.image_count;
this.scanPhase = scanDetails.scan_phase;
if (mtime !== null) {
this.lastStitchedImage = `${this.baseUri}/smart_scan/latest_preview_stitch.jpg?t=${mtime}`;
}
this.lastScanName = await this.readThingProperty("smart_scan", "latest_scan_name", true);
setTimeout(this.pollScan, 1000); // keep rescheduling until it's stopped
}
},
@ -163,4 +180,14 @@ export default {
};
</script>
<style scoped></style>
<style scoped>
.info-headings h3 {
margin-top: 20px;
margin-bottom: 5px;
}
/* If one heading follows another don't have a large top margin. */
.info-headings h3 + h3 {
margin-top: 5px;
}
</style>