diff --git a/bookwyrm/models/import_job.py b/bookwyrm/models/import_job.py index 556f133f9..18aad6d88 100644 --- a/bookwyrm/models/import_job.py +++ b/bookwyrm/models/import_job.py @@ -48,6 +48,16 @@ class ImportJob(models.Model): """items that haven't been processed yet""" return self.items.filter(fail_reason__isnull=True, book__isnull=True) + @property + def item_count(self): + """How many books do you want to import???""" + return self.items.count() + + @property + def pending_item_count(self): + """And how many pending items??""" + return self.pending_items.count() + class ImportItem(models.Model): """a single line of a csv being imported""" diff --git a/bookwyrm/templates/settings/imports/complete_import_modal.html b/bookwyrm/templates/settings/imports/complete_import_modal.html new file mode 100644 index 000000000..64d571764 --- /dev/null +++ b/bookwyrm/templates/settings/imports/complete_import_modal.html @@ -0,0 +1,23 @@ +{% extends 'components/modal.html' %} +{% load i18n %} + +{% block modal-title %}{% trans "Mark import as complete?" %}{% endblock %} + +{% block modal-body %} +{% trans "This action cannot be un-done" %} +{% endblock %} + +{% block modal-footer %} +
+ {% csrf_token %} + +
+ + +
+
+{% endblock %} diff --git a/bookwyrm/templates/settings/imports/imports.html b/bookwyrm/templates/settings/imports/imports.html new file mode 100644 index 000000000..f99e35209 --- /dev/null +++ b/bookwyrm/templates/settings/imports/imports.html @@ -0,0 +1,86 @@ +{% extends 'settings/layout.html' %} +{% load i18n %} +{% load utilities %} + +{% block title %}{% trans "Imports" %}{% endblock %} + +{% block header %} +{% trans "Imports" %} +{% endblock %} + +{% block panel %} + +
+
+ +
+
+ +
+ {% if status == "active" %} +
+

{% trans "Marking an import as complete will not stop it." %}

+
+ {% endif %} + + + {% url 'settings-imports' as url %} + + + + + + {% if status == "active" %} + + {% endif %} + + {% for import in imports %} + + + + + + + {% if status == "active" %} + + {% endif %} + + {% endfor %} + {% if not imports %} + + + + {% endif %} +
+ {% trans "ID" %} + + {% trans "User" %} + + {% trans "Date Created" %} + + {% trans "Items" %} + + {% trans "Pending items" %} + {% trans "Actions" %}
{{ import.id }} + {{ import.user|username }} + {{ import.created_date }}{{ import.item_count }}{{ import.pending_item_count }} + {% join "complete" import.id as modal_id %} + + {% include "settings/imports/complete_import_modal.html" with id=modal_id %} +
+ {% trans "No matching imports founds." %} +
+
+ +{% include 'snippets/pagination.html' with page=users path=request.path %} +{% endblock %} + diff --git a/bookwyrm/templates/settings/layout.html b/bookwyrm/templates/settings/layout.html index ffb21d4a6..f195bf754 100644 --- a/bookwyrm/templates/settings/layout.html +++ b/bookwyrm/templates/settings/layout.html @@ -76,6 +76,12 @@ {% endif %} {% if perms.edit_instance_settings %} +