refactored latest_results to results, updated urls

This commit is contained in:
Austin Clark 2015-07-16 12:23:30 -06:00
parent 7920f221f5
commit 819d2d7f12
9 changed files with 52 additions and 13 deletions

View File

@ -7,7 +7,7 @@
<a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> DevStack<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="/devstack/latest_results"><i class="fa fa-clock-o fa-fw"></i> Latest Results</a>
<a href="/devstack/results"><i class="fa fa-clock-o fa-fw"></i> Results</a>
</li>
<li>
<a href="/devstack/"><i class="fa fa-calendar fa-fw"></i> History</a>
@ -22,10 +22,10 @@
<a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> Tempest<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="/tempest/latest_results"><i class="fa fa-clock-o fa-fw"></i> Latest Results</a>
<a href="/tempest/results"><i class="fa fa-clock-o fa-fw"></i> Results</a>
</li>
<li>
<a href="/tempest/"><i class="fa fa-calendar fa-fw"></i> History</a>
<a href="/tempest/timeline"><i class="fa fa-calendar fa-fw"></i> Timeline</a>
</li>
<li>
<a href="/tempest/"><i class="fa fa-database fa-fw"></i> Compare</a>

View File

@ -1,12 +1,12 @@
{% extends 'template.html' %}
{% block title %}Tempest Latest Results{% endblock %}
{% block title %}Tempest Results{% endblock %}
{% block body %}
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Latest Results</h1>
<h1 class="page-header">Results</h1>
</div>
</div>
@ -107,6 +107,7 @@
}
document.getElementById("result-table-div").appendChild(tbl);
$( "table-test" ).DataTable();
}

View File

@ -30,6 +30,9 @@
<!-- Custom Fonts -->
<link href="{% static 'components/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
<!-- DataTables CSS -->
<link href="{% static 'components/datatables/media/css/jquery.dataTables.min.css' %}" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
@ -90,6 +93,9 @@
<!-- d3.js -->
<script src="{% static 'components/d3/d3.min.js' %}"></script>
<!-- DataTable for jQuery -->
<script src="{% static 'components/datatables/media/js/jquery.dataTables.min.js' %}"></script>
</body>

View File

@ -0,0 +1,4 @@
from django.views.generic import TemplateView
class ResultsView(TemplateView):
template_name = 'devstack/results.html'

View File

@ -1,7 +1,7 @@
from django.conf.urls import patterns, include, url
from django.contrib import admin
from stackviz.views.devstack.latest_results import LatestResultsView
from stackviz.views.devstack.results import ResultsView
urlpatterns = patterns('',
@ -9,5 +9,5 @@ urlpatterns = patterns('',
# url(r'^$', 'stackviz.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^latest_results$', LatestResultsView.as_view()),
url(r'^results$', ResultsView.as_view()),
)

View File

@ -1,4 +0,0 @@
from django.views.generic import TemplateView
class LatestResultsView(TemplateView):
template_name = 'tempest/latest_results.html'

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 ResultsView(TemplateView):
template_name = 'tempest/results.html'
def get_context_data(self, **kwargs):
context = super(ResultsView, self).get_context_data(**kwargs)
context['run_id'] = self.kwargs['run_id']
return context
class LatestResultsView(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_results', kwargs={
'run_id': repos[0].get_latest_run().get_id()
})

View File

@ -1,6 +1,6 @@
from django.conf.urls import patterns, include, url
from .latest_results import LatestResultsView
from .results import ResultsView,LatestResultsView
from .timeline import TimelineView, TimelineLatestView
from .api import (TempestRunTreeEndpoint,
@ -9,7 +9,12 @@ from .api import (TempestRunTreeEndpoint,
urlpatterns = patterns('',
url(r'^latest_results$', LatestResultsView.as_view()),
url(r'^results/(?P<run_id>\d+)/$',
ResultsView.as_view(),
name='tempest_results'),
url(r'^latest_results$',
LatestResultsView.as_view(),
name='tempest_results_latest'),
url(r'^timeline/(?P<run_id>\d+)/$',
TimelineView.as_view(),