diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-01-15 13:00:54 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-15 16:28:56 +0000 |
commit | f17cfa009e58833e0e55884fa04de8abd522b6bc (patch) | |
tree | 0606a520326cac56612e833a532fa5bcba0161d8 /lib/toaster/toastergui/tables.py | |
parent | d47c32e88c2d4a423f4d94d49759e557f425a539 (diff) | |
download | bitbake-f17cfa009e58833e0e55884fa04de8abd522b6bc.tar.gz |
toastergui: implement "today" and "yesterday" filters
Add the "today" and "yesterday" filters to the started_on
and completed_on columns in the builds table.
During this work, some minor adjustments were made to the
behaviour of the builds table:
* Amend filter action variable names so they're more succinct.
* Retain order in which actions are added to a filter, as this
ordering is used in the UI when displaying the filter actions.
* Always show the table chrome, otherwise it's not possible
to edit the columns shown until there are 10 or more results.
* Because date range searches may return no results, make sure
that the search bar and "show all results" link are visible
when the query returns no results.
[YOCTO #8738]
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 'lib/toaster/toastergui/tables.py')
-rw-r--r-- | lib/toaster/toastergui/tables.py | 87 |
1 files changed, 59 insertions, 28 deletions
diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py index 06ced52eb..58abe36b0 100644 --- a/lib/toaster/toastergui/tables.py +++ b/lib/toaster/toastergui/tables.py @@ -32,6 +32,7 @@ import itertools from toastergui.tablefilter import TableFilter from toastergui.tablefilter import TableFilterActionToggle from toastergui.tablefilter import TableFilterActionDateRange +from toastergui.tablefilter import TableFilterActionDay class ProjectFilters(object): def __init__(self, project_layers): @@ -65,20 +66,20 @@ class LayersTable(ToasterTable): criteria = Q(projectlayer__in=self.project_layers) - in_project_filter_action = TableFilterActionToggle( + in_project_action = TableFilterActionToggle( "in_project", "Layers added to this project", QuerysetFilter(criteria) ) - not_in_project_filter_action = TableFilterActionToggle( + not_in_project_action = TableFilterActionToggle( "not_in_project", "Layers not added to this project", QuerysetFilter(~criteria) ) - in_current_project_filter.add_action(in_project_filter_action) - in_current_project_filter.add_action(not_in_project_filter_action) + in_current_project_filter.add_action(in_project_action) + in_current_project_filter.add_action(not_in_project_action) self.add_filter(in_current_project_filter) def setup_queryset(self, *args, **kwargs): @@ -221,20 +222,20 @@ class MachinesTable(ToasterTable): "Filter by project machines" ) - in_project_filter_action = TableFilterActionToggle( + in_project_action = TableFilterActionToggle( "in_project", "Machines provided by layers added to this project", project_filters.in_project ) - not_in_project_filter_action = TableFilterActionToggle( + not_in_project_action = TableFilterActionToggle( "not_in_project", "Machines provided by layers not added to this project", project_filters.not_in_project ) - in_current_project_filter.add_action(in_project_filter_action) - in_current_project_filter.add_action(not_in_project_filter_action) + in_current_project_filter.add_action(in_project_action) + in_current_project_filter.add_action(not_in_project_action) self.add_filter(in_current_project_filter) def setup_queryset(self, *args, **kwargs): @@ -354,20 +355,20 @@ class RecipesTable(ToasterTable): 'Filter by project recipes' ) - in_project_filter_action = TableFilterActionToggle( + in_project_action = TableFilterActionToggle( 'in_project', 'Recipes provided by layers added to this project', project_filters.in_project ) - not_in_project_filter_action = TableFilterActionToggle( + not_in_project_action = TableFilterActionToggle( 'not_in_project', 'Recipes provided by layers not added to this project', project_filters.not_in_project ) - table_filter.add_action(in_project_filter_action) - table_filter.add_action(not_in_project_filter_action) + table_filter.add_action(in_project_action) + table_filter.add_action(not_in_project_action) self.add_filter(table_filter) def setup_queryset(self, *args, **kwargs): @@ -1137,20 +1138,20 @@ class BuildsTable(ToasterTable): 'Filter builds by outcome' ) - successful_builds_filter_action = TableFilterActionToggle( + successful_builds_action = TableFilterActionToggle( 'successful_builds', 'Successful builds', QuerysetFilter(Q(outcome=Build.SUCCEEDED)) ) - failed_builds_filter_action = TableFilterActionToggle( + failed_builds_action = TableFilterActionToggle( 'failed_builds', 'Failed builds', QuerysetFilter(Q(outcome=Build.FAILED)) ) - outcome_filter.add_action(successful_builds_filter_action) - outcome_filter.add_action(failed_builds_filter_action) + outcome_filter.add_action(successful_builds_action) + outcome_filter.add_action(failed_builds_action) self.add_filter(outcome_filter) # started on @@ -1159,14 +1160,29 @@ class BuildsTable(ToasterTable): 'Filter by date when build was started' ) - by_started_date_range_filter_action = TableFilterActionDateRange( + started_today_action = TableFilterActionDay( + 'today', + 'Today\'s builds', + 'started_on', + 'today' + ) + + started_yesterday_action = TableFilterActionDay( + 'yesterday', + 'Yesterday\'s builds', + 'started_on', + 'yesterday' + ) + + by_started_date_range_action = TableFilterActionDateRange( 'date_range', 'Build date range', - 'started_on', - QuerysetFilter() + 'started_on' ) - started_on_filter.add_action(by_started_date_range_filter_action) + started_on_filter.add_action(started_today_action) + started_on_filter.add_action(started_yesterday_action) + started_on_filter.add_action(by_started_date_range_action) self.add_filter(started_on_filter) # completed on @@ -1175,14 +1191,29 @@ class BuildsTable(ToasterTable): 'Filter by date when build was completed' ) - by_completed_date_range_filter_action = TableFilterActionDateRange( + completed_today_action = TableFilterActionDay( + 'today', + 'Today\'s builds', + 'completed_on', + 'today' + ) + + completed_yesterday_action = TableFilterActionDay( + 'yesterday', + 'Yesterday\'s builds', + 'completed_on', + 'yesterday' + ) + + by_completed_date_range_action = TableFilterActionDateRange( 'date_range', 'Build date range', - 'completed_on', - QuerysetFilter() + 'completed_on' ) - completed_on_filter.add_action(by_completed_date_range_filter_action) + completed_on_filter.add_action(completed_today_action) + completed_on_filter.add_action(completed_yesterday_action) + completed_on_filter.add_action(by_completed_date_range_action) self.add_filter(completed_on_filter) # failed tasks @@ -1193,18 +1224,18 @@ class BuildsTable(ToasterTable): criteria = Q(task_build__outcome=Task.OUTCOME_FAILED) - with_failed_tasks_filter_action = TableFilterActionToggle( + with_failed_tasks_action = TableFilterActionToggle( 'with_failed_tasks', 'Builds with failed tasks', QuerysetFilter(criteria) ) - without_failed_tasks_filter_action = TableFilterActionToggle( + without_failed_tasks_action = TableFilterActionToggle( 'without_failed_tasks', 'Builds without failed tasks', QuerysetFilter(~criteria) ) - failed_tasks_filter.add_action(with_failed_tasks_filter_action) - failed_tasks_filter.add_action(without_failed_tasks_filter_action) + failed_tasks_filter.add_action(with_failed_tasks_action) + failed_tasks_filter.add_action(without_failed_tasks_action) self.add_filter(failed_tasks_filter) |