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 }}

- - - - - - - - - - - - - - - - - - - - {% for date, preds in predictions.items() %} - {% set date_loop = loop %} - {% for pred in preds %} - - {% if loop.first %}{% endif %} - - - - - - - - - +
+

Passes for {{ location.lat }}, {{ location.lng }}

+
TotalRiseCulminateSet
DateLengthTimeAzimuthTimeAzimuthElevationDistanceTimeAzimuth
{{ date }}{{ 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 }})
+ + + + + + + + + + + + + + + + + + {% for date, preds in predictions.items() %} + {% set date_loop = loop %} + {% for pred in preds %} + + {% if loop.first %}{% endif %} + + + + + + + + + + + {% endfor %} {% endfor %} - {% endfor %} +
TotalRiseCulminateSet
DateLengthTimeAzimuthTimeAzimuthElevationDistanceTimeAzimuth
{{ date }}{{ 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 }})
+ - + {% endblock %} -- cgit v1.3.1