summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-03-02 17:26:07 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-03-02 17:26:07 -0800
commit20ad70b437df59d9564704b655afab53237b8ce0 (patch)
tree5b16e7dbb88ad7b81556bdfb978b3b5fba99a98f /python
parent2235e696f96f761cfecacb7894c2cc78fc296da2 (diff)
downloadfatcat-20ad70b437df59d9564704b655afab53237b8ce0.tar.gz
fatcat-20ad70b437df59d9564704b655afab53237b8ce0.zip
include filesets and webcaptures in release view
Diffstat (limited to 'python')
-rw-r--r--python/fatcat_web/routes.py14
-rw-r--r--python/fatcat_web/templates/release_view.html56
2 files changed, 55 insertions, 15 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 5ccfe238..59f7d1db 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -363,8 +363,8 @@ def release_edit_view(ident):
def release_view(ident):
try:
entity = api.get_release(ident, expand="container,files,filesets,webcaptures")
- files = entity.files
container = entity.container
+ filesets = entity.filesets
except ApiException as ae:
abort(ae.status)
if entity.state == "redirect":
@@ -375,17 +375,13 @@ def release_view(ident):
entity.container.es = container_to_elasticsearch(entity.container, force_bool=False)
if entity.state == "active":
entity.es = release_to_elasticsearch(entity, force_bool=False)
+ for fs in filesets:
+ fs.total_size = sum([f.size for f in fs.manifest])
+ entity.filesets = filesets
authors = [c for c in entity.contribs if c.role in ('author', None)]
authors = sorted(authors, key=lambda c: c.index)
- for fe in files:
- # crudely filter out exact duplicates
- kept = []
- for u in fe.urls:
- if not u in kept:
- kept.append(u)
- fe.urls = [u for u in kept if not '/web/None/' in u.url]
return render_template('release_view.html', release=entity,
- authors=authors, files=files, container=container)
+ authors=authors, container=container)
@app.route('/work/create', methods=['GET'])
def work_create_view():
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html
index 684c71ab..0e09e6ab 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -127,7 +127,7 @@
<h3>Known Files and URLs</h3>
-{% if files != [] %}
+{% if entity.files != [] %}
<table class="ui compact fixed table">
<!--
<thead>
@@ -138,7 +138,7 @@
</thead>
-->
<tbody>
- {% for file in files %}
+ {% for file in entity.files %}
<tr><td>{% if file.mimetype != None %}{{ file.mimetype }}&nbsp;&nbsp;{% endif %}
{% if file.size != None %}{{ file.size|filesizeformat }}{% endif %}
<br><small><code><a href="/file/{{ file.ident }}">
@@ -163,10 +163,54 @@
<a href="/work/{{ release.work_id }}">other releases for this work?</a>).
{% endif %}
+
+{% if entity.filesets != [] %}
+<h3>File Sets</h3>
+<table class="ui compact fixed table">
+ <tbody>
+ {% for fileset in entity.filesets %}
+ <tr><td>{{ fileset.manifest|count }} files &nbsp;{{ fileset.total_size|filesizeformat }}
+ <br><small><code><a href="/fileset/{{ fileset.ident }}">fileset:{{ fileset.ident }}</a></code></small>
+ <td class="single line">
+ {% for url in fileset.urls[:5] %}
+ <a href="{{ url.url }}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br>
+ {% endfor %}
+ {% if fileset.urls|length > 5 %}
+ + {{ file.urls|length - 5 }} more URLs
+ {% endif %}
+ {% endfor %}
+ </tbody>
+</table>
+</ul>
+{% endif %}
+
+
+{% if entity.webcaptures != [] %}
+<h3>Web Captures</h3>
+<table class="ui single line compact fixed table">
+ <tbody>
+ {% for webcapture in entity.webcaptures %}
+ <tr><td><b><a href="{{ webcapture.original_url }}">{{ webcapture.original_url }}</a></b>
+ <br>{{ webcapture.timestamp }} | {{ webcapture.cdx|count }} resources
+ <br><small><code><a href="/webcapture/{{ webcapture.ident }}">webcapture:{{ webcapture.ident }}</a></code></small>
+ <td class="single line">
+ {% for url in webcapture.archive_urls[:5] %}
+ <a href="{{ url.url }}">{{ url.url.split('/')[2] }}</a> ({{ url.rel }})<br>
+ {% endfor %}
+ {% if webcapture.urls|length > 5 %}
+ + {{ file.urls|length - 5 }} more URLs
+ {% endif %}
+ {% endfor %}
+ </tbody>
+</table>
+</ul>
+{% endif %}
+
+
{% if release.refs != None and release.refs.size != 0 %}
<h3>References</h3>
-This release citing other releases.
-<ol>
+<i>This release citing other releases</i>
+<ol class="ui list">
{% for ref in release.refs %}
<li>
{% if ref.title %}
@@ -198,8 +242,8 @@ This release citing other releases.
</div>
<div class="five wide column">
-{% if files != [] and files[0].urls != [] %}
-<a href="{{ files[0].urls[0].url }}" class="ui top attached fluid huge green button"><i class="file pdf outline icon"></i>Download Full Text</a>
+{% if entity.files != [] and entity.files[0].urls != [] %}
+<a href="{{ entity.files[0].urls[0].url }}" class="ui top attached fluid huge green button"><i class="file pdf outline icon"></i>Download Full Text</a>
{% else %}
<span class="ui top attached fluid huge grey button"><i class="file cross icon"></i>No Full Text Available</span>
{% endif %}