diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 1b760e13..44fddb61 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -17,6 +17,7 @@ from subprocess import SubprocessError from fastapi import HTTPException from fastapi.responses import FileResponse import numpy as np +from pydantic import BaseModel import labthings_fastapi as lt @@ -39,6 +40,16 @@ CSMDep = lt.deps.direct_thing_client_dependency( AutofocusDep = lt.deps.direct_thing_client_dependency(AutofocusThing, "/autofocus/") +class ScanListData(BaseModel): + """The data to be sent to the Scan List tab.""" + + scans: list[scan_directories.ScanInfo] + """The list of scans as ScanInfo objects""" + + ongoing: Optional[str] + """The name of the ongoing scan or None""" + + class JPEGBlob(lt.blob.Blob): """A class representing a JPEG image as a LabThings FastAPI Blob.""" @@ -557,7 +568,7 @@ class SmartScanThing(lt.Thing): """Whether to run a final stitch at the end of a successful scan.""" @lt.thing_property - def scans(self) -> list[scan_directories.ScanInfo]: + def scans(self) -> ScanListData: """All the available scans. Each scan has a name (which can be used to access it), along with @@ -566,7 +577,10 @@ class SmartScanThing(lt.Thing): uses a regular expression, and changes to the naming scheme will break it. """ - return self._scan_dir_manager.all_scans_info() + return ScanListData( + scans=self._scan_dir_manager.all_scans_info(), + ongoing=None if self._ongoing_scan is None else self._ongoing_scan.name, + ) @lt.fastapi_endpoint( "get", diff --git a/webapp/src/components/tabContentComponents/scanListComponents/scanCard.vue b/webapp/src/components/tabContentComponents/scanListComponents/scanCard.vue index cef8e35b..a44d5406 100644 --- a/webapp/src/components/tabContentComponents/scanListComponents/scanCard.vue +++ b/webapp/src/components/tabContentComponents/scanListComponents/scanCard.vue @@ -14,61 +14,64 @@ /> -