aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/widgets.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-01-15 13:00:53 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-15 16:30:00 +0000
commitf8d383d87f0b9d4a4c9ae7b1a6c8ceebf90ef9b0 (patch)
treecda7dc3eb23a5b6a97241c965bbd9b0dcddc02eb /bitbake/lib/toaster/toastergui/widgets.py
parentb929889cdd4a36846f9569d89fabd9987e94b39e (diff)
downloadopenembedded-core-contrib-f8d383d87f0b9d4a4c9ae7b1a6c8ceebf90ef9b0.tar.gz
bitbake: toastergui: implement date range filters for builds
Implement the completed_on and started_on filtering for builds. Also separate the name of a filter ("filter" in the querystring) from its value ("filter_value" in the querystring). This enables filtering to be defined in the querystring more intuitively, and also makes it easier to add other types of filter (e.g. by day). [YOCTO #8738] (Bitbake rev: d47c32e88c2d4a423f4d94d49759e557f425a539) 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.py32
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):
return template.render(context)
- def apply_filter(self, filters, **kwargs):
+ def apply_filter(self, filters, filter_value, **kwargs):
"""
Apply a filter submitted in the querystring to the ToasterTable
filters: (str) in the format:
- '<filter name>:<action name>!<action params>'
- where <action params> is optional
+ '<filter name>:<action name>'
+ filter_value: (str) parameters to pass to the named filter
<filter name> and <action name> are used to look up the correct filter
in the ToasterTable's filter map; the <action params> are set on
@@ -199,15 +199,8 @@ class ToasterTable(TemplateView):
self.setup_filters(**kwargs)
try:
- filter_name, action_name_and_params = filters.split(':')
-
- action_name = None
- action_params = None
- if re.search('!', action_name_and_params):
- action_name, action_params = action_name_and_params.split('!')
- action_params = urllib.unquote_plus(action_params)
- else:
- action_name = action_name_and_params
+ filter_name, action_name = filters.split(':')
+ action_params = urllib.unquote_plus(filter_value)
except ValueError:
return
@@ -217,7 +210,7 @@ class ToasterTable(TemplateView):
try:
table_filter = self.filter_map.get_filter(filter_name)
action = table_filter.get_action(action_name)
- action.set_params(action_params)
+ action.set_filter_params(action_params)
self.queryset = action.filter(self.queryset)
except KeyError:
# pass it to the user - programming error here
@@ -247,13 +240,20 @@ class ToasterTable(TemplateView):
def get_data(self, request, **kwargs):
- """Returns the data for the page requested with the specified
- parameters applied"""
+ """
+ Returns the data for the page requested with the specified
+ parameters applied
+
+ filters: filter and action name, e.g. "outcome:build_succeeded"
+ filter_value: value to pass to the named filter+action, e.g. "on"
+ (for a toggle filter) or "2015-12-11,2015-12-12" (for a date range filter)
+ """
page_num = request.GET.get("page", 1)
limit = request.GET.get("limit", 10)
search = request.GET.get("search", None)
filters = request.GET.get("filter", None)
+ filter_value = request.GET.get("filter_value", "on")
orderby = request.GET.get("orderby", None)
nocache = request.GET.get("nocache", None)
@@ -285,7 +285,7 @@ class ToasterTable(TemplateView):
if search:
self.apply_search(search)
if filters:
- self.apply_filter(filters, **kwargs)
+ self.apply_filter(filters, filter_value, **kwargs)
if orderby:
self.apply_orderby(orderby)