-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'deploy/hammer' into hammer/generic-alerts
Signed-off-by: Aaron Chong <[email protected]>
- Loading branch information
Showing
31 changed files
with
995 additions
and
439 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
46 changes: 46 additions & 0 deletions
46
packages/api-server/api_server/models/task_booking_label.py
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,46 @@ | ||
from typing import Optional | ||
|
||
import pydantic | ||
from pydantic import BaseModel | ||
|
||
# NOTE: This label model needs to exactly match the fields that are defined and | ||
# populated by the dashboard. Any changes to either side will require syncing. | ||
|
||
|
||
class TaskBookingLabelDescription(BaseModel): | ||
""" | ||
This description holds several fields that could be useful for frontend | ||
dashboards when dispatching a task, to then be identified or rendered | ||
accordingly back on the same frontend. | ||
""" | ||
|
||
task_definition_id: str | ||
unix_millis_warn_time: Optional[int] | ||
pickup: Optional[str] | ||
destination: Optional[str] | ||
cart_id: Optional[str] | ||
|
||
@staticmethod | ||
def from_json_string(json_str: str) -> Optional["TaskBookingLabelDescription"]: | ||
try: | ||
return TaskBookingLabelDescription.parse_raw(json_str) | ||
except pydantic.error_wrappers.ValidationError: | ||
return None | ||
|
||
|
||
class TaskBookingLabel(BaseModel): | ||
""" | ||
This label is to be populated by any frontend during a task dispatch, by | ||
being added to TaskRequest.labels, which in turn populates | ||
TaskState.booking.labels, and can be used to display relevant information | ||
needed for any frontends. | ||
""" | ||
|
||
description: TaskBookingLabelDescription | ||
|
||
@staticmethod | ||
def from_json_string(json_str: str) -> Optional["TaskBookingLabel"]: | ||
try: | ||
return TaskBookingLabel.parse_raw(json_str) | ||
except pydantic.error_wrappers.ValidationError: | ||
return None |
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,14 @@ | ||
from typing import Dict | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class TaskFavorite(BaseModel): | ||
id: str | ||
name: str | ||
unix_millis_earliest_start_time: int | ||
priority: Dict | None | ||
category: str | ||
description: Dict | None | ||
user: str | ||
task_definition_id: str |
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.