From 4672660c368b922d74f820d2f2d952f851e472cc Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 14 Nov 2024 21:33:33 +0100 Subject: [PATCH 1/2] add status icons --- .../db_structure/version_info.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bioimageio_collection_backoffice/db_structure/version_info.py b/bioimageio_collection_backoffice/db_structure/version_info.py index 3862786..7160ec6 100644 --- a/bioimageio_collection_backoffice/db_structure/version_info.py +++ b/bioimageio_collection_backoffice/db_structure/version_info.py @@ -20,6 +20,7 @@ class _StatusBase(Node, frozen=True): timestamp: datetime = pydantic.Field(default_factory=datetime.now) run_url: Optional[str] = settings.run_url + icon: str = "๐Ÿ›ˆ" class _DraftStatusBase(_StatusBase, frozen=True): @@ -35,31 +36,36 @@ def _validate_num_steps(self): class UnpackingStatus(_DraftStatusBase, frozen=True): name: Literal["unpacking"] = "unpacking" step: Literal[1] = 1 + icon: str = "๐Ÿ“ฆ" class UnpackedStatus(_DraftStatusBase, frozen=True): name: Literal["unpacked"] = "unpacked" description: str = "staging was successful; awaiting automated tests to start โณ" step: Literal[2] = 2 + icon: str = "โณ" class TestingStatus(_DraftStatusBase, frozen=True): name: Literal["testing"] = "testing" step: Literal[3] = 3 + icon: str = "๐Ÿงช" class AwaitingReviewStatus(_DraftStatusBase, frozen=True): name: Literal["awaiting review"] = "awaiting review" description: str = ( "Thank you for your contribution! ๐Ÿ’ช" - "Our bioimage.io maintainers will take a look soon. ๐Ÿฆ’" + "Our bioimage.io maintainers will take a look soon." ) step: Literal[4] = 4 + icon: str = "๐Ÿง" class ChangesRequestedStatus(_DraftStatusBase, frozen=True): name: Literal["changes requested"] = "changes requested" step: Literal[5] = 5 + icon: str = "๐Ÿ”ง" class AcceptedStatus(_DraftStatusBase, frozen=True): @@ -68,6 +74,7 @@ class AcceptedStatus(_DraftStatusBase, frozen=True): "This staged version has been accepted by a bioimage.io maintainer and is about to be published." ) step: Literal[5] = 5 + icon: str = "๐Ÿ‘" class PublishedDraftStatus(_DraftStatusBase, frozen=True): @@ -76,6 +83,7 @@ class PublishedDraftStatus(_DraftStatusBase, frozen=True): name: Literal["published"] = "published" description: str = "published! (this draft will be deleted shortly)" step: Literal[6] = 6 + icon: str = "๐ŸŽ‰" DraftStatus = Annotated[ @@ -98,6 +106,7 @@ class ErrorStatus(_StatusBase, frozen=True): message: str traceback: List[str] during: Optional[DraftStatus] + icon: str = "๐Ÿ”ด" class DraftInfo(Node, frozen=True): From 93ae1ffc2eb6f846ba53803a2ff11bd39abf2583 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 14 Nov 2024 21:34:03 +0100 Subject: [PATCH 2/2] prettier ChangesRequestedStatus description --- .../remote_collection.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bioimageio_collection_backoffice/remote_collection.py b/bioimageio_collection_backoffice/remote_collection.py index 7378c5e..7907610 100644 --- a/bioimageio_collection_backoffice/remote_collection.py +++ b/bioimageio_collection_backoffice/remote_collection.py @@ -867,18 +867,17 @@ def request_changes(self, reviewer: str, reason: str): # map reviewer id to name for r in self.collection.config.reviewers: if reviewer == r.id: - reviewer = r.name break + else: + raise ValueError(reviewer) - self._set_status(ChangesRequestedStatus(description=reason)) + description = ( + f' {r.name} requested changes: {reason}' + ) + plain_description = f"{r.name} requested changes: {reason}" + self._set_status(ChangesRequestedStatus(description=description)) self.extend_chat( - Chat( - messages=[ - Message( - author="system", text=f"{reviewer} requested changes: {reason}" - ) - ] - ) + Chat(messages=[Message(author="system", text=plain_description)]) ) @log