-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement release check events and abort action (#13)
* fix base action * typo * new release events * common dialog data * adapt schema * fix dependency * remove general release events * add release check events for documents, parts and ecs * update schema * remove unneeded constructors * cdb_obsolete can be None * Functions can return Actions or list of Actions directly * make doc * add documentation for new actions and events * make schema * unused import * remove mentioning workloadresponse * clarify check events * change order * remove some unused code * make object linking independent of field names * rename fields to attached_<object> * adjust documentation to include the attached_<object> fields --------- Co-authored-by: Jens Kürten <[email protected]>
- Loading branch information
1 parent
c1aac00
commit 49c7955
Showing
27 changed files
with
553 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, Field | ||
from pydantic import Field | ||
|
||
from .base import ActionNames, BaseAction | ||
|
||
|
||
class AbortAndShowErrorData(BaseModel): | ||
def __init__(self, message: str, **kwargs): | ||
super().__init__(message=message, **kwargs) | ||
|
||
message: str = Field("unknown error", description="error message to be shown to the user") | ||
|
||
|
||
class AbortAndShowErrorAction(BaseAction): | ||
def __init__(self, id: str, message: str | None = None, **kwargs): # pylint: disable=redefined-builtin | ||
if message: | ||
super().__init__(name=ActionNames.ABORT_AND_SHOW_ERROR, id=id, data=AbortAndShowErrorData(message=message)) | ||
else: | ||
super().__init__(name=ActionNames.ABORT_AND_SHOW_ERROR, id=id, data=kwargs["data"]) | ||
|
||
name: Literal[ActionNames.ABORT_AND_SHOW_ERROR] | ||
data: AbortAndShowErrorData | ||
name: Literal[ActionNames.ABORT_AND_SHOW_ERROR] = ActionNames.ABORT_AND_SHOW_ERROR | ||
message: str = Field("unknown error", description="error message to be shown to the user") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class DocumentReleaseDialogData(BaseModel): | ||
dialog_type: Literal["document_release"] = "document_release" | ||
cdbprot_remark: str | None = Field(None, description="remark") | ||
cdb_ec_id: str | None = Field(None, description="Engineering Change ID") | ||
|
||
|
||
class PartReleaseDialogData(BaseModel): | ||
dialog_type: Literal["part_release"] = "part_release" | ||
cdbprot_remark: str | None = Field("", description="remark") | ||
cdb_ec_id: str | None = Field("", description="Engineering Change ID") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from csfunctions.objects import Document, Part | ||
|
||
from .base import BaseEvent, EventNames | ||
from .dialog_data import DocumentReleaseDialogData | ||
|
||
|
||
class DocumentReleaseCheckData(BaseModel): | ||
documents: list[Document] = Field(..., description="List of documents that will be released.") | ||
attached_parts: list[Part] = Field(..., description="List of parts that belong to the documents") | ||
dialog_data: DocumentReleaseDialogData | ||
|
||
|
||
class DocumentReleaseCheckEvent(BaseEvent): | ||
name: Literal[EventNames.DOCUMENT_RELEASE_CHECK] = EventNames.DOCUMENT_RELEASE_CHECK | ||
data: DocumentReleaseCheckData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from csfunctions.objects import Document, EngineeringChange, Part | ||
|
||
from .base import BaseEvent, EventNames | ||
|
||
|
||
class EngineeringChangeReleaseCheckData(BaseModel): | ||
attached_documents: list[Document] = Field(..., description="List of included documents.") | ||
attached_parts: list[Part] = Field(..., description="List of included parts.") | ||
engineering_changes: list[EngineeringChange] = Field( | ||
..., description="List of engineering changes that will be released." | ||
) | ||
|
||
|
||
class EngineeringChangeReleaseCheck(BaseEvent): | ||
name: Literal[EventNames.ENGINEERING_CHANGE_RELEASE_CHECK] = EventNames.ENGINEERING_CHANGE_RELEASE_CHECK | ||
data: EngineeringChangeReleaseCheckData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import Literal | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from csfunctions.objects import Document, Part | ||
|
||
from .base import BaseEvent, EventNames | ||
from .dialog_data import PartReleaseDialogData | ||
|
||
|
||
class PartReleaseCheckData(BaseModel): | ||
parts: list[Part] = Field(..., description="List of parts that will be released.") | ||
attached_documents: list[Document] = Field(..., description="List of documents that are referenced by the parts.") | ||
dialog_data: PartReleaseDialogData | ||
|
||
|
||
class PartReleaseCheckEvent(BaseEvent): | ||
name: Literal[EventNames.PART_RELEASE_CHECK] | ||
data: PartReleaseCheckData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.