Add timestamp to the page for update info

This commit is contained in:
Stephan Kulow 2020-01-30 21:04:22 +01:00
parent 3a1df2ac6c
commit 5d2dc02dbd
2 changed files with 74 additions and 59 deletions

View File

@ -19,6 +19,7 @@ from openqa_client.client import OpenQA_Client
from openqa_client.exceptions import ConnectionError, RequestError
from urllib.error import HTTPError, URLError
from urllib.parse import quote_plus
from datetime import datetime
import requests
from osclib.PubSubConsumer import PubSubConsumer
@ -144,5 +145,6 @@ if __name__ == '__main__':
with app.app_context():
rendered = render_template('dashboard.html',
projectname = args.project,
lastupdate = datetime.now(),
projects = fetcher.projects)
print(rendered)

View File

@ -1,5 +1,6 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
@ -8,8 +9,13 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title>Dashboard for {{ projectname }}</title>
</head>
<body>
<h1>Dashboard for {{ projectname }}</h1>
<div class="container">
<div class="row">
<div class="h1 col text-left">Dashboard for {{ projectname }}</div>
<div class="col-3 text-right">Last update: <time class="timeago" datetime="{{lastupdate}}">{{ lastupdate }}</time></div>
</div>
<table class="table">
<thead>
<tr>
@ -68,9 +74,16 @@
</tr>
{% endfor %}
</table>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.6.7/jquery.timeago.min.js" integrity="sha256-0+5OfvOxkLHqpLPPwy9pDjug8N3cwaqcmleaxnR5VS8=" crossorigin="anonymous"></script>
<script>
jQuery(document).ready(function() {
jQuery("time.timeago").timeago();
});
</script>
</body>
</html>