bookwyrm/bookwyrm/templates/preferences/export-user.html
Hugh Rundle 781b01a007
add error handling and status for user exports
* fix Safari not downloading with the correct filename
* add FAILED status
* don't provide download link for stopped jobs
2023-10-21 19:43:44 +11:00

88 lines
3 KiB
HTML

{% extends 'preferences/layout.html' %}
{% load i18n %}
{% block title %}{% trans "User Export" %}{% endblock %}
{% block header %}
{% trans "User Export" %}
{% endblock %}
{% block panel %}
<div class="block content">
<p class="notification">
{% trans "Your exported archive file will include all user data for import into another Bookwyrm server" %}
</p>
<form name="export" method="POST" href="{% url 'prefs-user-export' %}">
{% csrf_token %}
<button type="submit" class="button">
<span class="icon icon-download" aria-hidden="true"></span>
<span>{% trans "Create user export file" %}</span>
</button>
</form>
</div>
<div class="content block">
<h2 class="title">{% trans "Recent Exports" %}</h2>
<p class="content">
{% trans "User export files will show 'complete' once ready. This may take a little while. Click the link to download your file." %}
</p>
<div class="table-container">
<table class="table is-striped is-fullwidth">
<tr>
<th>
{% trans "Date Created" %}
</th>
<th>
{% trans "Last Updated" %}
</th>
<th>
{% trans "Status" %}
</th>
</tr>
{% if not jobs %}
<tr>
<td colspan="4">
<em>{% trans "No recent imports" %}</em>
</td>
</tr>
{% endif %}
{% for job in jobs %}
<tr>
<td>
{% if job.complete and not job.status == "stopped" and not job.status == "failed" %}
<p><a download="" href="/preferences/user-export/{{ job.task_id }}">{{ job.created_date }}</a></p>
{% else %}
<p>{{ job.created_date }}</p>
{% endif %}
</td>
<td>{{ job.updated_date }}</td>
<td>
<span
{% if job.status == "stopped" or job.status == "failed" %}
class="tag is-danger"
{% elif job.status == "pending" %}
class="tag is-warning"
{% elif job.complete %}
class="tag"
{% else %}
class="tag is-success"
{% endif %}
>
{% if job.status %}
{{ job.status }}
{{ job.status_display }}
{% elif job.complete %}
{% trans "Complete" %}
{% else %}
{% trans "Active" %}
{% endif %}
</span>
</td>
</tr>
{% endfor %}
</table>
</div>
{% include 'snippets/pagination.html' with page=jobs path=request.path %}
</div>
{% endblock %}