mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Refactor HistoryDetailedList to use AnyHistoryView
This commit is contained in:
@@ -1283,6 +1283,7 @@ HistoryStateIds = Dict[DatasetState, List[DecodedDatabaseIdField]]
|
||||
|
||||
class HistoryDetailed(HistorySummary): # Equivalent to 'dev-detailed' view, which seems the default
|
||||
"""History detailed information."""
|
||||
|
||||
contents_url: ContentsUrlField
|
||||
size: int = Field(
|
||||
...,
|
||||
@@ -1339,13 +1340,6 @@ class HistoryDetailed(HistorySummary): # Equivalent to 'dev-detailed' view, whi
|
||||
)
|
||||
|
||||
|
||||
class HistoryDetailedList(RootModel):
|
||||
root: List[HistoryDetailed] = Field(
|
||||
default=[],
|
||||
title="List with detailed information of Histories.",
|
||||
)
|
||||
|
||||
|
||||
AnyHistoryView = Union[
|
||||
HistoryDetailed,
|
||||
HistorySummary,
|
||||
|
||||
@@ -51,9 +51,7 @@ from galaxy.schema import (
|
||||
SerializationParams,
|
||||
)
|
||||
from galaxy.schema.fields import DecodedDatabaseIdField
|
||||
from galaxy.schema.history import (
|
||||
HistoryIndexQueryPayload,
|
||||
)
|
||||
from galaxy.schema.history import HistoryIndexQueryPayload
|
||||
from galaxy.schema.schema import (
|
||||
AnyArchivedHistoryView,
|
||||
AnyHistoryView,
|
||||
@@ -65,7 +63,6 @@ from galaxy.schema.schema import (
|
||||
CustomBuildsMetadataResponse,
|
||||
ExportHistoryArchivePayload,
|
||||
HistoryArchiveExportResult,
|
||||
HistoryDetailedList,
|
||||
HistoryImportArchiveSourceType,
|
||||
JobExportHistoryArchiveModel,
|
||||
JobIdResponse,
|
||||
@@ -220,15 +217,16 @@ class HistoriesService(ServiceBase, ConsumesModelStores, ServesExportStores):
|
||||
trans,
|
||||
payload: HistoryIndexQueryPayload,
|
||||
include_total_count: bool = False,
|
||||
) -> Tuple[HistoryDetailedList, int]:
|
||||
) -> Tuple[List[AnyHistoryView], int]:
|
||||
"""Return a list of History accessible by the user
|
||||
|
||||
:rtype: list
|
||||
:returns: dictionaries containing History details
|
||||
"""
|
||||
serialization_params = SerializationParams(default_view="detailed")
|
||||
entries, total_matches = self.manager.index_query(trans, payload, include_total_count)
|
||||
return (
|
||||
HistoryDetailedList(root=[entry.to_dict(view="element") for entry in entries]),
|
||||
[self._serialize_history(trans, entry, serialization_params) for entry in entries],
|
||||
total_matches,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user