added filtering by entry state in processing panel
authorBoris Bobrov <breton@cynicmansion.ru>
Sat, 16 Aug 2014 14:41:37 +0000 (17:41 +0300)
committerBoris Bobrov <breton@cynicmansion.ru>
Sun, 31 Jan 2016 23:29:44 +0000 (00:29 +0100)
mediagoblin/plugins/processing_info/templates/mediagoblin/processing_info/header_left.html
mediagoblin/templates/mediagoblin/user_pages/processing_panel.html
mediagoblin/user_pages/routing.py
mediagoblin/user_pages/views.py

index d635afce75785a073a959892b04581ee0b734118..1d5e724d1372e46fd45f1a0d3bf5a4ab244afde7 100644 (file)
 {#This injects some information about entries in processing #}
 {% if request.user and request.user.has_privilege('active') %}
 {% if num_queued is defined and num_queued != 0 %}
-{% set panel_url = request.urlgen('mediagoblin.user_pages.processing_panel',
-                                  user=request.user.username) %}
 <span class="num_queued status_icon">
-    <a href="{{ panel_url }}">&#9203; {{ num_queued }}</a>
+  <a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                              user=request.user.username, state="processing") }}">&#9203; {{ num_queued }}</a>
 </span>
 {% endif %}
 {% if num_failed is defined and num_failed != 0 %}
 <span class="num_failed status_icon">
-    <a href="{{ panel_url }}">&#9785; {{ num_failed }}</a>
+    <a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                                  user=request.user.username, state="failed") }}">&#9785; {{ num_failed }}</a>
 </span>
 {% endif %}
 {% endif %}
index d803e51c084507ca9b072b1d5b4f48c5d35bc921..88eef82751deff705325fbc7e8af0ebaec3c6d1f 100644 (file)
 <p>
   {% trans %}You can track the state of media being processed for your gallery here.{% endtrans %}
 </p>
+
+<p>
+Show:
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username) }}">All</a>,
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username, state="processing") }}">In processing</a>,
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username, state="failed") }}">Failed</a>,
+<a href="{{ request.urlgen('mediagoblin.user_pages.processing_panel',
+                           user=request.user.username, state="processed") }}">Succesful</a>
+</p>
     
 {% if entries.count() %}
   <table class="media_panel processing">
index 1a1d41399e93a51e8006247b7e65b5cb29894fb6..68cb0a3bd892cf4b5a9c52731f42131e5360904d 100644 (file)
@@ -97,6 +97,11 @@ add_route('mediagoblin.user_pages.processing_panel',
           '/u/<string:user>/panel/',
           'mediagoblin.user_pages.views:processing_panel')
 
+add_route('mediagoblin.user_pages.processing_panel',
+          '/u/<string:user>/panel/<any(processed, processing, failed):state>/',
+          'mediagoblin.user_pages.views:processing_panel')
+
+
 # Stray edit routes
 add_route('mediagoblin.edit.edit_media',
           '/u/<string:user>/m/<int:media_id>/edit/',
index 0de634400645e17a194e9c80b42bc4bbe548004a..97f0bac198f22fa3c4e8567fc1fbf331b0be2f3a 100644 (file)
@@ -653,11 +653,18 @@ def processing_panel(request):
         return redirect(
             request, 'mediagoblin.user_pages.user_home',
             user=user.username)
-
     # Get media entries which are in-processing
     entries = (MediaEntry.query.filter_by(uploader=user.id)
             .order_by(MediaEntry.created.desc()))
 
+    try:
+        state = request.matchdict['state']
+        # no exception was thrown, filter entries by state
+        entries = entries.filter_by(state=state)
+    except KeyError:
+        # show all entries
+        pass
+
     # Render to response
     return render_to_response(
         request,