Add icons back to spots & alerts

This commit is contained in:
Ian Renton
2026-09-05 09:48:56 +01:00
parent d6e53c14e9
commit 3e4327ec0c
20 changed files with 167 additions and 73 deletions
+10
View File
@@ -146,6 +146,11 @@ class Spot:
# The ID the source gave it, if any.
source_id: str | None = None
# Display info
# Icon to use when displaying this spot in the web UI. Chosen from the Font Awesome set.
icon: str | None = None
def __post_init__(self):
"""Normalise fields that don't survive a plain dict to Spot conversion. This is used in the "add spot" API
endpoint where the client is submitting JSON, and we want to recreate a full Spot object, including nested
@@ -455,6 +460,11 @@ class Spot:
self.de_longitude = de_call_info.longitude
self.de_grid = de_call_info.grid
# Icon for the spot should be the icon of the first SIG ref if present, otherwise a radio tower
self.icon = "fa-tower-cell"
if self.sig_refs and len(self.sig_refs) > 0 and self.sig_refs[0].icon:
self.icon = self.sig_refs[0].icon
except Exception:
logger.exception("Exception while inferring missing data from spot")