diff options
Diffstat (limited to 'bitbake/lib')
7 files changed, 342 insertions, 48 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html b/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html new file mode 100644 index 0000000000..355ae9073c --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html | |||
@@ -0,0 +1,60 @@ | |||
1 | {% comment %} | ||
2 | Show pagination controls as per search/pagination table detail spec. | ||
3 | Input: objects, setup for pagination using the standard method in views. | ||
4 | object_count, count for complete list of objects, (all pages, no pattern) | ||
5 | {% endcomment %} | ||
6 | |||
7 | {# only paginate if 10 or more rows unfiltered, all pages #} | ||
8 | {% if object_count >= 10 %} | ||
9 | <div class="pagination"> | ||
10 | <ul> | ||
11 | {%if objects.has_previous %} | ||
12 | <li><a href="javascript:reload_params({'page':{{objects.previous_page_number}}})">«</a></li> | ||
13 | {%else%} | ||
14 | <li class="disabled"><a href="#">«</a></li> | ||
15 | {%endif%} | ||
16 | {% for i in objects.page_range %} | ||
17 | <li{%if i == objects.number %} class="active" {%endif%}><a href="javascript:reload_params({'page':{{i}}})">{{i}}</a></li> | ||
18 | {% endfor %} | ||
19 | {%if objects.has_next%} | ||
20 | <li><a href="javascript:reload_params({'page':{{objects.next_page_number}}})">»</a></li> | ||
21 | {%else%} | ||
22 | <li class="disabled"><a href="#">»</a></li> | ||
23 | {%endif%} | ||
24 | </ul> | ||
25 | |||
26 | <div class="pull-right"> | ||
27 | <span class="help-inline" style="padding-bottom:10px;">Show rows:</span> | ||
28 | <select class="pagesize"> | ||
29 | {% with "10 25 50 100 150" as list%} | ||
30 | {% for i in list.split %} | ||
31 | <option value="{{i}}">{{i}}</option> | ||
32 | {% endfor %} | ||
33 | {% endwith %} | ||
34 | </select> | ||
35 | </div> | ||
36 | </div> | ||
37 | |||
38 | <!-- Update page display settings --> | ||
39 | <script> | ||
40 | $(document).ready(function() { | ||
41 | // load cookie for number of entries to be displayed on page | ||
42 | if ({{request.GET.count}} != "") { | ||
43 | pagesize = {{request.GET.count}}; | ||
44 | } else { | ||
45 | pagesize = $.cookie('_count'); | ||
46 | } | ||
47 | |||
48 | $('.pagesize option').prop('selected', false) | ||
49 | .filter('[value="' + pagesize + '"]') | ||
50 | .attr('selected', true); | ||
51 | |||
52 | $(".pagesize").change(function () { | ||
53 | // save cookie with pagesize | ||
54 | $.cookie("_count", $(this).val(), { path : $(location).attr('pathname') }); | ||
55 | reload_params({"count":$(this).val()}); | ||
56 | }); | ||
57 | }); | ||
58 | </script> | ||
59 | {% endif %} | ||
60 | |||
diff --git a/bitbake/lib/toaster/toastergui/templates/detail_search_header.html b/bitbake/lib/toaster/toastergui/templates/detail_search_header.html new file mode 100644 index 0000000000..ca8e158cb1 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/detail_search_header.html | |||
@@ -0,0 +1,68 @@ | |||
1 | {% comment %} | ||
2 | Show a detail table Search field and Rows per page. | ||
3 | Input: | ||
4 | objects, our boilerplated paginated with search fields set. | ||
5 | object_count, count of full, unfiltered, objects list | ||
6 | search_what, fills in "Search ___" | ||
7 | Only show the search form if we have more than 10 results, | ||
8 | or if return from a previous search. | ||
9 | {% endcomment %} | ||
10 | |||
11 | |||
12 | <script> | ||
13 | $(document).ready(function() { | ||
14 | /* Clear the current search selection and reload the results */ | ||
15 | $(".search-clear").click(function(){ | ||
16 | $("#search").val(""); | ||
17 | $(this).parents("form").submit(); | ||
18 | }); | ||
19 | }); | ||
20 | </script> | ||
21 | <div class="row-fluid"> | ||
22 | {% if objects.paginator.count > 10 or request.GET.search %} | ||
23 | {% if objects.paginator.count == 0 %} | ||
24 | <div class="alert"> | ||
25 | <h3>No {{search_what}} found</h3> | ||
26 | <form id="searchform" class="input-append"> | ||
27 | {% else %} | ||
28 | <form id="searchform" class="navbar-search input-append pull-left"> | ||
29 | {% endif %} | ||
30 | |||
31 | <input id="search" class="input-xlarge" type="text" placeholder="Search {{search_what}}" name="search" value="{{request.GET.search}}"> | ||
32 | <input type="hidden" value="name:+" name="orderby"> | ||
33 | <input type="hidden" value="l" name="page"> | ||
34 | {% if request.GET.search %} | ||
35 | <a class="add-on btn search-clear"> | ||
36 | <i class="icon-remove"></i> | ||
37 | </a> | ||
38 | {% endif %} | ||
39 | <button type="submit" class="btn">Search</button> | ||
40 | {% if objects.paginator.count == 0 %} | ||
41 | <button type="submit" class="btn btn-link search-clear"> | ||
42 | Show all {{search_what}} | ||
43 | </button> | ||
44 | {% endif %} | ||
45 | </form> | ||
46 | {% endif %} | ||
47 | |||
48 | {% if objects.paginator.count == 0 %} | ||
49 | </div> {# end alert #} | ||
50 | {% else %} | ||
51 | {% if object_count > 10 %} | ||
52 | <div class="pull-right"> | ||
53 | <span class="help-inline" style="padding-top:5px;">Show rows:</span> | ||
54 | <select style="margin-top:5px;margin-bottom:0px;" class="pagesize"> | ||
55 | {% with "10 25 50 100 150" as list%} | ||
56 | {% for i in list.split %} | ||
57 | {% if request.session.limit == i %} | ||
58 | <option value="{{i}}" selected>{{i}}</option> | ||
59 | {% else %} | ||
60 | <option value="{{i}}">{{i}}</option> | ||
61 | {% endif %} | ||
62 | {% endfor %} | ||
63 | {% endwith %} | ||
64 | </select> | ||
65 | </div> | ||
66 | {% endif %} | ||
67 | {% endif %} | ||
68 | </div> {# row-fluid #} | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/detail_sorted_header.html b/bitbake/lib/toaster/toastergui/templates/detail_sorted_header.html new file mode 100644 index 0000000000..a7917dcf5a --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/detail_sorted_header.html | |||
@@ -0,0 +1,25 @@ | |||
1 | {% comment %} | ||
2 | Adds sorted columns to a detail table. | ||
3 | Must be preceded by <table class="table table-bordered table-hover tablesorter" id="otable"> | ||
4 | Must be followed by <tbody>...</tbody></table>. | ||
5 | Requires tablecols setup column fields dclass, clclass, qhelp, orderfield. | ||
6 | {% endcomment %} | ||
7 | {% load projecttags %} | ||
8 | {# <table class="table table-bordered table-hover tablesorter" id="otable"> #} | ||
9 | <thead> | ||
10 | <!-- Table header row; generated from "tablecols" entry in the context dict --> | ||
11 | <tr> | ||
12 | {% for tc in tablecols %}<th class="{{tc.dclass}} {{tc.clclass}}"> | ||
13 | {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%} | ||
14 | {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })" onclick="saveOrderCookie('{{tc.orderfield}}')">{{tc.name}}</a>{%else%}<span class="muted">{{tc.name}}</span>{%endif%} | ||
15 | {%if tc.ordericon%} <i class="icon-caret-{{tc.ordericon}}"></i>{%endif%} | ||
16 | {% if request.GET.search and forloop.first %} | ||
17 | <span class="badge badge-info">{{objects.paginator.count}}</span> | ||
18 | {% endif %} | ||
19 | {%if tc.filter%}<div class="btn-group pull-right"> | ||
20 | <a href="#filter_{{tc.filter.class}}" role="button" class="btn btn-mini {%if request.GET.filter%}{{tc.filter.options|filtered_icon:request.GET.filter}} {%endif%}" {%if request.GET.filter and tc.filter.options|filtered_tooltip:request.GET.filter %} title="<p>{{tc.filter.options|filtered_tooltip:request.GET.filter}}</p><p><a class='btn btn-small btn-primary' href=javascript:reload_params({'filter':''})>Show all {% if filter_search_display %}{{filter_search_display}}{% else %}{{objectname}}{% endif %}</a></p>" {%endif%} data-toggle="modal"> <i class="icon-filter filtered"></i> </a> | ||
21 | </div>{%endif%} | ||
22 | </th>{% endfor %} | ||
23 | </tr> | ||
24 | </thead> | ||
25 | |||
diff --git a/bitbake/lib/toaster/toastergui/templates/recipe.html b/bitbake/lib/toaster/toastergui/templates/recipe.html index 621b852e77..6eba9b6f0b 100644 --- a/bitbake/lib/toaster/toastergui/templates/recipe.html +++ b/bitbake/lib/toaster/toastergui/templates/recipe.html | |||
@@ -19,25 +19,25 @@ | |||
19 | 19 | ||
20 | <div class="row span7 tabbable"> | 20 | <div class="row span7 tabbable"> |
21 | <ul class="nav nav-pills"> | 21 | <ul class="nav nav-pills"> |
22 | <li class="active"> | 22 | <li class="{{tab_states.1}}"> |
23 | <a href="#information" data-toggle="tab"> | 23 | <a href="#information" data-toggle="tab"> |
24 | <i class="icon-question-sign get-help" title="Build-related information about the recipe"></i> | 24 | <i class="icon-question-sign get-help" title="Build-related information about the recipe"></i> |
25 | Recipe details | 25 | Recipe details |
26 | </a> | 26 | </a> |
27 | </li> | 27 | </li> |
28 | <li> | 28 | <li> |
29 | <a href="#packages-built" data-toggle="tab"> | 29 | <a href="{% url "recipe_packages" build.pk object.id %}"> |
30 | <i class="icon-question-sign get-help" title="The packaged output resulting from building the recipe"></i> | 30 | <i class="icon-question-sign get-help" title="The packaged output resulting from building the recipe"></i> |
31 | Packages ({{packages.count}}) | 31 | Packages ({{package_count}}) |
32 | </a> | 32 | </a> |
33 | </li> | 33 | </li> |
34 | <li> | 34 | <li class="{{tab_states.3}}"> |
35 | <a href="#dependencies" data-toggle="tab"> | 35 | <a href="#dependencies" data-toggle="tab"> |
36 | <i class="icon-question-sign get-help" title="The recipe build-time dependencies (i.e. other recipes)"></i> | 36 | <i class="icon-question-sign get-help" title="The recipe build-time dependencies (i.e. other recipes)"></i> |
37 | Build dependencies ({{object.r_dependencies_recipe.all.count}}) | 37 | Build dependencies ({{object.r_dependencies_recipe.all.count}}) |
38 | </a> | 38 | </a> |
39 | </li> | 39 | </li> |
40 | <li> | 40 | <li class="{{tab_states.4}}"> |
41 | <a href="#brought-in-by" data-toggle="tab"> | 41 | <a href="#brought-in-by" data-toggle="tab"> |
42 | <i class="icon-question-sign get-help" title="The recipe build-time reverse dependencies (i.e. the recipes that depend on this recipe)"></i> | 42 | <i class="icon-question-sign get-help" title="The recipe build-time reverse dependencies (i.e. the recipes that depend on this recipe)"></i> |
43 | Reverse build dependencies ({{object.r_dependencies_depends.all.count}}) | 43 | Reverse build dependencies ({{object.r_dependencies_depends.all.count}}) |
@@ -45,7 +45,7 @@ | |||
45 | </li> | 45 | </li> |
46 | </ul> | 46 | </ul> |
47 | <div class="tab-content"> | 47 | <div class="tab-content"> |
48 | <div class="tab-pane active" id="information" name="information"> | 48 | <div class="tab-pane {{tab_states.1}}" id="information" name="information"> |
49 | <dl class="dl-horizontal"> | 49 | <dl class="dl-horizontal"> |
50 | <dt> | 50 | <dt> |
51 | <i class="icon-question-sign get-help" title="The name of the layer providing the recipe"></i> | 51 | <i class="icon-question-sign get-help" title="The name of the layer providing the recipe"></i> |
@@ -144,43 +144,7 @@ | |||
144 | </table> | 144 | </table> |
145 | {% endif %} | 145 | {% endif %} |
146 | </div> | 146 | </div> |
147 | <div class="tab-pane" id="packages-built" name="packages-built"> | 147 | <div class="tab-pane {{tab_states.3}}" id="dependencies" name="dependencies"> |
148 | {% if not packages %} | ||
149 | <div class="alert alert-info"> | ||
150 | <strong>{{object.name}}_{{object.version}}</strong> does not build any packages. | ||
151 | </div> | ||
152 | {% else %} | ||
153 | <table class="table table-bordered table-hover" style="margin-top:10px;"> | ||
154 | <thead> | ||
155 | <tr> | ||
156 | <th> | ||
157 | Package | ||
158 | </th> | ||
159 | <th> | ||
160 | Version | ||
161 | </th> | ||
162 | <th class="sizecol span2"> | ||
163 | Size | ||
164 | </th> | ||
165 | </tr> | ||
166 | </thead> | ||
167 | <tbody> | ||
168 | |||
169 | {% for package in packages|dictsort:"name" %} | ||
170 | |||
171 | <tr> | ||
172 | <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.name}}</a></td> | ||
173 | <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.version}}_{{package.revision}}</a></td> | ||
174 | <td class="sizecol"><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.size|filtered_filesizeformat}}</a></td> | ||
175 | </tr> | ||
176 | |||
177 | {% endfor %} | ||
178 | |||
179 | </tbody> | ||
180 | </table> | ||
181 | {% endif %} | ||
182 | </div> | ||
183 | <div class="tab-pane" id="dependencies" name="dependencies"> | ||
184 | 148 | ||
185 | {% if not object.r_dependencies_recipe.all %} | 149 | {% if not object.r_dependencies_recipe.all %} |
186 | <div class="alert alert-info"> | 150 | <div class="alert alert-info"> |
@@ -212,7 +176,7 @@ | |||
212 | {% endif %} | 176 | {% endif %} |
213 | 177 | ||
214 | </div> | 178 | </div> |
215 | <div class="tab-pane" id="brought-in-by" name="brought-in-by"> | 179 | <div class="tab-pane {{tab_states.4}}" id="brought-in-by" name="brought-in-by"> |
216 | 180 | ||
217 | {% if not object.r_dependencies_depends.all %} | 181 | {% if not object.r_dependencies_depends.all %} |
218 | <div class="alert alert-info"> | 182 | <div class="alert alert-info"> |
diff --git a/bitbake/lib/toaster/toastergui/templates/recipe_packages.html b/bitbake/lib/toaster/toastergui/templates/recipe_packages.html new file mode 100644 index 0000000000..d25847bc0d --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/recipe_packages.html | |||
@@ -0,0 +1,123 @@ | |||
1 | {% extends "basebuilddetailpage.html" %} | ||
2 | |||
3 | {% load projecttags %} | ||
4 | {% load humanize %} | ||
5 | {% block localbreadcrumb %} | ||
6 | <li><a href="{% url 'recipes' build.pk %}">Recipes</a></li> | ||
7 | <li>{{recipe.name}}_{{recipe.version}} </li> | ||
8 | {% endblock %} | ||
9 | |||
10 | {% block pagedetailinfomain %} | ||
11 | |||
12 | <!-- Begin container --> | ||
13 | |||
14 | <div class="row-fluid span11"> | ||
15 | <div class="page-header"> | ||
16 | <h1>{{recipe.name}}_{{recipe.version}}</h1> | ||
17 | </div> | ||
18 | </div> | ||
19 | |||
20 | <div class="row-fluid span7 tabbable"> | ||
21 | <ul class="nav nav-pills"> | ||
22 | <li> | ||
23 | <a href="{% url "recipe" build.pk recipe.id "1" %}"> | ||
24 | <i class="icon-question-sign get-help" title="Build-related information about the recipe"></i> | ||
25 | Recipe details | ||
26 | </a> | ||
27 | </li> | ||
28 | <li class="active"> | ||
29 | <a href="#packages-built" data-toggle="tab"> | ||
30 | <i class="icon-question-sign get-help" title="The packaged output resulting from building the recipe"></i> | ||
31 | Packages ({{object_count}}) | ||
32 | </a> | ||
33 | </li> | ||
34 | <li> | ||
35 | <a href="{% url "recipe" build.pk recipe.id "3" %}"> | ||
36 | <i class="icon-question-sign get-help" title="The recipe build-time dependencies (i.e. other recipes)"></i> | ||
37 | Build dependencies ({{recipe.r_dependencies_recipe.all.count}}) | ||
38 | </a> | ||
39 | </li> | ||
40 | <li> | ||
41 | <a href="{% url "recipe" build.pk recipe.id "4" %}"> | ||
42 | <i class="icon-question-sign get-help" title="The recipe build-time reverse dependencies (i.e. the recipes that depend on this recipe)"></i> | ||
43 | Reverse build dependencies ({{recipe.r_dependencies_depends.all.count}}) | ||
44 | </a> | ||
45 | </li> | ||
46 | </ul> | ||
47 | <div class="tab-content"> | ||
48 | {# <div class="tab-pane active" id="packages-built" name="packages-built">#} | ||
49 | <div class="tab-pane active" id="packages-built"> | ||
50 | {% if not objects and not request.GET.search %} | ||
51 | <div class="alert alert-info"> | ||
52 | <strong>{{recipe.name}}_{{recipe.version}}</strong> does not build any packages. | ||
53 | </div> | ||
54 | |||
55 | {% elif not objects %} | ||
56 | {# have empty search results, no table nor pagination #} | ||
57 | {% with "packages" as search_what %} | ||
58 | {% include "detail_search_header.html" %} | ||
59 | {% endwith %} | ||
60 | |||
61 | {% else %} | ||
62 | |||
63 | |||
64 | {% with "packages" as search_what %} | ||
65 | {% include "detail_search_header.html" %} | ||
66 | {% endwith %} | ||
67 | <table class="table table-bordered table-hover tablesorter" id="otable"> | ||
68 | {% include "detail_sorted_header.html" %} | ||
69 | |||
70 | <tbody> | ||
71 | {% for package in objects %} | ||
72 | |||
73 | <tr> | ||
74 | <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.name}}</a></td> | ||
75 | <td><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.version}}_{{package.revision}}</a></td> | ||
76 | <td class="sizecol"><a href="{% url "package_built_detail" build.pk package.pk %}">{{package.size|filtered_filesizeformat}}</a></td> | ||
77 | </tr> | ||
78 | |||
79 | {% endfor %} | ||
80 | |||
81 | {% endif %} | ||
82 | {% if objects %} | ||
83 | </tbody> | ||
84 | </table> | ||
85 | {% include "detail_pagination_bottom.html" %} | ||
86 | {% endif %} | ||
87 | </div> {# tab-pane #} | ||
88 | </div> {# tab-content #} | ||
89 | </div> {# span7 #} | ||
90 | |||
91 | <div class="row span4 well"> | ||
92 | <h2>About {{recipe.name}}</h2> | ||
93 | <dl class="item-info"> | ||
94 | {% if recipe.summary %} | ||
95 | <dt>Summary</dt> | ||
96 | <dd>{{recipe.summary}}</dd> | ||
97 | {% endif %} | ||
98 | {% if recipe.description %} | ||
99 | <dt>Description</dt> | ||
100 | <dd>{{recipe.description}}</dd> | ||
101 | {% endif %} | ||
102 | {% if recipe.homepage %} | ||
103 | <dt>Homepage</dt> | ||
104 | <dd><a href="{{recipe.homepage}}">{{recipe.homepage}}</a></dd> | ||
105 | {% endif %} | ||
106 | {% if recipe.bugtracker %} | ||
107 | <dt>Bugtracker</dt> | ||
108 | <dd><a href="{{recipe.bugtracker}}">{{recipe.bugtracker}}</a></dd> | ||
109 | {% endif %} | ||
110 | {% if recipe.section %} | ||
111 | <dt> | ||
112 | Section | ||
113 | <i class="icon-question-sign get-help" title="The section in which recipes should be categorized"></i> | ||
114 | </dt> | ||
115 | <dd>{{recipe.section}}</dd> | ||
116 | {% endif %} | ||
117 | {% if recipe.license %} | ||
118 | <dt>License</dt> | ||
119 | <dd>{{recipe.license}}</dd> | ||
120 | {% endif %} | ||
121 | </dl> | ||
122 | </div> | ||
123 | {% endblock pagedetailinfomain %} | ||
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 1c83090f58..fc03f19a7f 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py | |||
@@ -32,7 +32,9 @@ urlpatterns = patterns('toastergui.views', | |||
32 | url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'), | 32 | url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'), |
33 | 33 | ||
34 | url(r'^build/(?P<build_id>\d+)/recipes/$', 'recipes', name='recipes'), | 34 | url(r'^build/(?P<build_id>\d+)/recipes/$', 'recipes', name='recipes'), |
35 | url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)/active_tab/(?P<active_tab>\d{1})$', 'recipe', name='recipe'), | ||
35 | url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$', 'recipe', name='recipe'), | 36 | url(r'^build/(?P<build_id>\d+)/recipe/(?P<recipe_id>\d+)$', 'recipe', name='recipe'), |
37 | url(r'^build/(?P<build_id>\d+)/recipe_packages/(?P<recipe_id>\d+)$', 'recipe_packages', name='recipe_packages'), | ||
36 | 38 | ||
37 | url(r'^build/(?P<build_id>\d+)/packages/$', 'bpackage', name='packages'), | 39 | url(r'^build/(?P<build_id>\d+)/packages/$', 'bpackage', name='packages'), |
38 | url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)$', 'package_built_detail', | 40 | url(r'^build/(?P<build_id>\d+)/package/(?P<package_id>\d+)$', 'package_built_detail', |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 4f4ae67ca7..ed27ca0ac9 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -419,8 +419,7 @@ def task( request, build_id, task_id ): | |||
419 | 419 | ||
420 | return render( request, template, context ) | 420 | return render( request, template, context ) |
421 | 421 | ||
422 | 422 | def recipe(request, build_id, recipe_id, active_tab="1"): | |
423 | def recipe(request, build_id, recipe_id): | ||
424 | template = "recipe.html" | 423 | template = "recipe.html" |
425 | if Recipe.objects.filter(pk=recipe_id).count() == 0 : | 424 | if Recipe.objects.filter(pk=recipe_id).count() == 0 : |
426 | return redirect(builds) | 425 | return redirect(builds) |
@@ -429,7 +428,12 @@ def recipe(request, build_id, recipe_id): | |||
429 | layer_version = Layer_Version.objects.get(pk=object.layer_version_id) | 428 | layer_version = Layer_Version.objects.get(pk=object.layer_version_id) |
430 | layer = Layer.objects.get(pk=layer_version.layer_id) | 429 | layer = Layer.objects.get(pk=layer_version.layer_id) |
431 | tasks = Task.objects.filter(recipe_id = recipe_id, build_id = build_id).exclude(order__isnull=True).exclude(task_name__endswith='_setscene').exclude(outcome=Task.OUTCOME_NA) | 430 | tasks = Task.objects.filter(recipe_id = recipe_id, build_id = build_id).exclude(order__isnull=True).exclude(task_name__endswith='_setscene').exclude(outcome=Task.OUTCOME_NA) |
432 | packages = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0) | 431 | package_count = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0).count() |
432 | |||
433 | if active_tab != '1' and active_tab != '3' and active_tab != '4' : | ||
434 | active_tab = '1' | ||
435 | tab_states = {'1': '', '3': '', '4': ''} | ||
436 | tab_states[active_tab] = 'active' | ||
433 | 437 | ||
434 | context = { | 438 | context = { |
435 | 'build' : Build.objects.get(pk=build_id), | 439 | 'build' : Build.objects.get(pk=build_id), |
@@ -437,10 +441,58 @@ def recipe(request, build_id, recipe_id): | |||
437 | 'layer_version' : layer_version, | 441 | 'layer_version' : layer_version, |
438 | 'layer' : layer, | 442 | 'layer' : layer, |
439 | 'tasks' : tasks, | 443 | 'tasks' : tasks, |
440 | 'packages': packages, | 444 | 'package_count' : package_count, |
445 | 'tab_states' : tab_states, | ||
441 | } | 446 | } |
442 | return render(request, template, context) | 447 | return render(request, template, context) |
443 | 448 | ||
449 | def recipe_packages(request, build_id, recipe_id): | ||
450 | template = "recipe_packages.html" | ||
451 | if Recipe.objects.filter(pk=recipe_id).count() == 0 : | ||
452 | return redirect(builds) | ||
453 | |||
454 | (pagesize, orderby) = _get_parameters_values(request, 10, 'name:+') | ||
455 | mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby': orderby } | ||
456 | retval = _verify_parameters( request.GET, mandatory_parameters ) | ||
457 | if retval: | ||
458 | return _redirect_parameters( 'recipe_packages', request.GET, mandatory_parameters, build_id = build_id, recipe_id = recipe_id) | ||
459 | (filter_string, search_term, ordering_string) = _search_tuple(request, Package) | ||
460 | |||
461 | recipe = Recipe.objects.get(pk=recipe_id) | ||
462 | queryset = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0) | ||
463 | package_count = queryset.count() | ||
464 | queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string, 'name') | ||
465 | |||
466 | packages = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) | ||
467 | |||
468 | context = { | ||
469 | 'build' : Build.objects.get(pk=build_id), | ||
470 | 'recipe' : recipe, | ||
471 | 'objects' : packages, | ||
472 | 'object_count' : package_count, | ||
473 | 'tablecols':[ | ||
474 | { | ||
475 | 'name':'Package', | ||
476 | 'orderfield': _get_toggle_order(request,"name"), | ||
477 | 'ordericon': _get_toggle_order_icon(request,"name"), | ||
478 | 'orderkey': "name", | ||
479 | }, | ||
480 | { | ||
481 | 'name':'Version', | ||
482 | }, | ||
483 | { | ||
484 | 'name':'Size', | ||
485 | 'orderfield': _get_toggle_order(request,"size", True), | ||
486 | 'ordericon': _get_toggle_order_icon(request,"size"), | ||
487 | 'orderkey': 'size', | ||
488 | 'dclass': 'sizecol span2', | ||
489 | }, | ||
490 | ] | ||
491 | } | ||
492 | response = render(request, template, context) | ||
493 | _save_parameters_cookies(response, pagesize, orderby, request) | ||
494 | return response | ||
495 | |||
444 | def target_common( request, build_id, target_id, variant ): | 496 | def target_common( request, build_id, target_id, variant ): |
445 | template = "target.html" | 497 | template = "target.html" |
446 | (pagesize, orderby) = _get_parameters_values(request, 25, 'name:+') | 498 | (pagesize, orderby) = _get_parameters_values(request, 25, 'name:+') |