diff --git a/lib/galaxy/webapps/galaxy/api/datasets.py b/lib/galaxy/webapps/galaxy/api/datasets.py index bb1a08b85ab..f8e75f6e771 100644 --- a/lib/galaxy/webapps/galaxy/api/datasets.py +++ b/lib/galaxy/webapps/galaxy/api/datasets.py @@ -194,10 +194,15 @@ class FastAPIDatasets: ): return self.service.extra_files(trans, history_content_id) + @router.get( + "/api/datasets/{history_content_id}/display", + summary="Displays (preview) or downloads dataset content.", + response_class=StreamingResponse, + ) @router.get( "/api/histories/{history_id}/contents/{history_content_id}/display", name="history_contents_display", - summary="Displays dataset (preview) content.", + summary="Displays (preview) or downloads dataset content.", tags=["histories"], response_class=StreamingResponse, ) @@ -205,7 +210,10 @@ class FastAPIDatasets: self, request: Request, trans=DependsOnTrans, - history_id: EncodedDatabaseIdField = HistoryIDPathParam, + history_id: Optional[EncodedDatabaseIdField] = Query( + default=None, + description="The encoded database identifier of the History.", + ), history_content_id: EncodedDatabaseIdField = DatasetIDPathParam, preview: bool = Query( default=False, @@ -234,10 +242,10 @@ class FastAPIDatasets: ), ), ): - """Streams the preview contents of a dataset to be displayed in a browser.""" + """Streams the dataset for download or the contents preview to be displayed in a browser.""" extra_params = get_query_parameters_from_request_excluding(request, {"preview", "filename", "to_ext", "raw"}) display_data, headers = self.service.display( - trans, history_content_id, history_id, preview, filename, to_ext, raw, **extra_params + trans, history_content_id, preview, filename, to_ext, raw, **extra_params ) return StreamingResponse(display_data, headers=headers) diff --git a/lib/galaxy/webapps/galaxy/services/datasets.py b/lib/galaxy/webapps/galaxy/services/datasets.py index 1435b2a79e1..c8d19737f7b 100644 --- a/lib/galaxy/webapps/galaxy/services/datasets.py +++ b/lib/galaxy/webapps/galaxy/services/datasets.py @@ -411,7 +411,6 @@ class DatasetsService(ServiceBase, UsesVisualizationMixin): self, trans: ProvidesHistoryContext, history_content_id: EncodedDatabaseIdField, - history_id: EncodedDatabaseIdField, preview: bool = False, filename: Optional[str] = None, to_ext: Optional[str] = None, @@ -443,9 +442,6 @@ class DatasetsService(ServiceBase, UsesVisualizationMixin): except galaxy_exceptions.MessageException: raise except Exception as e: - log.exception( - "Server error getting display data for dataset (%s) from history (%s)", history_content_id, history_id - ) raise galaxy_exceptions.InternalServerError(f"Could not get display data for dataset: {util.unicodify(e)}") return rval, headers