summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basebuildpage.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basetable_bottom.html15
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basetable_top.html23
-rw-r--r--bitbake/lib/toaster/toastergui/templates/build.html20
-rw-r--r--bitbake/lib/toaster/toastergui/templates/builddashboard.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/configvars.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py17
-rw-r--r--bitbake/lib/toaster/toastergui/views.py69
8 files changed, 107 insertions, 45 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
index 7d2a1f388e..c85faf9f6a 100644
--- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
+++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
@@ -8,7 +8,7 @@
8 <div class="section"> 8 <div class="section">
9 <ul class="breadcrumb" id="breadcrumb"> 9 <ul class="breadcrumb" id="breadcrumb">
10<li><a href="{% url 'all-builds' %}">All builds</a></li> 10<li><a href="{% url 'all-builds' %}">All builds</a></li>
11<li><a href="{%url 'builddashboard' build.pk%}">{{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|naturaltime}})</a></li> 11<li><a href="{%url 'builddashboard' build.pk%}">{{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})</a></li>
12 {% block localbreadcrumb %}{% endblock %} 12 {% block localbreadcrumb %}{% endblock %}
13 </ul> 13 </ul>
14 <script> 14 <script>
diff --git a/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html b/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
index 3e4b0cc5a4..8f81472723 100644
--- a/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
+++ b/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
@@ -38,6 +38,21 @@
38<script> 38<script>
39 $(document).ready(function() { 39 $(document).ready(function() {
40 40
41 // we load cookies for the column display
42 save = $.cookie('_displaycols_{{objectname}}');
43 setting = save.split(';');
44 for ( i = 0; i < setting.length; i++) {
45 if (setting[i].length > 0) {
46 [id, v] = setting[i].split(':');
47 if (v == 'true') {
48 $('.chbxtoggle#'+id).prop('checked', true);
49 }
50 else {
51 $('.chbxtoggle#'+id).prop('checked', false);
52 }
53 }
54 }
55
41 $('.chbxtoggle').each(function () { 56 $('.chbxtoggle').each(function () {
42 showhideTableColumn($(this).attr('id'), $(this).is(':checked')) 57 showhideTableColumn($(this).attr('id'), $(this).is(':checked'))
43 }); 58 });
diff --git a/bitbake/lib/toaster/toastergui/templates/basetable_top.html b/bitbake/lib/toaster/toastergui/templates/basetable_top.html
index 34e0cd7210..b8d5c382c7 100644
--- a/bitbake/lib/toaster/toastergui/templates/basetable_top.html
+++ b/bitbake/lib/toaster/toastergui/templates/basetable_top.html
@@ -1,8 +1,15 @@
1{% load projecttags %}
1<!-- component to display a generic table --> 2<!-- component to display a generic table -->
2 <script> 3 <script>
3 function showhideTableColumn(clname, sh) { 4 function showhideTableColumn(clname, sh) {
4 if (sh) $('.' + clname).show(); 5 if (sh) $('.' + clname).show(100);
5 else $('.' + clname).hide(); 6 else $('.' + clname).hide(100);
7
8 // save cookie for all checkboxes
9 save = '';
10 $('.chbxtoggle').each(function() { if ($(this).attr('id') != undefined) { save += ';' + $(this).attr('id') +':'+ $(this).is(':checked')} })
11 $.cookie('_displaycols_{{objectname}}', save);
12 save = '';
6 } 13 }
7 14
8 15
@@ -22,8 +29,11 @@
22<!-- control header --> 29<!-- control header -->
23<div class="navbar"> 30<div class="navbar">
24 <div class="navbar-inner"> 31 <div class="navbar-inner">
25 <form class="navbar-search input-append pull-left" > 32 <form class="navbar-search input-append pull-left" id="searchform">
26 <input class="input-xxlarge" name="search" type="text" placeholder="Search {{objectname}}" value="{{request.GET.search}}"/> 33 <div class="input-append" style="padding-right:1em">
34 <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search {{objectname}}" value="{{request.GET.search}}"/><a href="javascript:$('#search').val('');searchform.submit()" class="add-on"><i class="icon-remove"></i></a>
35 </div>
36 <input type="hidden" name="orderby" value="{{request.GET.orderby}}">
27 <input class="btn" type="submit" value="Search"/> 37 <input class="btn" type="submit" value="Search"/>
28 </form> 38 </form>
29 <div class="pull-right"> 39 <div class="pull-right">
@@ -32,7 +42,10 @@
32 <button class="btn dropdown-toggle" data-toggle="dropdown">Edit columns 42 <button class="btn dropdown-toggle" data-toggle="dropdown">Edit columns
33 <span class="caret"></span> 43 <span class="caret"></span>
34 </button> 44 </button>
35 <ul class="dropdown-menu">{% for i in tablecols %} 45<!--
46 {{tablecols|sortcols}}
47-->
48 <ul class="dropdown-menu">{% for i in tablecols|sortcols %}
36 <li> 49 <li>
37 <label class="checkbox"> 50 <label class="checkbox">
38 <input type="checkbox" class="chbxtoggle" {% if i.clclass %}id="{{i.clclass}}" value="ct{{i.name}}" {% if not i.hidden %}checked="checked"{%endif%} onchange="showhideTableColumn($(this).attr('id'), $(this).is(':checked'))" {%else%} checked disabled{% endif %}/> {{i.name}} 51 <input type="checkbox" class="chbxtoggle" {% if i.clclass %}id="{{i.clclass}}" value="ct{{i.name}}" {% if not i.hidden %}checked="checked"{%endif%} onchange="showhideTableColumn($(this).attr('id'), $(this).is(':checked'))" {%else%} checked disabled{% endif %}/> {{i.name}}
diff --git a/bitbake/lib/toaster/toastergui/templates/build.html b/bitbake/lib/toaster/toastergui/templates/build.html
index eb7e03c951..a15702463b 100644
--- a/bitbake/lib/toaster/toastergui/templates/build.html
+++ b/bitbake/lib/toaster/toastergui/templates/build.html
@@ -18,9 +18,13 @@
18 <div class="row-fluid"> 18 <div class="row-fluid">
19 <div class="lead span5"> 19 <div class="lead span5">
20 {%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%} 20 {%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%}
21 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
21 <a href="{%url 'builddashboard' build.pk%}"> 22 <a href="{%url 'builddashboard' build.pk%}">
23 {% endif %}
22 <span data-toggle="tooltip" {%if build.target_set.all.count > 1%}title="Targets: {%for target in build.target_set.all%}{{target.target}} {%endfor%}"{%endif%}>{{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|naturaltime}})</span> 24 <span data-toggle="tooltip" {%if build.target_set.all.count > 1%}title="Targets: {%for target in build.target_set.all%}{{target.target}} {%endfor%}"{%endif%}>{{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|naturaltime}})</span>
25 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
23 </a> 26 </a>
27 {% endif %}
24 </div> 28 </div>
25 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} 29 {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}
26 <div class="span2 lead"> 30 <div class="span2 lead">
@@ -34,7 +38,7 @@
34 {% endif %} 38 {% endif %}
35 </div> 39 </div>
36 <div class="lead pull-right"> 40 <div class="lead pull-right">
37 Build time: <a href="build-time.html">{{ build|timespent }}</a> 41 Build time: <a href="build-time.html">{{ build.timespent|sectohms }}</a>
38 </div> 42 </div>
39 {%endif%}{%if build.outcome == build.IN_PROGRESS %} 43 {%endif%}{%if build.outcome == build.IN_PROGRESS %}
40 <div class="span4"> 44 <div class="span4">
@@ -81,14 +85,14 @@
81 {% for build in objects %} 85 {% for build in objects %}
82 <tr class="data"> 86 <tr class="data">
83 <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></td> 87 <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></td>
84 <td class="target">{% for t in build.target_set.all %}{%if t.is_image %}<a href="{% url "target" build.id t.id %}">{% endif %}{{t.target}}{% if t.is_image %}</a>{% endif %}<br/>{% endfor %}</td> 88 <td class="target">{% for t in build.target_set.all %}{%if t.is_image %}<a href="{% url "builddashboard" build.id %}">{% endif %}{{t.target}}{% if t.is_image %}</a>{% endif %}<br/>{% endfor %}</td>
85 <td class="machine"><a href="{% url "builddashboard" build.id %}">{{build.machine}}</a></td> 89 <td class="machine"><a href="{% url "builddashboard" build.id %}">{{build.machine}}</a></td>
86 <td class="started_on"><a href="{% url "builddashboard" build.id %}">{{build.started_on}}</a></td> 90 <td class="started_on"><a href="{% url "builddashboard" build.id %}">{{build.started_on|date:"d/m/y H:i"}}</a></td>
87 <td class="completed_on"><a href="{% url "builddashboard" build.id %}">{{build.completed_on}}</a></td> 91 <td class="completed_on"><a href="{% url "builddashboard" build.id %}">{{build.completed_on|date:"d/m/y H:i"}}</a></td>
88 <td class="failed_tasks">{% query build.task_build outcome=4 order__gt=0 as exectask%}{% if exectask.count == 1 %}{{exectask.0.recipe.name}}.{{exectask.0.task_name}}{% elif exectask.count > 1%}{{exectask.count}}{%endif%}</td> 92 <td class="failed_tasks error">{% query build.task_build outcome=4 order__gt=0 as exectask%}{% if exectask.count == 1 %}{{exectask.0.recipe.name}}.{{exectask.0.task_name}}{% elif exectask.count > 1%}{{exectask.count}}{%endif%}</td>
89 <td class="errors_no">{% if build.errors_no %}<a class="errors_no" href="{% url "builddashboard" build.id %}#errors">{{build.errors_no}} error{{build.errors_no|pluralize}}</a>{%endif%}</td> 93 <td class="errors_no">{% if build.errors_no %}<a class="errors_no error" href="{% url "builddashboard" build.id %}#errors">{{build.errors_no}} error{{build.errors_no|pluralize}}</a>{%endif%}</td>
90 <td class="warnings_no">{% if build.warnings_no %}<a class="warnings_no" href="{% url "builddashboard" build.id %}#warnings">{{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a>{%endif%}</td> 94 <td class="warnings_no">{% if build.warnings_no %}<a class="warnings_no warning" href="{% url "builddashboard" build.id %}#warnings">{{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a>{%endif%}</td>
91 <td class="time"><a href="{% url "buildtime" build.id %}">{{build|timespent}}</a></td> 95 <td class="time"><a href="{% url "buildtime" build.id %}">{{build.timespent|sectohms}}</a></td>
92 <td class="log">{{build.cooker_log_path}}</td> 96 <td class="log">{{build.cooker_log_path}}</td>
93 <td class="output">{% if build.outcome == 0 %}{% for t in build.target_set.all %}{% if t.is_image %}<a href="{%url "builddashboard" build.id%}#images">{{build.image_fstypes}}</a>{% endif %}{% endfor %}{% endif %}</td> 97 <td class="output">{% if build.outcome == 0 %}{% for t in build.target_set.all %}{% if t.is_image %}<a href="{%url "builddashboard" build.id%}#images">{{build.image_fstypes}}</a>{% endif %}{% endfor %}{% endif %}</td>
94 </tr> 98 </tr>
diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
index 3b184372bf..b6506c73d0 100644
--- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html
+++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
@@ -17,13 +17,13 @@
17<div class="row-fluid span10 pull-right"> 17<div class="row-fluid span10 pull-right">
18 <div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}"> 18 <div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}">
19 <div class="row-fluid lead"> 19 <div class="row-fluid lead">
20 <span class="pull-left"><strong>{%if build.outcome == build.SUCCEEDED%}Completed{%elif build.outcome == build.FAILED%}Failed{%else%}{%endif%}</strong> {{build.completed_on|naturaltime}} with </span>{%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}{% if build.errors_no %} 20 <span class="pull-left"><strong>{%if build.outcome == build.SUCCEEDED%}Completed{%elif build.outcome == build.FAILED%}Failed{%else%}{%endif%}</strong> {{build.completed_on|date:"d/m/y H:i"}} with </span>{%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}{% if build.errors_no %}
21 <span class="span2"><i class="icon-minus-sign red"></i><strong><a href="{%url 'builddashboard' build.pk%}" class="error"> {{build.errors_no}} error{{build.errors_no|pluralize}}</a></strong></span> 21 <span class="span2"><i class="icon-minus-sign red"></i><strong><a href="{%url 'builddashboard' build.pk%}" class="error"> {{build.errors_no}} error{{build.errors_no|pluralize}}</a></strong></span>
22{% endif %} 22{% endif %}
23{% if build.warnings_no %} 23{% if build.warnings_no %}
24 <span class="span2"><i class="icon-warning-sign yellow"></i><strong><a href="{%url 'builddashboard' build.pk%}" class="warning"> {{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a></strong></span> 24 <span class="span2"><i class="icon-warning-sign yellow"></i><strong><a href="{%url 'builddashboard' build.pk%}" class="warning"> {{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a></strong></span>
25{% endif %} 25{% endif %}
26 <span class="pull-right">Build time: <a href="build-time.html">{{ build|timespent }}</a></span> 26 <span class="pull-right">Build time: <a href="build-time.html">{{ build.timespent|sectohms }}</a></span>
27{%endif%} 27{%endif%}
28 </div> 28 </div>
29 </div> 29 </div>
diff --git a/bitbake/lib/toaster/toastergui/templates/configvars.html b/bitbake/lib/toaster/toastergui/templates/configvars.html
index 8ce04b883d..ae45119f39 100644
--- a/bitbake/lib/toaster/toastergui/templates/configvars.html
+++ b/bitbake/lib/toaster/toastergui/templates/configvars.html
@@ -27,7 +27,7 @@
27 <tr class="data"> 27 <tr class="data">
28 <td class="variable">{{variable.variable_name}}</td> 28 <td class="variable">{{variable.variable_name}}</td>
29 <td class="variable_value">{{variable.variable_value}}</td> 29 <td class="variable_value">{{variable.variable_value}}</td>
30 <td class="file">{% for vh in variable.variablehistory_set.all %}{{vh.operation}} in {{vh.file_name}}:{{vh.line_number}}<br/>{%endfor%}</td> 30 <td class="file">{% for vh in variable.vhistory_set.all %}{{vh.operation}} in {{vh.file_name}}:{{vh.line_number}}<br/>{%endfor%}</td>
31 <td class="description">{% if variable.description %}{{variable.description}}{% endif %}</td> 31 <td class="description">{% if variable.description %}{{variable.description}}{% endif %}</td>
32 </tr> 32 </tr>
33{% endfor %} 33{% endfor %}
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index 24639477f6..d57a0598f9 100644
--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -29,10 +29,14 @@ register = template.Library()
29def time_difference(start_time, end_time): 29def time_difference(start_time, end_time):
30 return end_time - start_time 30 return end_time - start_time
31 31
32@register.filter(name = 'timespent') 32@register.filter(name = 'sectohms')
33def timespent(build_object): 33def sectohms(time):
34 tdsec = (build_object.completed_on - build_object.started_on).total_seconds() 34 try:
35 return "%02d:%02d:%02d" % (int(tdsec/3600), int((tdsec - tdsec/ 3600)/ 60), int(tdsec) % 60) 35 tdsec = int(time)
36 except ValueError:
37 tdsec = 0
38 hours = int(tdsec / 3600)
39 return "%02d:%02d:%02d" % (hours, int((tdsec - (hours * 3600))/ 60), int(tdsec) % 60)
36 40
37@register.assignment_tag 41@register.assignment_tag
38def query(qs, **kwargs): 42def query(qs, **kwargs):
@@ -57,3 +61,8 @@ def multiply(value, arg):
57@register.assignment_tag 61@register.assignment_tag
58def datecompute(delta, start = timezone.now()): 62def datecompute(delta, start = timezone.now()):
59 return start + timedelta(delta) 63 return start + timedelta(delta)
64
65
66@register.filter(name = 'sortcols')
67def sortcols(tablecols):
68 return sorted(tablecols, key = lambda t: t['name'])
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index a123eb5095..d54c66be81 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -103,8 +103,11 @@ def _get_filtering_query(filter_string):
103 querydict = dict(zip(keys, values)) 103 querydict = dict(zip(keys, values))
104 return reduce(lambda x, y: x & y, map(lambda x: __get_q_for_val(k, querydict[k]),[k for k in querydict])) 104 return reduce(lambda x, y: x & y, map(lambda x: __get_q_for_val(k, querydict[k]),[k for k in querydict]))
105 105
106def _get_toggle_order(request, orderkey): 106def _get_toggle_order(request, orderkey, reverse = False):
107 return "%s:-" % orderkey if request.GET.get('orderby', "") == "%s:+" % orderkey else "%s:+" % orderkey 107 if reverse:
108 return "%s:+" % orderkey if request.GET.get('orderby', "") == "%s:-" % orderkey else "%s:-" % orderkey
109 else:
110 return "%s:-" % orderkey if request.GET.get('orderby', "") == "%s:+" % orderkey else "%s:+" % orderkey
108 111
109# we check that the input comes in a valid form that we can recognize 112# we check that the input comes in a valid form that we can recognize
110def _validate_input(input, model): 113def _validate_input(input, model):
@@ -163,12 +166,12 @@ def _search_tuple(request, model):
163 166
164 167
165# returns a lazy-evaluated queryset for a filter/search/order combination 168# returns a lazy-evaluated queryset for a filter/search/order combination
166def _get_queryset(model, filter_string, search_term, ordering_string): 169def _get_queryset(model, queryset, filter_string, search_term, ordering_string):
167 if filter_string: 170 if filter_string:
168 filter_query = _get_filtering_query(filter_string) 171 filter_query = _get_filtering_query(filter_string)
169 queryset = model.objects.filter(filter_query) 172 queryset = queryset.filter(filter_query)
170 else: 173 else:
171 queryset = model.objects.all() 174 queryset = queryset.all()
172 175
173 if search_term: 176 if search_term:
174 queryset = _get_search_results(search_term, queryset, model) 177 queryset = _get_search_results(search_term, queryset, model)
@@ -196,16 +199,21 @@ def builds(request):
196 # boilerplate code that takes a request for an object type and returns a queryset 199 # boilerplate code that takes a request for an object type and returns a queryset
197 # for that object type. copypasta for all needed table searches 200 # for that object type. copypasta for all needed table searches
198 (filter_string, search_term, ordering_string) = _search_tuple(request, Build) 201 (filter_string, search_term, ordering_string) = _search_tuple(request, Build)
199 queryset = _get_queryset(Build, filter_string, search_term, ordering_string) 202 queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS)
203 queryset = _get_queryset(Build, queryset, filter_string, search_term, ordering_string)
200 204
201 # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display 205 # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display
202 build_info = _build_page_range(Paginator(queryset.exclude(outcome = Build.IN_PROGRESS), request.GET.get('count', 10)),request.GET.get('page', 1)) 206 build_info = _build_page_range(Paginator(queryset, request.GET.get('count', 10)),request.GET.get('page', 1))
203 207
204 # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) 208 # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds)
205 build_mru = Build.objects.filter(completed_on__gte=(timezone.now()-timedelta(hours=24))).order_by("-started_on")[:3] 209 build_mru = Build.objects.filter(completed_on__gte=(timezone.now()-timedelta(hours=24))).order_by("-started_on")[:3]
206 for b in [ x for x in build_mru if x.outcome == Build.IN_PROGRESS ]: 210 for b in [ x for x in build_mru if x.outcome == Build.IN_PROGRESS ]:
207 tf = Task.objects.filter(build = b) 211 tf = Task.objects.filter(build = b)
208 b.completeper = tf.exclude(order__isnull=True).count()*100/tf.count() 212 tfc = tf.count()
213 if tfc > 0:
214 b.completeper = tf.exclude(order__isnull=True).count()*100/tf.count()
215 else:
216 b.completeper = 0
209 b.eta = timezone.now() 217 b.eta = timezone.now()
210 if b.completeper > 0: 218 if b.completeper > 0:
211 b.eta += ((timezone.now() - b.started_on)*100/b.completeper) 219 b.eta += ((timezone.now() - b.started_on)*100/b.completeper)
@@ -218,6 +226,7 @@ def builds(request):
218 'mru' : build_mru, 226 'mru' : build_mru,
219 # TODO: common objects for all table views, adapt as needed 227 # TODO: common objects for all table views, adapt as needed
220 'objects' : build_info, 228 'objects' : build_info,
229 'objectname' : "builds",
221 # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns 230 # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns
222 'tablecols' : [ 231 'tablecols' : [
223 {'name': 'Outcome ', # column with a single filter 232 {'name': 'Outcome ', # column with a single filter
@@ -239,10 +248,13 @@ def builds(request):
239 }, 248 },
240 {'name': 'Machine ', 249 {'name': 'Machine ',
241 'qhelp': "The machine is the hardware for which you are building", 250 'qhelp': "The machine is the hardware for which you are building",
242 'dclass': 'span3'}, # a slightly wider column 251 'orderfield': _get_toggle_order(request, "machine"),
252 'dclass': 'span3'
253 }, # a slightly wider column
243 {'name': 'Started on ', 'clclass': 'started_on', 'hidden' : 1, # this is an unchecked box, which hides the column 254 {'name': 'Started on ', 'clclass': 'started_on', 'hidden' : 1, # this is an unchecked box, which hides the column
244 'qhelp': "The date and time you started the build", 255 'qhelp': "The date and time you started the build",
245 'filter' : {'class' : 'started_on', 'label': 'Show only builds started', 'options' : { 256 'orderfield': _get_toggle_order(request, "started_on", True),
257 'filter' : {'class' : 'started_on', 'label': 'Show only builds started', 'options' : {
246 'Today' : 'started_on__gte:'+timezone.now().strftime("%Y-%m-%d"), 258 'Today' : 'started_on__gte:'+timezone.now().strftime("%Y-%m-%d"),
247 'Yesterday' : 'started_on__gte:'+(timezone.now()-timedelta(hours=24)).strftime("%Y-%m-%d"), 259 'Yesterday' : 'started_on__gte:'+(timezone.now()-timedelta(hours=24)).strftime("%Y-%m-%d"),
248 'Within one week' : 'started_on__gte:'+(timezone.now()-timedelta(days=7)).strftime("%Y-%m-%d"), 260 'Within one week' : 'started_on__gte:'+(timezone.now()-timedelta(days=7)).strftime("%Y-%m-%d"),
@@ -250,7 +262,7 @@ def builds(request):
250 }, 262 },
251 {'name': 'Completed on ', 263 {'name': 'Completed on ',
252 'qhelp': "The date and time the build finished", 264 'qhelp': "The date and time the build finished",
253 'orderfield': _get_toggle_order(request, "completed_on"), 265 'orderfield': _get_toggle_order(request, "completed_on", True),
254 'filter' : {'class' : 'completed_on', 'label': 'Show only builds completed', 'options' : { 266 'filter' : {'class' : 'completed_on', 'label': 'Show only builds completed', 'options' : {
255 'Today' : 'completed_on__gte:'+timezone.now().strftime("%Y-%m-%d"), 267 'Today' : 'completed_on__gte:'+timezone.now().strftime("%Y-%m-%d"),
256 'Yesterday' : 'completed_on__gte:'+(timezone.now()-timedelta(hours=24)).strftime("%Y-%m-%d"), 268 'Yesterday' : 'completed_on__gte:'+(timezone.now()-timedelta(hours=24)).strftime("%Y-%m-%d"),
@@ -266,7 +278,7 @@ def builds(request):
266 }, 278 },
267 {'name': 'Errors ', 'clclass': 'errors_no', 279 {'name': 'Errors ', 'clclass': 'errors_no',
268 'qhelp': "How many errors were encountered during the build (if any)", 280 'qhelp': "How many errors were encountered during the build (if any)",
269 'orderfield': _get_toggle_order(request, "errors_no"), 281 'orderfield': _get_toggle_order(request, "errors_no", True),
270 'filter' : {'class' : 'errors_no', 'label': 'Show only ', 'options' : { 282 'filter' : {'class' : 'errors_no', 'label': 'Show only ', 'options' : {
271 'Builds with errors' : 'errors_no__gte:1', 283 'Builds with errors' : 'errors_no__gte:1',
272 'Builds without errors' : 'errors_no:0', 284 'Builds without errors' : 'errors_no:0',
@@ -274,20 +286,25 @@ def builds(request):
274 }, 286 },
275 {'name': 'Warnings', 'clclass': 'warnings_no', 287 {'name': 'Warnings', 'clclass': 'warnings_no',
276 'qhelp': "How many warnigns were encountered during the build (if any)", 288 'qhelp': "How many warnigns were encountered during the build (if any)",
277 'orderfield': _get_toggle_order(request, "warnings_no"), 289 'orderfield': _get_toggle_order(request, "warnings_no", True),
278 'filter' : {'class' : 'warnings_no', 'label': 'Show only ', 'options' : { 290 'filter' : {'class' : 'warnings_no', 'label': 'Show only ', 'options' : {
279 'Builds with warnings' : 'warnings_no__gte:1', 291 'Builds with warnings' : 'warnings_no__gte:1',
280 'Builds without warnings' : 'warnings_no:0', 292 'Builds without warnings' : 'warnings_no:0',
281 }} 293 }}
282 }, 294 },
283 {'name': 'Time ', 'clclass': 'time', 'hidden' : 1, 295 {'name': 'Time ', 'clclass': 'time', 'hidden' : 1,
284 'qhelp': "How long it took the build to finish",}, 296 'qhelp': "How long it took the build to finish",
297 'orderfield': _get_toggle_order(request, "timespent", True),
298 },
285 {'name': 'Log', 299 {'name': 'Log',
286 'dclass': "span4", 300 'dclass': "span4",
287 'qhelp': "The location in disk of the build main log file", 301 'qhelp': "The location in disk of the build main log file",
288 'clclass': 'log', 'hidden': 1}, 302 'clclass': 'log', 'hidden': 1
303 },
289 {'name': 'Output', 'clclass': 'output', 304 {'name': 'Output', 'clclass': 'output',
290 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory"}, 305 'qhelp': "The root file system types produced by the build. You can find them in your <code>/build/tmp/deploy/images/</code> directory",
306 'orderfield': _get_toggle_order(request, "image_fstypes")
307 },
291 ] 308 ]
292 } 309 }
293 310
@@ -368,9 +385,10 @@ def tasks(request, build_id):
368 if retval: 385 if retval:
369 return _redirect_parameters( 'tasks', request.GET, mandatory_parameters, build_id = build_id) 386 return _redirect_parameters( 'tasks', request.GET, mandatory_parameters, build_id = build_id)
370 (filter_string, search_term, ordering_string) = _search_tuple(request, Task) 387 (filter_string, search_term, ordering_string) = _search_tuple(request, Task)
371 queryset = _get_queryset(Task, filter_string, search_term, ordering_string) 388 queryset = Task.objects.filter(build=build_id, order__gt=0)
389 queryset = _get_queryset(Task, queryset, filter_string, search_term, ordering_string)
372 390
373 tasks = _build_page_range(Paginator(queryset.filter(build=build_id, order__gt=0), request.GET.get('count', 100)),request.GET.get('page', 1)) 391 tasks = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
374 392
375 for t in tasks: 393 for t in tasks:
376 if t.outcome == Task.OUTCOME_COVERED: 394 if t.outcome == Task.OUTCOME_COVERED:
@@ -387,9 +405,10 @@ def recipes(request, build_id):
387 if retval: 405 if retval:
388 return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id) 406 return _redirect_parameters( 'recipes', request.GET, mandatory_parameters, build_id = build_id)
389 (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe) 407 (filter_string, search_term, ordering_string) = _search_tuple(request, Recipe)
390 queryset = _get_queryset(Recipe, filter_string, search_term, ordering_string) 408 queryset = Recipe.objects.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id))
409 queryset = _get_queryset(Recipe, queryset, filter_string, search_term, ordering_string)
391 410
392 recipes = _build_page_range(Paginator(queryset.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id)), request.GET.get('count', 100)),request.GET.get('page', 1)) 411 recipes = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
393 412
394 context = {'build': Build.objects.filter(pk=build_id)[0], 'objects': recipes, } 413 context = {'build': Build.objects.filter(pk=build_id)[0], 'objects': recipes, }
395 414
@@ -410,9 +429,10 @@ def configvars(request, build_id):
410 return _redirect_parameters( 'configvars', request.GET, mandatory_parameters, build_id = build_id) 429 return _redirect_parameters( 'configvars', request.GET, mandatory_parameters, build_id = build_id)
411 430
412 (filter_string, search_term, ordering_string) = _search_tuple(request, Variable) 431 (filter_string, search_term, ordering_string) = _search_tuple(request, Variable)
413 queryset = _get_queryset(Variable, filter_string, search_term, ordering_string) 432 queryset = Variable.objects.filter(build=build_id)
433 queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string)
414 434
415 variables = _build_page_range(Paginator(queryset.filter(build=build_id), request.GET.get('count', 50)), request.GET.get('page', 1)) 435 variables = _build_page_range(Paginator(queryset, request.GET.get('count', 50)), request.GET.get('page', 1))
416 436
417 context = { 437 context = {
418 'build': Build.objects.filter(pk=build_id)[0], 438 'build': Build.objects.filter(pk=build_id)[0],
@@ -492,9 +512,10 @@ def bpackage(request, build_id):
492 if retval: 512 if retval:
493 return _redirect_parameters( 'packages', request.GET, mandatory_parameters, build_id = build_id) 513 return _redirect_parameters( 'packages', request.GET, mandatory_parameters, build_id = build_id)
494 (filter_string, search_term, ordering_string) = _search_tuple(request, Package) 514 (filter_string, search_term, ordering_string) = _search_tuple(request, Package)
495 queryset = _get_queryset(Package, filter_string, search_term, ordering_string) 515 queryset = Package.objects.filter(build = build_id)
516 queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string)
496 517
497 packages = _build_page_range(Paginator(queryset.filter(build = build_id), request.GET.get('count', 100)),request.GET.get('page', 1)) 518 packages = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
498 519
499 context = {'build': Build.objects.filter(pk=build_id)[0], 'objects' : packages} 520 context = {'build': Build.objects.filter(pk=build_id)[0], 'objects' : packages}
500 return render(request, template, context) 521 return render(request, template, context)