diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-15 18:21:19 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-15 18:27:50 +0100 |
commit | 1d8df5e693b67aa1292be8a49000b0274bc14454 (patch) | |
tree | 743690e2ec80c6b908870737ce03c183a26f234c | |
parent | bc3fff6a7b5cc3df2b2d2c90d3fc82f8c71fc923 (diff) | |
download | morph-cache-server-1d8df5e693b67aa1292be8a49000b0274bc14454.tar.gz |
Add the templates I forgot to add before.
-rw-r--r-- | morphcacheserver/frontend.py | 18 | ||||
-rw-r--r-- | morphcacheserver/templates/artifact_info.tpl | 50 | ||||
-rw-r--r-- | morphcacheserver/templates/artifacts.tpl | 26 |
3 files changed, 80 insertions, 14 deletions
diff --git a/morphcacheserver/frontend.py b/morphcacheserver/frontend.py index f55fa92..6ca0763 100644 --- a/morphcacheserver/frontend.py +++ b/morphcacheserver/frontend.py @@ -59,8 +59,6 @@ def web_frontend(db): page = int(request.query.get('page', 1)) page_size = 50 - content = '<p>Artifacts:</p>' - def row_style_class_cb(row): if row['n_different_builds'] > 0: return 'fail' @@ -76,7 +74,7 @@ def web_frontend(db): item['cache_name_with_url'] = '<a href="/artifacts/%s">%s</a>' % ( item['cache_name'], item['cache_name']) - content += make_table( + artifacts_table = make_table( artifacts, ['cache_name_with_url', 'n_builds', 'n_different_builds'], ['Artifact', 'Total builds', 'Mismatching builds'], @@ -85,17 +83,9 @@ def web_frontend(db): n_artifacts = db.count_artifacts() n_pages = int(math.ceil(n_artifacts / float(page_size))) - content += '<div id="footer">' - content += '<p>Page %i of %i: ' % (page, n_pages) - if page > 1: - content += '<a href="?page=%i">prev</a>' % (page-1) - if page < n_pages: - content += ' -- ' - if page < n_pages: - content += '<a href="?page=%i">next</a>' % (page+1) - content += '</p></div>' - - return template('morphcacheserver/templates/base', base=content) + return template('morphcacheserver/templates/artifacts', + artifacts_table=artifacts_table, + page=page, n_pages=n_pages) @app.get('/artifacts/<cache_name>') def artifact_info(cache_name): diff --git a/morphcacheserver/templates/artifact_info.tpl b/morphcacheserver/templates/artifact_info.tpl new file mode 100644 index 0000000..ca0ebb0 --- /dev/null +++ b/morphcacheserver/templates/artifact_info.tpl @@ -0,0 +1,50 @@ +% rebase('morphcacheserver/templates/base.tpl') + +<h1>Artifact Information</h1> + +<h2>{{ cache_name }}</h2> + +<p> +Back to <a href="/artifacts">list of artifacts</a>. +</p> + +<% +# This is a cheeky hack that will break on artifacts not built from a Trove. +import urlparse, logging +logging.info(source_repo) +if source_repo is not None: + source_repo_split = urlparse.urlsplit(source_repo) + source_repo_netloc = source_repo_split.netloc + source_repo_path = source_repo_split.path + source_repo_cgit_url = 'http://%s/cgi-bin/cgit.cgi/%s' % ( + source_repo_netloc, source_repo_path) + + source_repo_with_url = '<a href="%s">%s</a>' % ( + source_repo_cgit_url, source_repo) + + if source_ref is not None: + source_ref_cgit_url = '%s/commit/?h=%s' % ( + source_repo_cgit_url, source_ref) + source_ref_with_url = '<a href="%s">%s</a>' % ( + source_ref_cgit_url, source_ref) + logging.debug(locals()) +%> + +<p> +Source repo: {{! source_repo_with_url or 'unknown'}} +<br> +Source ref: {{! source_ref_with_url or 'unknown'}} +</p> + +<h3>Builds</h3> + +<p> +This is a list of all builds of the artifact that have been submitted +by users. There is no vetting done of this information so don't rely +on it too much. The intention is to identify which chunks are being built +in a way that is non-deterministic. Submitters only submit the hash of +the artifact, not the actual artifacts. The artifacts stored in the cache +should only be from trusted Mason continous build instances. +</p> + +{{! builds_table }} diff --git a/morphcacheserver/templates/artifacts.tpl b/morphcacheserver/templates/artifacts.tpl new file mode 100644 index 0000000..565a371 --- /dev/null +++ b/morphcacheserver/templates/artifacts.tpl @@ -0,0 +1,26 @@ +% rebase('morphcacheserver/templates/base.tpl') + +<h1>Artifacts</h1> + +<p> +This is a list of all artifacts for which we have had build information +submitted. We do not necessarily have all of these available in the cache. +</p> + +{{! artifacts_table }} + +<div id="footer"> +<p> +Page {{ page }} of {{ n_pages }}: + +<% if page > 1: %> + <a href="?page={{page - 1}}">prev</a>' + <% if page < n_page: %> + -- + <% end %> +<% if page < n_pages: %> + <a href="?page={{ page + 1 }}">next</a>' +<% end %> + +</p> +</div> |