2020-04-21 14:09:21 +00:00
{% extends 'layout.html' %}
2021-02-28 02:48:10 +00:00
{% load i18n %}
2020-04-21 14:09:21 +00:00
{% load humanize %}
2021-06-07 16:13:24 +00:00
{% load static %}
2021-02-28 18:00:36 +00:00
{% block title %}{% trans "Import Status" %}{% endblock %}
2021-03-05 14:41:21 +00:00
{% block content %}{% spaceless %}
2020-09-30 19:11:53 +00:00
< div class = "block" >
2021-02-27 22:22:39 +00:00
< h1 class = "title" > {% trans "Import Status" %}< / h1 >
2021-06-14 18:59:44 +00:00
< a href = "{% url 'import' %}" class = "has-text-weight-normal help subtitle is-link" > {% trans "Back to imports" %}< / a >
2020-04-21 14:09:21 +00:00
2021-06-02 16:17:53 +00:00
< dl >
< div class = "is-flex" >
< dt class = "has-text-weight-medium" > {% trans "Import started:" %}< / dt >
< dd class = "ml-2" > {{ job.created_date | naturaltime }}< / dd >
< / div >
{% if job.complete %}
< div class = "is-flex" >
< dt class = "has-text-weight-medium" > {% trans "Import completed:" %}< / dt >
< dd class = "ml-2" > {{ task.date_done | naturaltime }}< / dd >
< / div >
2021-08-21 18:06:27 +00:00
{% elif task.failed %}
< div class = "notification is-danger" > {% trans "TASK FAILED" %}< / div >
{% endif %}
2021-06-02 16:17:53 +00:00
< / dl >
2020-09-30 19:11:53 +00:00
< / div >
2020-04-22 13:16:46 +00:00
2020-09-30 19:11:53 +00:00
< div class = "block" >
2021-01-07 17:36:41 +00:00
{% if not job.complete %}
2020-09-30 19:11:53 +00:00
< p >
2021-06-02 16:17:53 +00:00
{% trans "Import still in progress." %}
< br / >
2021-02-27 22:22:39 +00:00
{% trans "(Hit reload to update!)" %}
2020-11-12 20:09:47 +00:00
< / 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" >
2021-02-27 22:22:39 +00:00
< h2 class = "title is-4" > {% trans "Failed to load" %}< / h2 >
2020-11-13 17:02:41 +00:00
{% if not job.retry %}
2021-09-08 01:16:26 +00:00
< form name = "retry" action = "/import/{{ job.id }}" method = "post" class = "box" >
2020-11-13 17:02:41 +00:00
{% csrf_token %}
2021-03-05 14:41:21 +00:00
{% with failed_count=failed_items|length %}
2021-03-05 21:09:56 +00:00
{% 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 %}
2021-03-05 14:41:21 +00:00
{% endwith %}
2021-08-09 01:40:47 +00:00
< fieldset id = "failed_imports" >
2021-03-05 14:41:21 +00:00
< ul >
2020-11-13 17:02:41 +00:00
{% for item in failed_items %}
2021-06-02 16:17:53 +00:00
< li class = "mb-2 is-flex is-align-items-start" >
2021-08-09 01:40:47 +00:00
< input class = "checkbox mt-1" type = "checkbox" name = "import_item" value = "{{ item.id }}" id = "import_item_{{ item.id }}" >
2021-06-02 16:17:53 +00:00
< label class = "ml-1" for = "import-item-{{ item.id }}" >
{% blocktrans with index=item.index title=item.data.Title author=item.data.Author %}Line {{ index }}: < strong > {{ title }}< / strong > by {{ author }}{% endblocktrans %}
< br / >
2020-11-13 17:02:41 +00:00
{{ item.fail_reason }}.
2021-06-02 16:17:53 +00:00
< / label >
2020-11-13 17:02:41 +00:00
< / li >
{% endfor %}
2021-03-05 14:41:21 +00:00
< / ul >
< / fieldset >
< fieldset class = "mt-3" >
< a name = "select-all-failed-imports" > < / a >
2021-03-05 21:09:56 +00:00
< label class = "label is-inline" >
2021-03-05 14:41:21 +00:00
< input
id="toggle-all-checkboxes-failed-imports"
class="checkbox"
type="checkbox"
data-action="toggle-all"
2021-09-18 21:48:03 +00:00
data-target="failed_imports"
2021-03-05 14:41:21 +00:00
/>
2021-02-27 22:22:39 +00:00
{% trans "Select all" %}
2020-11-13 18:14:24 +00:00
< / label >
2021-03-05 14:41:21 +00:00
2021-03-05 21:09:56 +00:00
< button class = "button is-block mt-3" type = "submit" > {% trans "Retry items" %}< / button >
2021-03-05 14:41:21 +00:00
< / fieldset >
2021-08-21 18:06:27 +00:00
< / form >
2021-03-05 14:41:21 +00:00
2021-08-21 18:06:27 +00:00
< hr >
2021-03-05 14:41:21 +00:00
2021-08-21 18:06:27 +00:00
{% else %}
< ul >
{% for item in failed_items %}
< li class = "pb-1" >
< p >
Line {{ item.index }}:
< strong > {{ item.data.Title }}< / strong > by
{{ item.data.Author }}
< / p >
< p >
{{ item.fail_reason }}.
< / p >
< / li >
{% endfor %}
< / ul >
{% endif %}
2020-11-12 21:52:57 +00:00
< / div >
{% endif %}
< div class = "block" >
2021-06-14 18:59:44 +00:00
{% if job.complete %}
2021-02-27 22:22:39 +00:00
< h2 class = "title is-4" > {% trans "Successfully imported" %}< / h2 >
2021-06-14 18:59:44 +00:00
{% else %}
< h2 class = "title is-4" > {% trans "Import Progress" %}< / h2 >
{% endif %}
2020-09-30 19:11:53 +00:00
< table class = "table" >
< tr >
< th >
2021-02-27 22:22:39 +00:00
{% trans "Book" %}
2020-09-30 19:11:53 +00:00
< / th >
< th >
2021-02-27 22:22:39 +00:00
{% trans "Title" %}
2020-09-30 19:11:53 +00:00
< / th >
< th >
2021-02-27 22:22:39 +00:00
{% trans "Author" %}
2020-09-30 19:11:53 +00:00
< / th >
< th >
< / th >
< / tr >
{% for item in items %}
< tr >
< td >
{% if item.book %}
2021-05-04 16:34:16 +00:00
< a href = "{{ item.book.local_path }}" >
2021-05-24 14:18:05 +00:00
{% include 'snippets/book_cover.html' with book=item.book cover_class='is-h-s' size='small' %}
2020-09-30 19:11:53 +00:00
< / a >
{% endif %}
< / td >
< td >
2021-05-11 20:28:52 +00:00
{{ item.data.Title }}
2020-09-30 19:11:53 +00:00
< / td >
< td >
2021-05-11 20:28:52 +00:00
{{ item.data.Author }}
2020-09-30 19:11:53 +00:00
< / td >
< td >
2020-11-12 21:52:57 +00:00
{% if item.book %}
< span class = "icon icon-check" >
2021-02-27 22:22:39 +00:00
< 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 >
2021-03-05 14:41:21 +00:00
{% endspaceless %}{% endblock %}
2021-03-19 17:51:45 +00:00
{% block scripts %}
2021-09-10 17:57:16 +00:00
< script src = "{% static " js / check_all . js " % } ? v = {{ js_cache } } " > < / script >
2021-03-19 17:51:45 +00:00
{% endblock %}