Skip to content

Commit

Permalink
Implement Admin view for processing merge queue (WIP)
Browse files Browse the repository at this point in the history
This should be integrated into the manual merge flow, and should probably not
be a separate page
  • Loading branch information
stefankoegl committed Aug 8, 2017
1 parent be2199d commit 2209b20
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
39 changes: 39 additions & 0 deletions mygpo/administration/templates/admin/merge-queue.html
Original file line number Diff line number Diff line change
@@ -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 %}
<h1>{% trans "Merge Queue" %}</h1>
{% endblock %}

{% block content %}
Queue Length: {{ queue_length }}

<form method="post" action="{% url "admin-merge-verify" %}" role="form">
{% csrf_token %}
{% for entry in queue.mergequeueentry_set.all %}
<div class="form-group">
<label for="feed{{forloop.counter0}}">
{{ forloop.counter }}: {{ entry.podcast }}
</label>
<input
type="text"
class="form-control"
name="feed{{ forloop.counter0 }}"
id="feed{{ forloop.counter0 }}"
placeholder=""
value="{{ entry.podcast.url }}"
{% if forloop.first %}autofocus="autofocus"{% endif %}>
</div>
{% endfor %}
<input class="btn btn-default" type="submit" value="OK" />
</form>

{% endblock %}

4 changes: 4 additions & 0 deletions mygpo/administration/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
15 changes: 15 additions & 0 deletions mygpo/administration/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
})

0 comments on commit 2209b20

Please sign in to comment.