Change file download view.

This commit is contained in:
Patrick Jentsch 2019-09-04 14:53:23 +02:00
parent bb26cba009
commit 64475afc41
2 changed files with 30 additions and 24 deletions

View File

@ -110,8 +110,9 @@ def job(job_id):
files[file]['results'] = {}
results_dir = os.path.join(dir, 'output', file)
for result in os.listdir(results_dir):
files[file]['results'][result] = {}
files[file]['results'][result]['path'] = os.path.join(
result_type = result.rsplit(".", 1)[1]
files[file]['results'][result_type] = {}
files[file]['results'][result_type]['path'] = os.path.join(
'output', files[file]['path'], result
)

View File

@ -161,28 +161,33 @@
</div>
</div>
<span class="card-title">Input files</span>
<p>
{% for file in files %}
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['path']) }}" class="waves-effect waves-light btn-small">
<i class="material-icons left">file_download</i>{{ file }}
</a>
{% endfor %}
</p>
{% if job.status == 'complete' %}
<p>&nbsp;</p>
<span class="card-title">Results</span>
<p>
{% for file in files %}
{% for result in files[file]['results'] %}
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['results'][result]['path']) }}" class="waves-effect waves-light btn-small">
<i class="material-icons left">file_download</i>{{ result }}
</a>
{% endfor %}
{% endfor %}
</p>
{% endif %}
<table>
<thead>
<tr>
<th>Inputs</th>
<th>Results</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<td>
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['path']) }}" class="waves-effect waves-light btn-small">{{ file }}</a>
</td>
<td>
{% if job.status == 'complete' %}
{% for result in files[file]['results'] %}
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['results'][result]['path']) }}" class="waves-effect waves-light btn-small">{{ result }}</a>
{% endfor %}
{% else %}
None
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>