feat(dashboard): clarify the fleet status card and swap map locations to project monitoring location coords.

feat: Location no longer assigned directly to unit, locations and coords are assigned to location only, unit only is deployed or benched.
This commit is contained in:
2026-06-01 22:01:38 +00:00
parent 623ef648b7
commit 56bd3041cf
12 changed files with 345 additions and 195 deletions
+4 -2
View File
@@ -14,6 +14,7 @@ import os
from backend.database import get_db
from backend.models import RosterUnit
from backend.services.unit_location import get_active_location
from backend.templates_config import templates
logger = logging.getLogger(__name__)
@@ -58,13 +59,14 @@ async def get_slm_summary(unit_id: str, db: Session = Depends(get_db)):
except Exception as e:
logger.warning(f"Failed to get SLM status for {unit_id}: {e}")
loc = get_active_location(db, unit_id)
return {
"unit_id": unit_id,
"device_type": "slm",
"deployed": unit.deployed,
"model": unit.slm_model or "NL-43",
"location": unit.address or unit.location,
"coordinates": unit.coordinates,
"location": (loc or {}).get("address") or (loc or {}).get("name") or "",
"coordinates": (loc or {}).get("coordinates") or "",
"note": unit.note,
"status": status_data,
"last_check": unit.slm_last_check.isoformat() if unit.slm_last_check else None,