Merge branch 'Stitch-all' into 'v3'

Stitch all scans button, and refresh scan tab when closing modals

See merge request openflexure/openflexure-microscope-server!330
This commit is contained in:
Joe Knapper 2025-07-25 17:20:03 +00:00
commit b4eaf48785
4 changed files with 40 additions and 2 deletions

View file

@ -977,3 +977,18 @@ class SmartScanThing(lt.Thing):
""" """
zip_fname = self._scan_dir_manager.zip_scan(scan_name, final_version=True) zip_fname = self._scan_dir_manager.zip_scan(scan_name, final_version=True)
return ZipBlob.from_file(zip_fname) return ZipBlob.from_file(zip_fname)
@lt.thing_action
def stitch_all_scans(
self, logger: lt.deps.InvocationLogger, cancel: lt.deps.CancelHook
):
"""Check the list of scans, and stitch any that don't have a DZI associated with it.
:raises RuntimeError: if the microscope is currently running a scan
"""
if self._scan_logger is not None:
raise RuntimeError("Can't stitch previous scans while a scan is ongoing")
for scan in self._scan_dir_manager.all_scans_info():
if scan.dzi is None:
self.stitch_scan(logger=logger, cancel=cancel, scan_name=scan.name)

View file

@ -344,10 +344,12 @@ export default {
hideModal() { hideModal() {
UIkit.modal(this.$refs.statusModal).hide(); UIkit.modal(this.$refs.statusModal).hide();
this.$root.$emit("modalClosed");
}, },
terminateTask: function() { terminateTask: function() {
axios.delete(this.taskUrl, { baseURL: this.$store.getters.baseUri }); axios.delete(this.taskUrl, { baseURL: this.$store.getters.baseUri });
this.$root.$emit("modalClosed");
} }
} }
}; };

View file

@ -10,6 +10,22 @@
<!-- Right side buttons --> <!-- Right side buttons -->
<div class="uk-navbar-right"> <div class="uk-navbar-right">
<div class="uk-grid"> <div class="uk-grid">
<div style="margin-top:5px;margin-bottom: 2px">
<action-button
class="uk-width-1-1"
thing="smart_scan"
action="stitch_all_scans"
submit-label="Stitch All Remaining"
:can-terminate="true"
:button-primary="false"
:modal-progress="true"
:requires-confirmation="true"
:confirmation-message="
'<h3>Stitch all unstitched scans?</h3><br>Depending on the number and size of scans, this may be slow, and your microscope should not be used during the stitching.'
"
@error="modalError"
/>
</div>
<div> <div>
<button <button
class="uk-button uk-button-default uk-width-1-1" class="uk-button uk-button-default uk-width-1-1"
@ -117,12 +133,11 @@
thing="smart_scan" thing="smart_scan"
action="stitch_scan" action="stitch_scan"
v-if="item.can_stitch | (item.stitch_available & !item.dzi)" v-if="item.can_stitch | (item.stitch_available & !item.dzi)"
:can-terminate="false" :can-terminate="true"
:submit-data="{ scan_name: item.name }" :submit-data="{ scan_name: item.name }"
:button-primary="false" :button-primary="false"
:modal-progress="true" :modal-progress="true"
@error="modalError" @error="modalError"
@response="updateScans"
/> />
<button <button
v-if="item.dzi" class="uk-button uk-button-default uk-width-1-1" v-if="item.dzi" class="uk-button uk-button-default uk-width-1-1"
@ -200,6 +215,10 @@ export default {
this.$root.$on("globalUpdateScans", () => { this.$root.$on("globalUpdateScans", () => {
this.updateScans(); this.updateScans();
}); });
this.$root.$on("modalClosed", () => {
// Handle the modal closed event here
this.updateScans();
});
}, },
created: function() { created: function() {
@ -228,6 +247,7 @@ export default {
this.unwatchStoreFunction(); this.unwatchStoreFunction();
this.unwatchStoreFunction = null; this.unwatchStoreFunction = null;
} }
this.$root.$off("modalClosed"); // Clean up event listener
}, },
methods: { methods: {

View file

@ -101,6 +101,7 @@ Vue.mixin({
if (context.$store.state.autoGpuPreview) { if (context.$store.state.autoGpuPreview) {
context.$root.$emit("globalTogglePreview", true); context.$root.$emit("globalTogglePreview", true);
} }
context.$root.$emit("modalClosed");
}); });
}; };
return new Promise(showModal); return new Promise(showModal);