summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-06-15 12:33:59 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-06-15 12:33:59 +0100
commit395b6b1c34a12874d3be4c2b9e9f6ca9aa70db83 (patch)
treedc96dafe403d012dbf7f013fd443f3e97138e63a
parent8281f92eb9557d7bafa047409ed66b85fadbee31 (diff)
downloadmorph-cache-server-395b6b1c34a12874d3be4c2b9e9f6ca9aa70db83.tar.gz
Add nicer headings to 'artifacts' table
-rw-r--r--morphcacheserver/frontend.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/morphcacheserver/frontend.py b/morphcacheserver/frontend.py
index 03d037b..0376aa0 100644
--- a/morphcacheserver/frontend.py
+++ b/morphcacheserver/frontend.py
@@ -16,26 +16,27 @@
from bottle import Bottle, template
-def make_table(data, headings):
+def make_table(data, heading_ids, heading_titles):
'''Render 'data' as a HTML table.'''
table_template = """
<table border="1">
<tr>
- %for header in headings:
- <td>{{header}}</td>
+ %for title in heading_titles:
+ <td>{{title}}</td>
%end
</tr>
%for row in rows:
<tr>
- %for header in headings:
- <td>{{row[header]}}</td>
+ %for col in heading_ids:
+ <td>{{row[col]}}</td>
%end
</tr>
%end
</table>
"""
- return template(table_template, headings=headings, rows=data)
+ return template(table_template, heading_ids=heading_ids,
+ heading_titles=heading_titles, rows=data)
def web_frontend(db):
@@ -50,7 +51,9 @@ def web_frontend(db):
artifacts = db.view_artifact_statistics()
content += make_table(
- artifacts, ['cache_name', 'n_different_builds', 'n_builds'])
+ artifacts,
+ ['cache_name', 'n_builds', 'n_different_builds'],
+ ['Artifact', 'Total builds', 'Mismatching builds'])
return template('morphcacheserver/templates/base', base=content)