Skip to content

Commit

Permalink
feat: Add name and type fields to Instance class in web UI
Browse files Browse the repository at this point in the history
The `Instance` class has been updated to include a `name` field and a `type` field. The `name` field represents the name of the instance, and the `type` field indicates whether the instance is static, a container, or a pod. This change provides additional information about the instances being managed.
  • Loading branch information
TheophileDiot committed Aug 7, 2024
1 parent 9713f9b commit 9cee473
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ui/src/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,30 @@

class Instance:
hostname: str
name: str
method: Literal["ui", "scheduler", "autoconf", "manual"]
status: Literal["loading", "up", "down"]
type: Literal["static", "container", "pod"]
creation_date: datetime
last_seen: datetime
apiCaller: ApiCaller

def __init__(
self,
hostname: str,
name: str,
method: Literal["ui", "scheduler", "autoconf", "manual"],
status: Literal["loading", "up", "down"],
type: Literal["static", "container", "pod"],
creation_date: datetime,
last_seen: datetime,
apiCaller: ApiCaller,
) -> None:
self.hostname = hostname
self.name = name
self.method = method
self.status = status
self.type = type
self.creation_date = creation_date
self.last_seen = last_seen
self.apiCaller = apiCaller or ApiCaller()
Expand All @@ -39,8 +45,10 @@ def from_hostname(hostname: str, db) -> Optional["Instance"]:

return Instance(
instance["hostname"],
instance["server_name"],
instance["method"],
instance["status"],
instance["type"],
instance["creation_date"],
instance["last_seen"],
ApiCaller(
Expand Down Expand Up @@ -152,8 +160,10 @@ def get_instances(self) -> list[Instance]:
return [
Instance(
instance["hostname"],
instance["name"],
instance["method"],
instance["status"],
instance["type"],
instance["creation_date"],
instance["last_seen"],
ApiCaller(
Expand Down

0 comments on commit 9cee473

Please sign in to comment.