html page refresh and docs

This commit is contained in:
boyska 2023-08-18 17:50:05 +02:00
parent 0442056953
commit 82b4d008e7
2 changed files with 17 additions and 2 deletions

View file

@ -1,7 +1,9 @@
<!doctype html>
<html>
<head>
{% if autorefresh %}
<meta http-equiv="refresh" content="60">
{% endif %}
<title>Squeow</title>
<style>
table td { text-align: right; }
@ -22,6 +24,16 @@
{% endfor %}
</tbody></table>
</section>
<section>
<header> <h2>Docs</h2> </header>
<p>
<ul>
<li><a href="https://git.lattuga.net/boyska/seriow">Code</a></li>
<li><a href="{{url_for("swagger_ui_html")}}">API</a></li>
</ul>
</p>
</section>
</body>
</html>

View file

@ -151,5 +151,8 @@ async def export_prometheus() -> str:
@app.get("/", response_class=HTMLResponse)
async def get_page_index(request: Request):
autorefresh = request.query_params.get('refresh') is not None
return templates.TemplateResponse("index.html",
dict(request=request, variables=settings.variables))
dict(request=request,
autorefresh=autorefresh,
variables=settings.variables))