Add detail tooltips in server browser stability %

When hovering on stability percentages in the server browser, a tooltip
now shows the total downtime in the past 30 days, number of incidents,
their average length and the longest's duration.
This commit is contained in:
miruka
2021-01-11 07:50:32 -04:00
parent ae4bcffa06
commit 98b6a7b74e
3 changed files with 46 additions and 17 deletions

View File

@@ -42,13 +42,14 @@ class PingStatus(AutoStrEnum):
class Homeserver(ModelItem):
"""A homeserver we can connect to. The `id` field is the server's URL."""
id: str = field()
name: str = field()
site_url: str = field()
country: str = field()
ping: int = -1
status: PingStatus = PingStatus.Pinging
stability: float = -1
id: str = field()
name: str = field()
site_url: str = field()
country: str = field()
ping: int = -1
status: PingStatus = PingStatus.Pinging
stability: float = -1
downtimes_ms: List[float] = field(default_factory=list)
def __lt__(self, other: "Homeserver") -> bool:
return (self.name.lower(), self.id) < (other.name.lower(), other.id)