From 2209b209f9dbe7f12a8b5407eb891058d9d2601f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Tue, 8 Aug 2017 22:09:50 +0200 Subject: [PATCH] Implement Admin view for processing merge queue (WIP) This should be integrated into the manual merge flow, and should probably not be a separate page --- .../templates/admin/merge-queue.html | 39 +++++++++++++++++++ mygpo/administration/urls.py | 4 ++ mygpo/administration/views.py | 15 +++++++ 3 files changed, 58 insertions(+) create mode 100644 mygpo/administration/templates/admin/merge-queue.html diff --git a/mygpo/administration/templates/admin/merge-queue.html b/mygpo/administration/templates/admin/merge-queue.html new file mode 100644 index 000000000..6d9158027 --- /dev/null +++ b/mygpo/administration/templates/admin/merge-queue.html @@ -0,0 +1,39 @@ +{% extends "base.html" %} +{% load i18n %} +{% load podcasts %} + +{% load menu %} +{% block mainmenu %}{{ "/admin/"|main_menu }}{% endblock %} +{% block sectionmenu %}{{ "/admin/"|section_menu:"Admin" }}{% endblock %} + +{% block title %}{% trans "Admin Area" %}{% endblock %} + +{% block header %} +

{% trans "Merge Queue" %}

+{% endblock %} + +{% block content %} + Queue Length: {{ queue_length }} + +
+ {% csrf_token %} + {% for entry in queue.mergequeueentry_set.all %} +
+ + +
+ {% endfor %} + +
+ +{% endblock %} + diff --git a/mygpo/administration/urls.py b/mygpo/administration/urls.py index d9fbd58f6..814d885ff 100644 --- a/mygpo/administration/urls.py +++ b/mygpo/administration/urls.py @@ -16,6 +16,10 @@ views.MergeSelect.as_view(), name='admin-merge'), + url(r'^merge/queue$', + views.MergeQueueView.as_view(), + name='admin-merge-queue'), + url(r'^merge/verify$', views.MergeVerify.as_view(), name='admin-merge-verify'), diff --git a/mygpo/administration/views.py b/mygpo/administration/views.py index f436bc206..30f174eee 100644 --- a/mygpo/administration/views.py +++ b/mygpo/administration/views.py @@ -23,6 +23,7 @@ from mygpo.administration.auth import require_staff from mygpo.administration.group import PodcastGrouper from mygpo.maintenance.merge import PodcastMerger, IncorrectMergeException +from mygpo.maintenance.models import MergeQueue from mygpo.administration.clients import UserAgentStats, ClientStats from mygpo.administration.tasks import merge_podcasts from mygpo.utils import get_git_head @@ -396,3 +397,17 @@ class MakePublisherResult(AdminView): def get_email_subject(site, txt): return '[{domain}] {txt}'.format(domain=site.domain, txt=txt) + + +class MergeQueueView(AdminView): + + template_name = 'admin/merge-queue.html' + + def get(self, request): + queue_length = MergeQueue.objects.count() + queue = MergeQueue.objects.first() + + return self.render_to_response({ + 'queue_length': queue_length, + 'queue': queue, + })