Use stop functionality in import admin view

This commit is contained in:
Mouse Reeve 2022-11-05 15:44:00 -07:00
parent 76fb4c9280
commit 817047bdeb
3 changed files with 3 additions and 9 deletions

View file

@ -1,7 +1,7 @@
{% extends 'components/modal.html' %}
{% load i18n %}
{% block modal-title %}{% trans "Mark import as complete?" %}{% endblock %}
{% block modal-title %}{% trans "Stop import?" %}{% endblock %}
{% block modal-body %}
{% trans "This action cannot be un-done" %}

View file

@ -27,11 +27,6 @@
</div>
<div class="table-container block content">
{% if status == "active" %}
<div class="notification is-warning">
<p>{% trans "Marking an import as complete will <em>not</em> stop it." %}</p>
</div>
{% endif %}
<table class="table is-striped is-fullwidth">
<tr>
{% url 'settings-imports' as url %}
@ -82,7 +77,7 @@
{% if status == "active" %}
<td>
{% join "complete" import.id as modal_id %}
<button type="button" data-modal-open="{{ modal_id }}" class="button is-danger">{% trans "Mark as complete" %}</button>
<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 %}

View file

@ -40,6 +40,5 @@ class ImportList(View):
def post(self, request, import_id):
"""Mark an import as complete"""
import_job = get_object_or_404(models.ImportJob, id=import_id)
import_job.complete = True
import_job.save()
import_job.stop_job()
return redirect("settings-imports")