From 3beb8e114762fa7b134b5240aa3705584aa9bc1d Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Sat, 7 Feb 2026 19:27:32 +0000 Subject: [PATCH] Auto-populate workflow dropdown --- .../things/smart_scan.py | 10 +++++ .../tabContentComponents/slideScanContent.vue | 45 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 3f8b36e0..55e6443c 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -208,6 +208,16 @@ class SmartScanThing(lt.Thing): raise ScanNotRunningError("Cannot get ongoing scan if scan is not running.") return self._ongoing_scan + @lt.property + def all_workflow_names(self) -> list[str]: + """Return a list of all available Scan Workflows.""" + return list(self._all_workflows.keys()) + + @lt.property + def workflow_display_names(self) -> dict[str, str]: + """Return a list of the display names of all available Scan Workflows.""" + return {name: wf.display_name for name, wf in self._all_workflows.items()} + _scan_data: Optional[ActiveScanData] = None @property diff --git a/webapp/src/components/tabContentComponents/slideScanContent.vue b/webapp/src/components/tabContentComponents/slideScanContent.vue index eeef6d86..b10b9d49 100644 --- a/webapp/src/components/tabContentComponents/slideScanContent.vue +++ b/webapp/src/components/tabContentComponents/slideScanContent.vue @@ -2,6 +2,24 @@
+ +
+ + + +

{{ workflowDisplayName }}

@@ -145,6 +163,7 @@ export default { workflowSettings: [], workflowDisplayName: undefined, workflowBlurb: undefined, + workflowOptions: [], }; }, @@ -159,6 +178,10 @@ export default { async created() { this.readSettings(); + this.workflowOptions = await this.readThingProperty( + "smart_scan", + "workflow_display_names", + ); }, methods: { @@ -216,6 +239,28 @@ export default { setTimeout(this.pollScan, 1000); // keep rescheduling until it's stopped } }, + async setWorkflow(name) { + try { + this.workflowName = name; + + await this.writeThingProperty( + "smart_scan", + "workflow_name", + name + ); + + // refresh UI + await this.readSettings(); + } catch (err) { + this.modalError(err); + + // revert if server rejected + this.workflowName = await this.readThingProperty( + "smart_scan", + "workflow_name" + ); + } + }, async downloadZipFile(response) { const scan_name = response.input.scan_name; const filename = `${scan_name}_images.zip`;