moviewyrm/bookwyrm/templates/import_status.html

151 lines
4.4 KiB
HTML
Raw Normal View History

{% extends 'layout.html' %}
2021-02-28 02:48:10 +00:00
{% load i18n %}
2020-12-13 02:25:04 +00:00
{% load bookwyrm_tags %}
{% load humanize %}
{% block title %}{% trans "Import Status" %}{% endblock %}
{% block content %}{% spaceless %}
2020-09-30 19:11:53 +00:00
<div class="block">
<h1 class="title">{% trans "Import Status" %}</h1>
2020-09-30 19:11:53 +00:00
<p>
2021-02-28 16:42:25 +00:00
{% trans "Import started:" %} {{ job.created_date | naturaltime }}
</p>
{% if job.complete %}
2020-09-30 19:11:53 +00:00
<p>
2021-02-28 16:42:25 +00:00
{% trans "Import completed:" %} {{ task.date_done | naturaltime }}
</p>
{% elif task.failed %}
<div class="notification is-danger">{% trans "TASK FAILED" %}</div>
2020-09-30 19:11:53 +00:00
{% endif %}
</div>
2020-09-30 19:11:53 +00:00
<div class="block">
{% if not job.complete %}
{% trans "Import still in progress." %}
2020-09-30 19:11:53 +00:00
<p>
{% trans "(Hit reload to update!)" %}
</p>
2020-09-30 19:11:53 +00:00
{% endif %}
</div>
2020-11-12 21:52:57 +00:00
{% if failed_items %}
2020-09-30 19:11:53 +00:00
<div class="block">
<h2 class="title is-4">{% trans "Failed to load" %}</h2>
2020-11-13 17:02:41 +00:00
{% if not job.retry %}
2021-01-12 19:28:03 +00:00
<form name="retry" action="/import/{{ job.id }}" method="post">
2020-11-13 17:02:41 +00:00
{% csrf_token %}
{% with failed_count=failed_items|length %}
{% if failed_count > 10 %}
<p class="block">
<a href="#select-all-failed-imports">
{% blocktrans %}Jump to the bottom of the list to select the {{ failed_count }} items which failed to import.{% endblocktrans %}
</a>
</p>
{% endif %}
{% endwith %}
<fieldset id="failed-imports">
<ul>
2020-11-13 17:02:41 +00:00
{% for item in failed_items %}
<li class="pb-1">
<input class="checkbox" type="checkbox" name="import_item" value="{{ item.id }}" id="import-item-{{ item.id }}">
<label for="import-item-{{ item.id }}">
Line {{ item.index }}:
<strong>{{ item.data|dict_key:'Title' }}</strong> by
{{ item.data|dict_key:'Author' }}
</label>
<p>
{{ item.fail_reason }}.
</p>
</li>
{% endfor %}
</ul>
</fieldset>
<fieldset class="mt-3">
<a name="select-all-failed-imports"></a>
<label class="label is-inline">
<input
id="toggle-all-checkboxes-failed-imports"
class="checkbox"
type="checkbox"
data-action="toggle-all"
data-target="failed-imports"
/>
{% trans "Select all" %}
2020-11-13 18:14:24 +00:00
</label>
<button class="button is-block mt-3" type="submit">{% trans "Retry items" %}</button>
</fieldset>
<hr>
2020-11-13 17:02:41 +00:00
{% else %}
<ul>
{% for item in failed_items %}
<li class="pb-1">
<p>
Line {{ item.index }}:
<strong>{{ item.data|dict_key:'Title' }}</strong> by
{{ item.data|dict_key:'Author' }}
</p>
<p>
{{ item.fail_reason }}.
</p>
</li>
{% endfor %}
</ul>
{% endif %}
</form>
2020-11-12 21:52:57 +00:00
</div>
{% endif %}
<div class="block">
<h2 class="title is-4">{% trans "Successfully imported" %}</h2>
2020-09-30 19:11:53 +00:00
<table class="table">
<tr>
<th>
{% trans "Book" %}
2020-09-30 19:11:53 +00:00
</th>
<th>
{% trans "Title" %}
2020-09-30 19:11:53 +00:00
</th>
<th>
{% trans "Author" %}
2020-09-30 19:11:53 +00:00
</th>
<th>
</th>
</tr>
{% for item in items %}
<tr>
<td>
{% if item.book %}
<a href="/book/{{ item.book.id }}">
{% include 'snippets/book_cover.html' with book=item.book size='small' %}
</a>
{% endif %}
</td>
<td>
{{ item.data|dict_key:'Title' }}
</td>
<td>
{{ item.data|dict_key:'Author' }}
</td>
<td>
2020-11-12 21:52:57 +00:00
{% if item.book %}
<span class="icon icon-check">
<span class="is-sr-only">{% trans "Imported" %}</span>
2020-11-12 21:52:57 +00:00
</span>
2020-09-30 19:11:53 +00:00
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endspaceless %}{% endblock %}