Merge lp:lava-dashboard/next into lp:lava-dashboard

Proposed by Zygmunt Krynicki
Status: Merged
Merged at revision: 274
Proposed branch: lp:lava-dashboard/next
Merge into: lp:lava-dashboard
Diff against target: 290 lines (+88/-64)
8 files modified
dashboard_app/extension.py (+7/-4)
dashboard_app/models.py (+8/-0)
dashboard_app/repositories/__init__.py (+15/-7)
dashboard_app/repositories/data_report.py (+3/-1)
dashboard_app/static/css/dashboard.css (+6/-0)
dashboard_app/templates/dashboard_app/_extrahead.html (+1/-0)
dashboard_app/templates/dashboard_app/front_page_snippet.html (+12/-28)
dashboard_app/templates/dashboard_app/image_status_detail.html (+36/-24)
To merge this branch: bzr merge lp:lava-dashboard/next
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+79399@code.launchpad.net

Description of the change

Allow placing reports on the front page easily.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I noticed that revision 273 got here by accident. Still it's worth having :)

lp:lava-dashboard/next updated
273. By Paul Larson

Fix setup-dev-env.sh so that it works again

274. By Zygmunt Krynicki

Merge next tree

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dashboard_app/extension.py'
2--- dashboard_app/extension.py 2011-09-30 13:43:50 +0000
3+++ dashboard_app/extension.py 2011-10-14 12:58:30 +0000
4@@ -39,6 +39,12 @@
5 def front_page_template(self):
6 return "dashboard_app/front_page_snippet.html"
7
8+ def get_front_page_context(self):
9+ from dashboard_app.models import DataReport
10+ return {
11+ 'report_list': DataReport.repository.filter(front_page=True)
12+ }
13+
14 @property
15 def description(self):
16 return "Validation Dashboard"
17@@ -56,10 +62,7 @@
18
19 def contribute_to_settings(self, settings_module):
20 super(DashboardExtension, self).contribute_to_settings(settings_module)
21- settings_module['INSTALLED_APPS'].extend([
22- "linaro_django_pagination",
23- "south",
24- ])
25+ settings_module['INSTALLED_APPS'].append("linaro_django_pagination")
26 settings_module['MIDDLEWARE_CLASSES'].append(
27 'linaro_django_pagination.middleware.PaginationMiddleware')
28 root_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))
29
30=== modified file 'dashboard_app/models.py'
31--- dashboard_app/models.py 2011-09-28 02:35:22 +0000
32+++ dashboard_app/models.py 2011-10-14 12:58:30 +0000
33@@ -1276,6 +1276,10 @@
34 def author(self):
35 return self._data.get('author')
36
37+ @property
38+ def front_page(self):
39+ return self._data['front_page']
40+
41
42 class ImageHealth(object):
43
44@@ -1332,6 +1336,10 @@
45 since = until - datetime.timedelta(days=last_n_days)
46 return self.get_test_runs(
47 ).select_related(
48+ 'denormalization',
49+ 'bundle',
50+ 'bundle__bundle_stream',
51+ 'test',
52 ).filter(
53 analyzer_assigned_date__range=(since, until)
54 ).order_by('-analyzer_assigned_date')
55
56=== modified file 'dashboard_app/repositories/__init__.py'
57--- dashboard_app/repositories/__init__.py 2011-07-22 00:04:21 +0000
58+++ dashboard_app/repositories/__init__.py 2011-10-14 12:58:30 +0000
59@@ -16,9 +16,13 @@
60 # You should have received a copy of the GNU Affero General Public License
61 # along with Launch Control. If not, see <http://www.gnu.org/licenses/>.
62
63+
64+from __future__ import with_statement
65+
66 import abc
67 import logging
68 import os
69+import thread
70
71 from django.conf import settings
72
73@@ -126,19 +130,23 @@
74
75 __metaclass__ = abc.ABCMeta
76
77+ loader_lock = thread.allocate_lock()
78+
79 def __init__(self):
80 self.item_cls = None # later patched by RepositoryItemMeta
81 self._items = []
82 self._did_load = False
83
84 def _queryset(self):
85- # In development mode always reload repository items
86- if getattr(settings, "DEBUG", False) is True:
87- self._did_load = False
88- if not self._did_load:
89- self._items = []
90- self._load_default()
91- self._did_load = True
92+ # HOT FIX: use a lock while loading the stuff from disk
93+ with self.loader_lock:
94+ # In development mode always reload repository items
95+ if getattr(settings, "DEBUG", False) is True:
96+ self._did_load = False
97+ if not self._did_load:
98+ self._items = []
99+ self._load_default()
100+ self._did_load = True
101 return RepositoryQuerySet(self.item_cls, self._items)
102
103 def all(self):
104
105=== modified file 'dashboard_app/repositories/data_report.py'
106--- dashboard_app/repositories/data_report.py 2011-07-22 00:07:21 +0000
107+++ dashboard_app/repositories/data_report.py 2011-10-14 12:58:30 +0000
108@@ -47,6 +47,7 @@
109 if "name" not in attrs:
110 raise ValueError("Data report without a name")
111 self.obj.name = attrs["name"]
112+ self.obj.front_page = attrs.get('front_page') == "yes"
113 elif name == "title" or name == "path":
114 self._start_text()
115
116@@ -69,7 +70,8 @@
117 return self.item_cls(
118 name=handler.obj.name,
119 title=handler.obj.title,
120- path=handler.obj.path)
121+ path=handler.obj.path,
122+ front_page=handler.obj.front_page)
123
124
125 __all__ = [
126
127=== added file 'dashboard_app/static/css/dashboard.css'
128--- dashboard_app/static/css/dashboard.css 1970-01-01 00:00:00 +0000
129+++ dashboard_app/static/css/dashboard.css 2011-10-14 12:58:30 +0000
130@@ -0,0 +1,6 @@
131+.lava-chart {
132+ width: 600px;
133+ height: 250px;
134+ margin: 1em auto;
135+ padding: 1em;
136+}
137
138=== modified file 'dashboard_app/templates/dashboard_app/_extrahead.html'
139--- dashboard_app/templates/dashboard_app/_extrahead.html 2011-07-13 11:07:18 +0000
140+++ dashboard_app/templates/dashboard_app/_extrahead.html 2011-10-14 12:58:30 +0000
141@@ -1,3 +1,4 @@
142 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}lava-server/css/demo_table_jui.css"/>
143+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}dashboard_app/css/dashboard.css"/>
144 <script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/FixedHeader.min.js"></script>
145 <script type="text/javascript" src="{{ STATIC_URL }}lava-server/js/jquery.dataTables.min.js"></script>
146
147=== modified file 'dashboard_app/templates/dashboard_app/front_page_snippet.html'
148--- dashboard_app/templates/dashboard_app/front_page_snippet.html 2011-09-19 11:20:07 +0000
149+++ dashboard_app/templates/dashboard_app/front_page_snippet.html 2011-10-14 12:58:30 +0000
150@@ -1,29 +1,13 @@
151-<p>Click on image description to see automatic QA report</p>
152-{% regroup dashboard.interesting_images by rootfs_type as rootfs_list %}
153-{% for rootfs in rootfs_list %}
154-<style type="text/css">
155- .column {
156- float: left;
157- width: 25em;
158- padding: 2pt;
159- }
160- .column h4 {
161- margin: 0;
162- }
163- .column ul {
164- padding: 0;
165- margin: 0 0 0 1em;
166- list-style-position: inside;
167- }
168+<!--[if IE]><script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/excanvas.min.js"></script><![endif]-->
169+<script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/jquery.rpc.js"></script>
170+<script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/jquery.flot.min.js"></script>
171+<script type="text/javascript" src="{{ STATIC_URL }}dashboard_app/js/jquery.dashboard.js"></script>
172+{% include "dashboard_app/_extrahead.html" %}
173
174-</style>
175-<div class="column">
176- <h4>{{ rootfs.grouper|capfirst }}</h4>
177- <ul>
178- {% for image_health in rootfs.list %}
179- <li><a href="{{ image_health.get_absolute_url }}">{{ image_health.rootfs_type }} + {{ image_health.hwpack_type }}</a></li>
180- {% endfor %}
181- </ul>
182-</div>
183-{% endfor %}
184-<div style="clear:both;"></div>
185+{% for report in report_list %}
186+<h4>{{ report }}</h4>
187+{{ report.get_html|safe }}
188+{% empty %}
189+<p>Currently no reports are configured for
190+display on the front page</p>
191+{% endfor %}
192
193=== modified file 'dashboard_app/templates/dashboard_app/image_status_detail.html'
194--- dashboard_app/templates/dashboard_app/image_status_detail.html 2011-08-19 04:06:47 +0000
195+++ dashboard_app/templates/dashboard_app/image_status_detail.html 2011-10-14 12:58:30 +0000
196@@ -110,58 +110,70 @@
197 });
198 </script>
199 <style type="text/css">
200- .result_0 {
201+ .result_pass {
202 background-color: #3aad3a;
203 }
204
205- .result_1 {
206+ .result_fail {
207 background-color: #ff3800;
208 }
209
210- .result_2 {
211+ .result_skip {
212 background-color: yellow;
213 }
214
215- .result_3 {
216+ .result_unknown {
217 background-color: #aaad9c;
218 }
219-
220+
221 .helper {
222 float: left;
223 height: 1em;
224 margin-left: 1px;
225 }
226+
227+ table.special {
228+ border-collapse: collapse;
229+ width: 100%;
230+ }
231+
232+ table.special th {
233+ text-align: left;
234+ border-bottom: 1px solid #333;
235+ padding: 2pt;
236+ }
237 </style>
238-<table style="width: 100%">
239+<table class="special">
240 {% regroup recent_test_run_list by analyzer_assigned_date|date:"Y-m-d" as test_run_cluster_list %}
241 {% for test_run_cluster in test_run_cluster_list %}
242 <tr>
243- <th colspan="3" style="text-align: left; border-bottom: 1px solid #333;"
244- >Tests ran on {{ test_run_cluster.grouper }}</th>
245+ <th colspan="2">Tests ran on {{ test_run_cluster.grouper }}</th>
246+ <th>Pass</th>
247+ <th>Fail</th>
248+ <th>Skip</th>
249+ <th>Unknown</th>
250 </tr>
251 {% for test_run in test_run_cluster.list %}
252 <tr>
253- {% with test_run.test_results.all.order_by as all_results %}
254 <td><a href="{{ test_run.get_absolute_url }}">{{ test_run.test }}</a></td>
255- <td>{{ all_results.count }}</td>
256+ {% with test_run.denormalization as denormalization %}
257 <td>
258 {% spaceless %}
259- {% regroup all_results|dictsort:"result" by result as result_group_list %}
260- {% for result_group in result_group_list %}
261- {% if result_group.list|length > 300 %}
262- <div class="result_{{ result_group.grouper }} helper"
263- style="width: {% widthratio result_group.list|length all_results.count 190 %}px;"></div>
264- <div style="float: left; width: 2:0px; text-align: center">...</div>
265- <div class="result_{{ result_group.grouper }} helper"
266- style="width: {% widthratio result_group.list|length all_results.count 190 %}px;"></div>
267- {% else %}
268- <div class="result_{{ result_group.grouper }} helper"
269- style="width: {% widthratio result_group.list|length all_results.count all_results.count %}px;"></div>
270- {% endif %}
271- {% endfor %}
272+ <div class="result_pass helper"
273+ style="width: {% widthratio denormalization.count_pass denormalization.count_all 500 %}px;"></div>
274+ <div class="result_fail helper"
275+ style="width: {% widthratio denormalization.count_fail denormalization.count_all 500 %}px;"></div>
276+ <div class="result_skip helper"
277+ style="width: {% widthratio denormalization.count_skip denormalization.count_all 500 %}px;"></div>
278+ <div class="result_unknown helper"
279+ style="width: {% widthratio denormalization.count_unknown denormalization.count_all 500 %}px;"></div>
280 {% endspaceless %}
281- {% endwith %}
282 </td>
283+ <td>{{ denormalization.count_pass }}</td>
284+ <td>{{ denormalization.count_fail }}</td>
285+ <td>{{ denormalization.count_skip }}</td>
286+ <td>{{ denormalization.count_unknown }}</td>
287+ {% endwith %}
288 </tr>
289 {% endfor %}
290 {% endfor %}

Subscribers

People subscribed via source and target branches