2020-04-21 14:09:21 +00:00
|
|
|
{% extends 'layout.html' %}
|
2020-12-13 02:25:04 +00:00
|
|
|
{% load bookwyrm_tags %}
|
2020-04-21 14:09:21 +00:00
|
|
|
{% load humanize %}
|
|
|
|
{% block content %}
|
2020-09-30 19:11:53 +00:00
|
|
|
<div class="block">
|
|
|
|
<h1 class="title">Import Status</h1>
|
2020-04-21 14:09:21 +00:00
|
|
|
|
2020-09-30 19:11:53 +00:00
|
|
|
<p>
|
2020-11-12 20:09:47 +00:00
|
|
|
Import started: {{ job.created_date | naturaltime }}
|
|
|
|
</p>
|
2020-11-12 21:09:29 +00:00
|
|
|
{% if task.successful %}
|
2020-09-30 19:11:53 +00:00
|
|
|
<p>
|
2020-11-12 20:09:47 +00:00
|
|
|
Import completed: {{ task.date_done | naturaltime }}
|
|
|
|
</p>
|
|
|
|
{% elif task.failed %}
|
|
|
|
<div class="notification is-danger">TASK FAILED</div>
|
2020-09-30 19:11:53 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-04-22 13:16:46 +00:00
|
|
|
|
2020-09-30 19:11:53 +00:00
|
|
|
<div class="block">
|
2020-11-12 22:11:39 +00:00
|
|
|
{% if not task.ready %}
|
2020-09-30 19:11:53 +00:00
|
|
|
Import still in progress.
|
|
|
|
<p>
|
2020-11-12 20:09:47 +00:00
|
|
|
(Hit reload to update!)
|
|
|
|
</p>
|
2020-09-30 19:11:53 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-04-21 14:09:21 +00:00
|
|
|
|
2020-11-12 21:52:57 +00:00
|
|
|
{% if failed_items %}
|
2020-09-30 19:11:53 +00:00
|
|
|
<div class="block">
|
2020-11-12 21:52:57 +00:00
|
|
|
<h2 class="title is-4">Failed to load</h2>
|
2020-11-13 17:02:41 +00:00
|
|
|
{% if not job.retry %}
|
|
|
|
<form name="retry" action="/retry-import/" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="import_job" value="{{ job.id }}">
|
|
|
|
<ul>
|
|
|
|
<fieldset>
|
|
|
|
{% 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 %}
|
|
|
|
</fieldset>
|
|
|
|
</ul>
|
2020-11-13 18:14:24 +00:00
|
|
|
<div class="block pt-1" onclick="selectAll(this)">
|
|
|
|
<label class="label">
|
|
|
|
<input type="checkbox" class="checkbox">
|
|
|
|
Select all
|
|
|
|
</label>
|
|
|
|
</div>
|
2020-11-13 17:02:41 +00:00
|
|
|
<button class="button" type="submit">Retry items</button>
|
|
|
|
{% 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">Successfully imported</h2>
|
2020-09-30 19:11:53 +00:00
|
|
|
<table class="table">
|
|
|
|
<tr>
|
|
|
|
<th>
|
|
|
|
Book
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
Title
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
Author
|
|
|
|
</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">Imported</span>
|
|
|
|
</span>
|
2020-09-30 19:11:53 +00:00
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
</div>
|
2020-04-21 14:09:21 +00:00
|
|
|
</div>
|
|
|
|
{% endblock %}
|