from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
+import itertools
from toastergui.tablefilter import TableFilter, TableFilterActionToggle
self.static_context_extra['Task'] = Task
def get_context_data(self, **kwargs):
- return super(BuildsTable, self).get_context_data(**kwargs)
+ context = super(BuildsTable, self).get_context_data(**kwargs)
+
+ # for the latest builds section
+ queryset = Build.objects.all()
+
+ finished_criteria = Q(outcome=Build.SUCCEEDED) | Q(outcome=Build.FAILED)
+
+ latest_builds = itertools.chain(
+ queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"),
+ queryset.filter(finished_criteria).order_by("-completed_on")[:3]
+ )
+
+ context['mru'] = list(latest_builds)
+ context['mrb_type'] = 'all'
+
+ return context
def setup_queryset(self, *args, **kwargs):
queryset = Build.objects.all()
{% block title %} All builds - Toaster {% endblock %}
{% block pagecontent %}
- <div class="page-header top-air">
- <h1 data-role="page-title"></h1>
- </div>
<div class="row-fluid">
- {# TODO need to pass this data to context #}
- {#% include 'mrb_section.html' %#}
+ {% with mru=mru mrb_type=mrb_type %}
+ {% include 'mrb_section.html' %}
+ {% endwith %}
+
+ <h1 class="page-header top-air" data-role="page-title"></h1>
{% url 'builds' as xhr_table_url %}
{% include 'toastertable.html' %}