2022-11-02 01:59:04 +00:00
{% extends 'settings/layout.html' %}
{% load i18n %}
{% load utilities %}
2022-11-03 18:30:43 +00:00
{% load humanize %}
2022-11-02 01:59:04 +00:00
{% block title %}{% trans "Imports" %}{% endblock %}
{% block header %}
{% trans "Imports" %}
{% endblock %}
{% block panel %}
2022-11-17 22:22:45 +00:00
< div class = "block" >
{% if site.imports_enabled %}
< details class = "details-panel box" >
< summary >
< span role = "heading" aria-level = "2" class = "title is-6" >
{% trans "Disable starting new imports" %}
< / span >
< span class = "details-close icon icon-x" aria-hidden = "true" > < / span >
< / summary >
< form
name="disable-imports"
id="disable-imports"
method="POST"
action="{% url 'settings-imports-disable' %}"
>
< div class = "notification" >
{% trans "This is only intended to be used when things have gone very wrong with imports and you need to pause the feature while addressing issues." %}
2023-03-29 17:04:23 +00:00
{% trans "While imports are disabled, users will not be allowed to start new imports, but existing imports will not be affected." %}
2023-10-22 04:07:49 +00:00
{% trans "This setting prevents both book imports and user imports." %}
2022-11-17 22:22:45 +00:00
< / div >
{% csrf_token %}
< div class = "control" >
< button type = "submit" class = "button is-danger" >
{% trans "Disable imports" %}
< / button >
< / div >
< / form >
< / details >
{% else %}
< form
name="enable-imports"
id="enable-imports"
method="POST"
action="{% url 'settings-imports-enable' %}"
class="box"
>
< div class = "notification is-danger is-light" >
{% trans "Users are currently unable to start new imports" %}
< / div >
{% csrf_token %}
< div class = "control" >
< button type = "submit" class = "button is-success" >
{% trans "Enable imports" %}
< / button >
< / div >
< / form >
{% endif %}
2022-12-06 22:11:03 +00:00
< details class = "details-panel box" >
< summary >
< span role = "heading" aria-level = "2" class = "title is-6" >
{% trans "Limit the amount of imports" %}
< / span >
< span class = "details-close icon icon-x" aria-hidden = "true" > < / span >
< / summary >
< form
name="imports-set-limit"
id="imports-set-limit"
method="POST"
action="{% url 'settings-imports-set-limit' %}"
>
< div class = "notification" >
{% trans "Some users might try to import a large number of books, which you want to limit." %}
{% trans "Set the value to 0 to not enforce any limit." %}
< / div >
< div class = "align.to-t" >
2023-01-11 14:18:50 +00:00
< label for = "limit" > {% trans "Set import limit to" %}< / label >
2023-01-05 22:37:43 +00:00
< input name = "limit" class = "input is-w-xs is-h-em" type = "text" placeholder = "0" value = "{{ import_size_limit }}" >
2023-01-11 14:18:50 +00:00
< label for = "reset" > {% trans "books every" %}< / label >
2023-01-05 22:37:43 +00:00
< input name = "reset" class = "input is-w-xs is-h-em" type = "text" placeholder = "0" value = "{{ import_limit_reset }}" >
2023-01-11 14:18:50 +00:00
< label > {% trans "days." %}< / label >
2022-12-06 22:11:03 +00:00
{% csrf_token %}
< div class = "control" >
< button type = "submit" class = "button is-warning" >
{% trans "Set limit" %}
< / button >
< / div >
< / div >
< / form >
< / details >
2023-10-22 04:07:49 +00:00
< details class = "details-panel box" >
< summary >
< span role = "heading" aria-level = "2" class = "title is-6" >
{% trans "Limit how often users can import and export" %}
< / span >
< span class = "details-close icon icon-x" aria-hidden = "true" > < / span >
< / summary >
< form
name="user-imports-set-limit"
id="user-imports-set-limit"
method="POST"
action="{% url 'settings-user-imports-set-limit' %}"
>
< div class = "notification" >
{% trans "Some users might try to run user imports or exports very frequently, which you want to limit." %}
{% trans "Set the value to 0 to not enforce any limit." %}
< / div >
< div class = "align.to-t" >
< label for = "limit" > {% trans "Restrict user imports and exports to once every " %}< / label >
< input name = "limit" class = "input is-w-xs is-h-em" type = "text" placeholder = "0" value = "{{ user_import_time_limit }}" >
< label > {% trans "hours" %}< / label >
{% csrf_token %}
< div class = "control" >
< button type = "submit" class = "button is-warning" >
{% trans "Change limit" %}
< / button >
< / div >
< / div >
< / form >
< / details >
2022-11-17 22:22:45 +00:00
< / div >
2022-11-02 01:59:04 +00:00
< div class = "block" >
2023-10-22 04:07:49 +00:00
< h4 class = "title is-4" > {% trans "Book Imports" %}< / h4 >
< div class = "block" >
< div class = "tabs" >
< ul >
{% url 'settings-imports' as url %}
< li { % if request . path in url % } class = "is-active" aria-current = "page" { % endif % } >
< a href = "{{ url }}" > {% trans "Active" %}< / a >
< / li >
{% url 'settings-imports' status="complete" as url %}
< li { % if url in request . path % } class = "is-active" aria-current = "page" { % endif % } >
< a href = "{{ url }}" > {% trans "Completed" %}< / a >
< / li >
< / ul >
< / div >
2022-11-02 01:59:04 +00:00
< / div >
2023-10-22 04:07:49 +00:00
< div class = "table-container block content" >
< table class = "table is-striped is-fullwidth" >
< tr >
2023-10-22 05:52:29 +00:00
{% url 'settings-imports' status as url %}
2023-10-22 04:07:49 +00:00
< th >
{% trans "ID" %}
< / th >
< th >
{% trans "User" as text %}
{% include 'snippets/table-sort-header.html' with field="user" sort=sort text=text %}
< / th >
< th >
{% trans "Date Created" as text %}
{% include 'snippets/table-sort-header.html' with field="created_date" sort=sort text=text %}
< / th >
{% if status != "active" %}
< th >
{% trans "Date Updated" %}
< / th >
{% endif %}
< th >
{% trans "Items" %}
< / th >
< th >
{% trans "Pending items" %}
< / th >
< th >
{% trans "Successful items" %}
< / th >
< th >
{% trans "Failed items" %}
< / th >
{% if status == "active" %}
< th > {% trans "Actions" %}< / th >
{% endif %}
< / tr >
{% for import in imports %}
< tr >
< td > {{ import.id }}< / td >
< td class = "overflow-wrap-anywhere" >
< a href = "{% url 'settings-user' import.user.id %}" > {{ import.user|username }}< / a >
< / td >
< td > {{ import.created_date }}< / td >
{% if status != "active" %}
< td > {{ import.updated_date }}< / td >
{% endif %}
< td > {{ import.item_count|intcomma }}< / td >
< td > {{ import.pending_item_count|intcomma }}< / td >
< td > {{ import.successful_item_count|intcomma }}< / td >
< td > {{ import.failed_item_count|intcomma }}< / td >
{% if status == "active" %}
< td >
{% join "complete" import.id as modal_id %}
< button type = "button" data-modal-open = "{{ modal_id }}" class = "button is-danger" > {% trans "Stop import" %}< / button >
{% include "settings/imports/complete_import_modal.html" with id=modal_id %}
< / td >
{% endif %}
< / tr >
{% endfor %}
{% if not imports %}
< tr >
< td colspan = "6" >
< em > {% trans "No matching imports found." %} < / em >
< / td >
< / tr >
2022-11-02 02:26:23 +00:00
{% endif %}
2023-10-22 04:07:49 +00:00
< / table >
< / div >
{% include 'snippets/pagination.html' with page=imports path=request.path %}
2022-11-02 01:59:04 +00:00
< / div >
2023-10-22 04:07:49 +00:00
< div class = "block" >
< h4 class = "title is-4" > {% trans "User Imports" %}< / h4 >
< div class = "block" >
< div class = "tabs" >
< ul >
{% url 'settings-imports' as url %}
< li { % if request . path in url % } class = "is-active" aria-current = "page" { % endif % } >
< a href = "{{ url }}" > {% trans "Active" %}< / a >
< / li >
{% url 'settings-imports' status="complete" as url %}
< li { % if url in request . path % } class = "is-active" aria-current = "page" { % endif % } >
< a href = "{{ url }}" > {% trans "Completed" %}< / a >
< / li >
< / ul >
< / div >
< / div >
< div class = "table-container block content" >
< table class = "table is-striped is-fullwidth" >
< tr >
2023-10-22 05:52:29 +00:00
{% url 'settings-imports' status as url %}
2023-10-22 04:07:49 +00:00
< th >
{% trans "ID" %}
< / th >
< th >
{% trans "User" as text %}
{% include 'snippets/table-sort-header.html' with field="user" sort=sort text=text %}
< / th >
< th >
{% trans "Date Created" as text %}
{% include 'snippets/table-sort-header.html' with field="created_date" sort=sort text=text %}
< / th >
{% if status != "active" %}
< th >
{% trans "Date Updated" %}
< / th >
{% endif %}
2022-11-02 01:59:04 +00:00
2023-10-22 04:07:49 +00:00
{% if status == "active" %}
< th > {% trans "Actions" %}< / th >
{% else %}
< th > {% trans "Status" %}< / th >
{% endif %}
< / tr >
{% for import in user_imports %}
< tr >
< td > {{ import.id }}< / td >
< td class = "overflow-wrap-anywhere" >
< a href = "{% url 'settings-user' import.user.id %}" > {{ import.user|username }}< / a >
< / td >
< td > {{ import.created_date }}< / td >
{% if status != "active" %}
< td > {{ import.updated_date }}< / td >
{% endif %}
{% if status == "active" %}
< td >
{% join "complete" import.id as modal_id %}
< button type = "button" data-modal-open = "{{ modal_id }}" class = "button is-danger" > {% trans "Stop import" %}< / button >
{% include "settings/imports/complete_user_import_modal.html" with id=modal_id %}
< / td >
{% else %}
< td >
< span
2023-10-22 06:26:27 +00:00
{% if import.status == "stopped" or import.status == "failed" %}
class="tag is-danger"
{% elif import.status == "pending" %}
class="tag is-warning"
{% elif import.complete %}
class="tag"
{% else %}
class="tag is-success"
{% endif %}
>{{ import.status }}
< / span >
2023-10-22 04:07:49 +00:00
< / td >
{% endif %}
< / tr >
{% endfor %}
{% if not user_imports %}
< tr >
< td colspan = "6" >
< em > {% trans "No matching imports found." %} < / em >
< / td >
< / tr >
{% endif %}
< / table >
< / div >
{% include 'snippets/pagination.html' with page=user_imports path=request.path %}
< / div >
2023-10-22 05:52:29 +00:00
{% endblock %}