From 6f522f855cbf3f698abdac5bed7005d5c8fd1705 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Mon, 28 Sep 2020 23:08:23 +0300 Subject: Initial Vue component --- iss/server.py | 3 ++ iss/templates/passes.html | 84 +++++++++++++++++++++++++++-------------------- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/iss/server.py b/iss/server.py index e6e59b7..e8486ea 100644 --- a/iss/server.py +++ b/iss/server.py @@ -1,3 +1,5 @@ +import json + from fastapi import FastAPI, Request, Header from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates @@ -31,6 +33,7 @@ async def passes(request: Request, lat: float, lng: float): { "request": request, "predictions": preds, + "predictions_json": json.dumps(preds), "location": {"lat": lat, "lng": lng}, }, ) diff --git a/iss/templates/passes.html b/iss/templates/passes.html index c89aef7..10fb52b 100644 --- a/iss/templates/passes.html +++ b/iss/templates/passes.html @@ -6,43 +6,55 @@ {% endblock %} {% block content %} -
Passes for {{ location.lat }}, {{ location.lng }}
-| Total | -Rise | -Culminate | -Set | -|||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Date | -Length | -Time | -Azimuth | -Time | -Azimuth | -Elevation | -Distance | -Time | -Azimuth | -|||||||||||||||||||||||||||||
| {{ date }} | {% endif %} -{{ pred.length }} | -{{ pred.rise.time }} | -{{ pred.rise.azimuth }} ({{ pred.rise.direction }}) | -{{ pred.culminate.time }} | -{{ pred.culminate.azimuth }} ({{ pred.culminate.direction }}) | -{{ pred.culminate.degrees }} | -{{ pred.culminate.distance }} | -{{ pred.set.time }} | -{{ pred.set.azimuth }} ({{ pred.set.direction }}) | +|||||||||||||||||||||||||||||
| Total | +Rise | +Culminate | +Set | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Date | +Length | +Time | +Azimuth | +Time | +Azimuth | +Elevation | +Distance | +Time | +Azimuth | +
| {{ date }} | {% endif %} +{{ pred.length }} | +{{ pred.rise.time }} | +{{ pred.rise.azimuth }} ({{ pred.rise.direction }}) | +{{ pred.culminate.time }} | +{{ pred.culminate.azimuth }} ({{ pred.culminate.direction }}) | +{{ pred.culminate.degrees }} | +{{ pred.culminate.distance }} | +{{ pred.set.time }} | +{{ pred.set.azimuth }} ({{ pred.set.direction }}) | +