From e4d2801acec50b763c104fc87df69f943f54fa7c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 22 Feb 2019 17:27:03 -0800 Subject: bunch of entity view updates --- python/fatcat_web/routes.py | 9 +- python/fatcat_web/templates/container_view.html | 20 ++- python/fatcat_web/templates/file_view.html | 70 +++++--- python/fatcat_web/templates/release_view.html | 215 ++++++++++++++---------- python/fatcat_web/templates/stats.html | 24 +-- python/fatcat_web/templates/work_view.html | 55 +++--- 6 files changed, 237 insertions(+), 156 deletions(-) diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index acc4b3e2..1eeab279 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -207,8 +207,15 @@ def file_view(ident): abort(ae.status) if entity.state == "redirect": return redirect('/file/{}'.format(entity.redirect)) - if entity.state == "deleted": + elif entity.state == "deleted": return render_template('deleted_entity.html', entity=entity) + else: + try: + entity.releases = [] + for r in entity.release_ids: + entity.releases.append(api.get_release(r)) + except ApiException as ae: + abort(ae.status) return render_template('file_view.html', file=entity) @app.route('/release/lookup', methods=['GET']) diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index 1d237023..c19d8c1c 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -39,7 +39,7 @@ {% for (key, value) in container.extra.items() %} - + @@ -83,14 +83,16 @@ Raw Object: {% if container_stats %} Release Counts
-{{ container_stats.total }} total -
{{ container_stats.is_preserved }} -({{ "%.1f"|format(container_stats.is_preserved/container_stats.total*100) }}%) -preserved or archived -
{{ container_stats.in_web }} -({{ "%.1f"|format(container_stats.in_web/container_stats.total*100) }}%) -fulltext available to read -
+ {{ "{:,}".format(container_stats.total) }} total + {% if container_stats.total >= 1 %} +
{{ "{:,}".format(container_stats.is_preserved) }} + ({{ "{:.1f}".format(container_stats.is_preserved/container_stats.total*100) }}%) + preserved or archived +
{{ "{:,}".format(container_stats.in_web) }} + ({{ "{:.1f}".format(container_stats.in_web/container_stats.total*100) }}%) + fulltext available to read + {% endif %} +
{% endif %} {% if (container.es and container.es != None) %} diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index ccfb3ad2..532e29fb 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -13,53 +13,75 @@
-{% if file.extra != None %} +{% if file.extra %}

Extra Metadata (raw JSON)

+
{{ key }}
{{ key }} {{ value }} {% endfor %}
+ {% for (key, value) in file.extra.items() %} -{{ key }}: {{ value }}
+ + +
{{ key }}{{ value }} {% endfor %} +
{% endif %}

Releases

-{% if file.release_ids != None %} -

Releases associated with this file: -