diff mbox

[Branch,~linaro-validation/lava-dashboard/trunk] Rev 236: This branch adds two new views for looking at data views (list of and

Message ID 20110629165626.29507.92070.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Paul Larson June 29, 2011, 4:56 p.m. UTC
Merge authors:
  Zygmunt Krynicki (zkrynicki)
Related merge proposals:
  https://code.launchpad.net/~zkrynicki/lava-dashboard/data-views-views/+merge/66350
  proposed by: Zygmunt Krynicki (zkrynicki)
  review: Approve - Paul Larson (pwlars)
------------------------------------------------------------
revno: 236 [merge]
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-dashboard
timestamp: Wed 2011-06-29 17:53:11 +0100
message:
  This branch adds two new views for looking at data views (list of and
  details)
added:
  dashboard_app/templates/dashboard_app/data_view_detail.html
  dashboard_app/templates/dashboard_app/data_view_list.html
modified:
  dashboard_app/templates/dashboard_app/base.html
  dashboard_app/urls.py
  dashboard_app/views.py


--
lp:lava-dashboard
https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk

You are subscribed to branch lp:lava-dashboard.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'dashboard_app/templates/dashboard_app/base.html'
--- dashboard_app/templates/dashboard_app/base.html	2011-06-29 14:00:01 +0000
+++ dashboard_app/templates/dashboard_app/base.html	2011-06-29 16:41:01 +0000
@@ -5,6 +5,7 @@ 
 {% block extension_navigation %}
 <ul>
   <li><a href="{% url dashboard_app.views.bundle_stream_list %}">{% trans "Bundle Streams" %}</a></li>
+  <li><a href="{% url dashboard_app.views.data_view_list %}">{% trans "Data Views" %}</a></li>
   <li><a href="{% url dashboard_app.views.report_list %}">{% trans "Reports" %}</a></li>
   <li><a href="{% url dashboard_app.views.dashboard_xml_rpc_handler %}">{% trans "XML-RPC (dashboard only)" %}</a></li>
 </ul>

=== added file 'dashboard_app/templates/dashboard_app/data_view_detail.html'
--- dashboard_app/templates/dashboard_app/data_view_detail.html	1970-01-01 00:00:00 +0000
+++ dashboard_app/templates/dashboard_app/data_view_detail.html	2011-06-29 16:41:01 +0000
@@ -0,0 +1,41 @@ 
+{% extends "dashboard_app/base.html" %}
+{% load i18n %}
+
+{% block title %}
+{{ block.super }} | {% trans "Data Views" %} | {{ data_view.name }}
+{% endblock %}
+
+
+{% block breadcrumbs %}
+<li><a href="{% url dashboard_app.views.data_view_list %}">{% trans "Data Views" %}</a></li>
+<li><a href="{% url dashboard_app.views.data_view_detail data_view.name %}">{{ data_view.name }}</a></li>
+{% endblock %}
+
+
+{% block content %}
+<dl>
+  <dt>Name:</dt>
+  <dd>{{ data_view.name }}</dd>
+  <dt>Summary:</dt>
+  <dd>{{ data_view.summary }}</dd>
+  <dt>Documentation:</dt>
+  <dd>{{ data_view.documentation }}</dd>
+</dl>
+<table class="data">
+  <caption>Aruments</caption>
+  <tr>
+    <th>name</th>
+    <th>type</th>
+    <th>default</th>
+    <th>help</th>
+  </tr>
+  {% for argument in data_view.arguments %}
+  <tr>
+    <td>{{ argument.name }}</td>
+    <td>{{ argument.type }}</td>
+    <td>{{ argument.default|default_if_none:"<i>No default available</i>"  }}</td>
+    <td>{{ argument.help }}</td>
+  </tr>
+  {% endfor %}
+</table>
+{% endblock %}

=== added file 'dashboard_app/templates/dashboard_app/data_view_list.html'
--- dashboard_app/templates/dashboard_app/data_view_list.html	1970-01-01 00:00:00 +0000
+++ dashboard_app/templates/dashboard_app/data_view_list.html	2011-06-29 16:41:01 +0000
@@ -0,0 +1,34 @@ 
+{% extends "dashboard_app/base.html" %}
+{% load i18n %}
+
+{% block title %}
+{{ block.super }} | {% trans "Data Views" %}
+{% endblock %}
+
+
+{% block breadcrumbs %}
+<li><a href="{% url dashboard_app.views.data_view_list %}">{% trans "Data Views" %}</a></li>
+{% endblock %}
+
+
+{% block sidebar %}
+<h3>Hint:</h3>
+<p>To call a data view use the <code>lava-dashboard-tool</code> command. See
+<code>lava-dashboard-tool query-data-view --help</code> to get started.</p>
+{% endblock %}
+
+
+{% block content %}
+<table class="data">
+  <tr>
+    <th>{% trans "Name" %}</th>
+    <th>{% trans "Summary" %}</th>
+  </tr>
+  {% for data_view in data_view_list %}
+  <tr>
+    <td><a href="{% url dashboard_app.views.data_view_detail data_view.name %}">{{ data_view.name }}</a></td>
+    <td>{{ data_view.summary }}</td>
+  </tr>
+{% endfor %}
+</table>
+{% endblock %}

=== modified file 'dashboard_app/urls.py'
--- dashboard_app/urls.py	2011-06-29 07:18:00 +0000
+++ dashboard_app/urls.py	2011-06-29 16:41:01 +0000
@@ -33,6 +33,8 @@ 
     url(r'^streams(?P<pathname>/[a-zA-Z0-9/_-]+?)\+bundles$', 'bundle_list'),
     url(r'^attachments/(?P<pk>[0-9]+)/$', 'attachment_detail'),
     url(r'^xml-rpc/', 'dashboard_xml_rpc_handler'),
+    url(r'^data-views/$', 'data_view_list'),
+    url(r'^data-views/(?P<name>[a-zA-Z0-9-_]+)/$', 'data_view_detail'),
     url(r'^reports/$', 'report_list'),
     url(r'^reports/(?P<name>[a-zA-Z0-9-_]+)/$', 'report_detail'),
 )

=== modified file 'dashboard_app/views.py'
--- dashboard_app/views.py	2011-05-30 17:43:28 +0000
+++ dashboard_app/views.py	2011-06-29 16:41:01 +0000
@@ -29,8 +29,9 @@ 
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 
+from dashboard_app.dataview import DataView, DataViewRepository
 from dashboard_app.dispatcher import DjangoXMLRPCDispatcher
-from dashboard_app.models import (Attachment, BundleStream, TestRun, TestResult, DataReport)
+from dashboard_app.models import Attachment, BundleStream, TestRun, TestResult, DataReport
 from dashboard_app.xmlrpc import DashboardAPI
 
 
@@ -255,3 +256,23 @@ 
         "dashboard_app/report_detail.html", {
             "report": report,
         }, RequestContext(request))
+
+
+def data_view_list(request):
+    repo = DataViewRepository.get_instance()
+    return render_to_response(
+        "dashboard_app/data_view_list.html", {
+            "data_view_list": repo.data_views
+        }, RequestContext(request))
+
+
+def data_view_detail(request, name):
+    repo = DataViewRepository.get_instance()
+    try:
+        data_view = repo[name]
+    except KeyError:
+        raise Http404('No data view matches the given query.') 
+    return render_to_response(
+        "dashboard_app/data_view_detail.html", {
+            "data_view": data_view 
+        }, RequestContext(request))