add timeline view and template

This commit is contained in:
Tim Buckley 2015-07-16 11:21:53 -06:00
parent 357ab6aeea
commit a7ddfa3132
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,12 @@
{% extends 'template.html' %}
{% block title %}Tempest: Execution Timeline (run #{{run_id}}){% endblock %}
{% block body %}
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Tempest: Execution Timeline (run #{{run_id}})</h1>
</div>
<!-- /.col-lg-12 -->
</div>
{% endblock %}

View File

@ -0,0 +1,27 @@
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView, RedirectView
from django.http import Http404
from stackviz.parser.tempest_subunit import get_repositories
class TimelineView(TemplateView):
template_name = 'tempest/timeline.html'
def get_context_data(self, **kwargs):
context = super(TimelineView, self).get_context_data(**kwargs)
context['run_id'] = self.kwargs['run_id']
return context
class TimelineLatestView(RedirectView):
def get_redirect_url(self, run_id):
repos = get_repositories()
if not repos:
raise Http404("No testr repositories could be loaded")
return reverse('tempest_timeline', kwargs={
'run_id': repos[0].get_latest_run().get_id()
})