diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-08-18 17:29:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-19 18:05:56 +0100 |
commit | 6f176d4c7b4f789c0551fc4caa01beb2eb100364 (patch) | |
tree | b0b9ba8a4be63225785255195b50d5c6d501c6cc /bitbake/lib/toaster/toastergui | |
parent | ab13498eb9462075d0551abbf5cb196ca457df63 (diff) | |
download | poky-6f176d4c7b4f789c0551fc4caa01beb2eb100364.tar.gz |
bitbake: toastergui: fix projectbuilds page
This patch fixes the redirection projectbuilds page and
the template layout in the projectbuilds page.
* The _build_list_helper now returns an empty RedirectException
that is properly customized by the caller and re-raised
to achieve redirection to the original page (poor man's overloading)
* The template for ProjectBuilds is updated as to properly display
Build objects instead of BuildRequest objects.
[YOCTO #7995]
(Bitbake rev: 5982b5df9288a5773c7314234e2e0432f85678f2)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/projectbuilds.html | 42 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 24 |
2 files changed, 21 insertions, 45 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html index 646755b183..f1db2f1504 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html +++ b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html | |||
@@ -16,8 +16,8 @@ | |||
16 | <script> | 16 | <script> |
17 | // initialize the date range controls | 17 | // initialize the date range controls |
18 | $(document).ready(function () { | 18 | $(document).ready(function () { |
19 | date_init('created','{{last_date_from}}','{{last_date_to}}','{{dateMin_created}}','{{dateMax_created}}','{{daterange_selected}}'); | 19 | date_init('created','{{last_date_from}}','{{last_date_to}}','{{dateMin_started_on}}','{{dateMax_started_on}}','{{daterange_selected}}'); |
20 | date_init('updated','{{last_date_from}}','{{last_date_to}}','{{dateMin_updated}}','{{dateMax_updated}}','{{daterange_selected}}'); | 20 | date_init('updated','{{last_date_from}}','{{last_date_to}}','{{dateMin_completed_on}}','{{dateMax_completed_on}}','{{daterange_selected}}'); |
21 | }); | 21 | }); |
22 | </script> | 22 | </script> |
23 | 23 | ||
@@ -28,7 +28,7 @@ | |||
28 | {%elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %} | 28 | {%elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %} |
29 | No builds found | 29 | No builds found |
30 | {%else%} | 30 | {%else%} |
31 | All builds | 31 | Project builds |
32 | {%endif%} | 32 | {%endif%} |
33 | <i class="icon-question-sign get-help heading-help" title="This page lists all the builds for the current project"></i> | 33 | <i class="icon-question-sign get-help heading-help" title="This page lists all the builds for the current project"></i> |
34 | </h1> | 34 | </h1> |
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | {% include "basetable_top.html" %} | 59 | {% include "basetable_top.html" %} |
60 | <!-- Table data rows; the order needs to match the order of "tablecols" definitions; and the <td class value needs to match the tablecols clclass value for show/hide buttons to work --> | 60 | <!-- Table data rows; the order needs to match the order of "tablecols" definitions; and the <td class value needs to match the tablecols clclass value for show/hide buttons to work --> |
61 | {% for br in objects %}{% if br.build %} {% with build=br.build %} {# if we have a build, just display it #} | 61 | {% for build in objects %} {# if we have a build, just display it #} |
62 | <tr class="data"> | 62 | <tr class="data"> |
63 | <td class="outcome"><a href="{% url "builddashboard" build.id %}">{%if build.outcome == build.SUCCEEDED%}<i class="icon-ok-sign success"></i>{%elif build.outcome == build.FAILED%}<i class="icon-minus-sign error"></i>{%else%}{%endif%}</a> | 63 | <td class="outcome"><a href="{% url "builddashboard" build.id %}">{%if build.outcome == build.SUCCEEDED%}<i class="icon-ok-sign success"></i>{%elif build.outcome == build.FAILED%}<i class="icon-minus-sign error"></i>{%else%}{%endif%}</a> |
64 | {% if build.project %} | 64 | {% if build.project %} |
@@ -96,40 +96,6 @@ | |||
96 | {% endif %} | 96 | {% endif %} |
97 | </td> | 97 | </td> |
98 | </tr> | 98 | </tr> |
99 | |||
100 | {%endwith%} | ||
101 | {% else %} {# we don't have a build for this build request, mask the data with build request data #} | ||
102 | |||
103 | |||
104 | |||
105 | <tr class="data"> | ||
106 | <td class="outcome">{% if br.state == br.REQ_FAILED %}<i class="icon-minus-sign error"></i>{%else%}FIXME_build_request_state{%endif%}</td> | ||
107 | <td class="target"> | ||
108 | <a href="{% url "builddashboard" br.id %}"><span data-toggle="tooltip" {%if br.brtarget_set.all.count > 1%}title="Targets: {%for target in br.brtarget_set.all%}{{target.target}} {%endfor%}"{%endif%}>{{br.brtarget_set.all.0.target}} {%if br.brtarget_set.all.count > 1%}(+ {{br.brtarget_set.all.count|add:"-1"}}){%endif%} </span></a> | ||
109 | </td> | ||
110 | <td class="machine"> | ||
111 | <a href="{% url "builddashboard" br.id %}">{{br.machine}}</a> | ||
112 | </td> | ||
113 | <td class="started_on"> | ||
114 | <a href="{% url "builddashboard" br.id %}">{{br.created|date:"d/m/y H:i"}}</a> | ||
115 | </td> | ||
116 | <td class="completed_on"> | ||
117 | <a href="{% url "builddashboard" br.id %}">{{br.updated|date:"d/m/y H:i"}}</a> | ||
118 | </td> | ||
119 | <td class="failed_tasks error"> | ||
120 | </td> | ||
121 | <td class="errors.count"> | ||
122 | <a class="errors.count error" href="{% url "builddashboard" br.id %}#errors">{{br.brerror_set.all.count}} error{{br.brerror_set.all.count|pluralize}}</a> | ||
123 | </td> | ||
124 | <td class="warnings.count"> | ||
125 | </td> | ||
126 | <td class="time"> | ||
127 | {{br.timespent.total_seconds|sectohms}} | ||
128 | </td> | ||
129 | <td class="output"> {# we have no output here #} | ||
130 | </td> | ||
131 | </tr> | ||
132 | {%endif%} | ||
133 | {% endfor %} | 99 | {% endfor %} |
134 | 100 | ||
135 | 101 | ||
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 7ebcfc1150..98d21f4046 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -33,7 +33,7 @@ from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File | |||
33 | from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact | 33 | from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact |
34 | from bldcontrol import bbcontroller | 34 | from bldcontrol import bbcontroller |
35 | from django.views.decorators.cache import cache_control | 35 | from django.views.decorators.cache import cache_control |
36 | from django.core.urlresolvers import reverse | 36 | from django.core.urlresolvers import reverse, resolve |
37 | from django.core.exceptions import MultipleObjectsReturned | 37 | from django.core.exceptions import MultipleObjectsReturned |
38 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger | 38 | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger |
39 | from django.http import HttpResponseBadRequest, HttpResponseNotFound | 39 | from django.http import HttpResponseBadRequest, HttpResponseNotFound |
@@ -372,7 +372,6 @@ def _get_queryset(model, queryset, filter_string, search_term, ordering_string, | |||
372 | # if the value is given explicitly as a GET parameter it will be the first selected, | 372 | # if the value is given explicitly as a GET parameter it will be the first selected, |
373 | # otherwise the cookie value will be used. | 373 | # otherwise the cookie value will be used. |
374 | def _get_parameters_values(request, default_count, default_order): | 374 | def _get_parameters_values(request, default_count, default_order): |
375 | from django.core.urlresolvers import resolve | ||
376 | current_url = resolve(request.path_info).url_name | 375 | current_url = resolve(request.path_info).url_name |
377 | pagesize = request.GET.get('count', request.session.get('%s_count' % current_url, default_count)) | 376 | pagesize = request.GET.get('count', request.session.get('%s_count' % current_url, default_count)) |
378 | orderby = request.GET.get('orderby', request.session.get('%s_orderby' % current_url, default_order)) | 377 | orderby = request.GET.get('orderby', request.session.get('%s_orderby' % current_url, default_order)) |
@@ -1894,7 +1893,14 @@ if True: | |||
1894 | 1893 | ||
1895 | queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS) | 1894 | queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS) |
1896 | 1895 | ||
1897 | context, pagesize, orderby = _build_list_helper(request, queryset) | 1896 | try: |
1897 | context, pagesize, orderby = _build_list_helper(request, queryset) | ||
1898 | # all builds page as a Project column | ||
1899 | context['tablecols'].append({'name': 'Project', 'clcalss': 'project_column', }) | ||
1900 | except RedirectException as re: | ||
1901 | # rewrite the RedirectException | ||
1902 | re.view = resolve(request.path_info).url_name | ||
1903 | raise re | ||
1898 | 1904 | ||
1899 | _set_parameters_values(pagesize, orderby, request) | 1905 | _set_parameters_values(pagesize, orderby, request) |
1900 | return context | 1906 | return context |
@@ -1908,7 +1914,7 @@ if True: | |||
1908 | mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby } | 1914 | mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby } |
1909 | retval = _verify_parameters( request.GET, mandatory_parameters ) | 1915 | retval = _verify_parameters( request.GET, mandatory_parameters ) |
1910 | if retval: | 1916 | if retval: |
1911 | raise RedirectException( 'all-builds', request.GET, mandatory_parameters) | 1917 | raise RedirectException( None, request.GET, mandatory_parameters) |
1912 | 1918 | ||
1913 | # boilerplate code that takes a request for an object type and returns a queryset | 1919 | # boilerplate code that takes a request for an object type and returns a queryset |
1914 | # for that object type. copypasta for all needed table searches | 1920 | # for that object type. copypasta for all needed table searches |
@@ -2083,8 +2089,6 @@ if True: | |||
2083 | {'name': 'Image files', 'clclass': 'output', | 2089 | {'name': 'Image files', 'clclass': 'output', |
2084 | 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory", | 2090 | 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory", |
2085 | # TODO: compute image fstypes from Target_Image_File | 2091 | # TODO: compute image fstypes from Target_Image_File |
2086 | }, | ||
2087 | {'name': 'Project', 'clcalss': 'project_column', | ||
2088 | } | 2092 | } |
2089 | ] | 2093 | ] |
2090 | } | 2094 | } |
@@ -2655,7 +2659,13 @@ if True: | |||
2655 | 2659 | ||
2656 | queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS) | 2660 | queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS) |
2657 | 2661 | ||
2658 | context, pagesize, orderby = _build_list_helper(request, queryset) | 2662 | try: |
2663 | context, pagesize, orderby = _build_list_helper(request, queryset) | ||
2664 | except RedirectException as re: | ||
2665 | # rewrite the RedirectException with our current url information | ||
2666 | re.view = resolve(request.path_info).url_name | ||
2667 | re.okwargs = {"pid" : pid} | ||
2668 | raise re | ||
2659 | 2669 | ||
2660 | context['project'] = prj | 2670 | context['project'] = prj |
2661 | _set_parameters_values(pagesize, orderby, request) | 2671 | _set_parameters_values(pagesize, orderby, request) |