summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRavi Chintakunta <ravi.chintakunta@timesys.com>2014-01-14 14:06:38 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-27 21:01:06 +0000
commit05a684f6e590a703ad45eb0c74c65e2ff773781e (patch)
tree1bbcfa1933bc475971389d55e6b15b07d4a3c0ab /bitbake
parent87776ca32eeede85086c31ae4036d8e1de7fe1e1 (diff)
downloadpoky-05a684f6e590a703ad45eb0c74c65e2ff773781e.tar.gz
bitbake: toaster: Added custom filter tags for use in templates.
- custom filter tag to return the css class based on the task execution status and execution outcome - custom filters for active filter icon and tooltip text - custom filter for displaying blank for None, zero, '0' and 'Not Applicable' (Bitbake rev: 1e9253984e6f107c6eed1c3b9df3a444076e2989) Signed-off-by: Ravi Chintakunta <ravi.chintakunta@timesys.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index d57a0598f9..5105be48d2 100644
--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -66,3 +66,38 @@ def datecompute(delta, start = timezone.now()):
66@register.filter(name = 'sortcols') 66@register.filter(name = 'sortcols')
67def sortcols(tablecols): 67def sortcols(tablecols):
68 return sorted(tablecols, key = lambda t: t['name']) 68 return sorted(tablecols, key = lambda t: t['name'])
69
70@register.filter
71def task_color(task_object):
72 """ Return css class depending on Task execution status and execution outcome
73 """
74 if not task_object.task_executed:
75 return 'class=muted'
76 elif task_object.get_outcome_display == 'Failed':
77 return 'class=error'
78 else:
79 return ''
80
81@register.filter
82def filtered_icon(options, filter):
83 """Returns btn-primary if the filter matches one of the filter options
84 """
85 for option in options:
86 if filter == option[1]:
87 return "btn-primary"
88 return ""
89
90@register.filter
91def filtered_tooltip(options, filter):
92 """Returns tooltip for the filter icon if the filter matches one of the filter options
93 """
94 for option in options:
95 if filter == option[1]:
96 return "Showing only %s"%option[0]
97 return ""
98
99@register.filter
100def format_none_and_zero(value):
101 """Return empty string if the value is None, zero or Not Applicable
102 """
103 return "" if (not value) or (value == 0) or (value == "0") or (value == 'Not Applicable') else value