diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/widgets.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/widgets.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index 8790340db9..47de30d631 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py | |||
@@ -183,13 +183,13 @@ class ToasterTable(TemplateView): | |||
183 | 183 | ||
184 | return template.render(context) | 184 | return template.render(context) |
185 | 185 | ||
186 | def apply_filter(self, filters, **kwargs): | 186 | def apply_filter(self, filters, filter_value, **kwargs): |
187 | """ | 187 | """ |
188 | Apply a filter submitted in the querystring to the ToasterTable | 188 | Apply a filter submitted in the querystring to the ToasterTable |
189 | 189 | ||
190 | filters: (str) in the format: | 190 | filters: (str) in the format: |
191 | '<filter name>:<action name>!<action params>' | 191 | '<filter name>:<action name>' |
192 | where <action params> is optional | 192 | filter_value: (str) parameters to pass to the named filter |
193 | 193 | ||
194 | <filter name> and <action name> are used to look up the correct filter | 194 | <filter name> and <action name> are used to look up the correct filter |
195 | in the ToasterTable's filter map; the <action params> are set on | 195 | in the ToasterTable's filter map; the <action params> are set on |
@@ -199,15 +199,8 @@ class ToasterTable(TemplateView): | |||
199 | self.setup_filters(**kwargs) | 199 | self.setup_filters(**kwargs) |
200 | 200 | ||
201 | try: | 201 | try: |
202 | filter_name, action_name_and_params = filters.split(':') | 202 | filter_name, action_name = filters.split(':') |
203 | 203 | action_params = urllib.unquote_plus(filter_value) | |
204 | action_name = None | ||
205 | action_params = None | ||
206 | if re.search('!', action_name_and_params): | ||
207 | action_name, action_params = action_name_and_params.split('!') | ||
208 | action_params = urllib.unquote_plus(action_params) | ||
209 | else: | ||
210 | action_name = action_name_and_params | ||
211 | except ValueError: | 204 | except ValueError: |
212 | return | 205 | return |
213 | 206 | ||
@@ -217,7 +210,7 @@ class ToasterTable(TemplateView): | |||
217 | try: | 210 | try: |
218 | table_filter = self.filter_map.get_filter(filter_name) | 211 | table_filter = self.filter_map.get_filter(filter_name) |
219 | action = table_filter.get_action(action_name) | 212 | action = table_filter.get_action(action_name) |
220 | action.set_params(action_params) | 213 | action.set_filter_params(action_params) |
221 | self.queryset = action.filter(self.queryset) | 214 | self.queryset = action.filter(self.queryset) |
222 | except KeyError: | 215 | except KeyError: |
223 | # pass it to the user - programming error here | 216 | # pass it to the user - programming error here |
@@ -247,13 +240,20 @@ class ToasterTable(TemplateView): | |||
247 | 240 | ||
248 | 241 | ||
249 | def get_data(self, request, **kwargs): | 242 | def get_data(self, request, **kwargs): |
250 | """Returns the data for the page requested with the specified | 243 | """ |
251 | parameters applied""" | 244 | Returns the data for the page requested with the specified |
245 | parameters applied | ||
246 | |||
247 | filters: filter and action name, e.g. "outcome:build_succeeded" | ||
248 | filter_value: value to pass to the named filter+action, e.g. "on" | ||
249 | (for a toggle filter) or "2015-12-11,2015-12-12" (for a date range filter) | ||
250 | """ | ||
252 | 251 | ||
253 | page_num = request.GET.get("page", 1) | 252 | page_num = request.GET.get("page", 1) |
254 | limit = request.GET.get("limit", 10) | 253 | limit = request.GET.get("limit", 10) |
255 | search = request.GET.get("search", None) | 254 | search = request.GET.get("search", None) |
256 | filters = request.GET.get("filter", None) | 255 | filters = request.GET.get("filter", None) |
256 | filter_value = request.GET.get("filter_value", "on") | ||
257 | orderby = request.GET.get("orderby", None) | 257 | orderby = request.GET.get("orderby", None) |
258 | nocache = request.GET.get("nocache", None) | 258 | nocache = request.GET.get("nocache", None) |
259 | 259 | ||
@@ -285,7 +285,7 @@ class ToasterTable(TemplateView): | |||
285 | if search: | 285 | if search: |
286 | self.apply_search(search) | 286 | self.apply_search(search) |
287 | if filters: | 287 | if filters: |
288 | self.apply_filter(filters, **kwargs) | 288 | self.apply_filter(filters, filter_value, **kwargs) |
289 | if orderby: | 289 | if orderby: |
290 | self.apply_orderby(orderby) | 290 | self.apply_orderby(orderby) |
291 | 291 | ||