summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-01-16 12:22:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-27 21:01:04 +0000
commitb0b1acbe623c1c126af2abc1cc332d993dcaf15c (patch)
tree594c00eebae09944d4f52f23d6b36cbe09ff5640 /bitbake/lib/toaster/toastergui/templatetags/projecttags.py
parentd27c7f26d39b66c41c1b09d6b5875e957045355d (diff)
downloadpoky-b0b1acbe623c1c126af2abc1cc332d993dcaf15c.tar.gz
bitbake: toaster: Toaster GUI Build and Dashboard pages fixes
THis is a large set of fixes for the generic table, Build and Dashboard pages. Among the fixes: * the table remembers which columns to show across refreshes, based on saving the settings in a cookie * added column timespent for a build which is a denormalization of the completed_on - started_on information due to limits in computing datetime differences in the SQL engine * fixed formatting of the time differences * various sorting header links fixed * correct error and warning CSS classes applied to the respective rows * fixes multiple divide-by-zero error in displaying duration estimations (Bitbake rev: 61e3dee55ac577fce1c0ae0fe7e0d3cf644e8ae6) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py17
1 files changed, 13 insertions, 4 deletions
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'])