summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/widgets.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-01-15 13:00:49 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-15 16:29:59 +0000
commit294579b531d5a96a17aa863554e71f4680d35812 (patch)
treed42f10f98cb26d233860eec59cbdf0799d53ae28 /bitbake/lib/toaster/toastergui/widgets.py
parent6c12ca7f932d2fa06c2f2e2e6c98c76bb4d487d3 (diff)
downloadpoky-294579b531d5a96a17aa863554e71f4680d35812.tar.gz
bitbake: toastergui: convert all builds page to ToasterTable
For better long-term maintainability, use ToasterTable instead of Django template and view code to display the all builds page. NB the builds.html template has been left in, as this will otherwise cause conflicts when merging the new theme. [YOCTO #8738] (Bitbake rev: e0590fc8103afeb4c5e613a826057555c8193d59) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/widgets.py')
-rw-r--r--bitbake/lib/toaster/toastergui/widgets.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index 6bb388936c..71b29eaa1e 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -32,6 +32,7 @@ from django.template import Context, Template
32from django.core.serializers.json import DjangoJSONEncoder 32from django.core.serializers.json import DjangoJSONEncoder
33from django.core.exceptions import FieldError 33from django.core.exceptions import FieldError
34from django.conf.urls import url, patterns 34from django.conf.urls import url, patterns
35from toastergui.querysetfilter import QuerysetFilter
35 36
36import types 37import types
37import json 38import json
@@ -113,7 +114,8 @@ class ToasterTable(TemplateView):
113 cls=DjangoJSONEncoder) 114 cls=DjangoJSONEncoder)
114 else: 115 else:
115 for actions in self.filters[name]['filter_actions']: 116 for actions in self.filters[name]['filter_actions']:
116 actions['count'] = self.filter_actions[actions['name']](count_only=True) 117 queryset_filter = self.filter_actions[actions['name']]
118 actions['count'] = queryset_filter.count(self.queryset)
117 119
118 # Add the "All" items filter action 120 # Add the "All" items filter action
119 self.filters[name]['filter_actions'].insert(0, { 121 self.filters[name]['filter_actions'].insert(0, {
@@ -151,15 +153,18 @@ class ToasterTable(TemplateView):
151 'filter_actions' : filter_actions, 153 'filter_actions' : filter_actions,
152 } 154 }
153 155
154 def make_filter_action(self, name, title, action_function): 156 def make_filter_action(self, name, title, queryset_filter):
155 """ Utility to make a filter_action """ 157 """
158 Utility to make a filter_action; queryset_filter is an instance
159 of QuerysetFilter or a function
160 """
156 161
157 action = { 162 action = {
158 'title' : title, 163 'title' : title,
159 'name' : name, 164 'name' : name,
160 } 165 }
161 166
162 self.filter_actions[name] = action_function 167 self.filter_actions[name] = queryset_filter
163 168
164 return action 169 return action
165 170
@@ -222,7 +227,8 @@ class ToasterTable(TemplateView):
222 return 227 return
223 228
224 try: 229 try:
225 self.filter_actions[filter_action]() 230 queryset_filter = self.filter_actions[filter_action]
231 self.queryset = queryset_filter.filter(self.queryset)
226 except KeyError: 232 except KeyError:
227 # pass it to the user - programming error here 233 # pass it to the user - programming error here
228 raise 234 raise