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:30:00 +0000 |
commit | 33b011c1589519db8176c9f5a4abb540698902e6 (patch) | |
tree | 104367160098dffb4c05c2120db1c2c8ef470449 /bitbake/lib/toaster/toastergui/tables.py | |
parent | f8d383d87f0b9d4a4c9ae7b1a6c8ceebf90ef9b0 (diff) | |
download | poky-33b011c1589519db8176c9f5a4abb540698902e6.tar.gz |
bitbake: 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]
(Bitbake rev: f17cfa009e58833e0e55884fa04de8abd522b6bc)
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/tables.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 87 |
1 files changed, 59 insertions, 28 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 06ced52eb1..58abe36b05 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
@@ -32,6 +32,7 @@ import itertools | |||
32 | from toastergui.tablefilter import TableFilter | 32 | from toastergui.tablefilter import TableFilter |
33 | from toastergui.tablefilter import TableFilterActionToggle | 33 | from toastergui.tablefilter import TableFilterActionToggle |
34 | from toastergui.tablefilter import TableFilterActionDateRange | 34 | from toastergui.tablefilter import TableFilterActionDateRange |
35 | from toastergui.tablefilter import TableFilterActionDay | ||
35 | 36 | ||
36 | class ProjectFilters(object): | 37 | class ProjectFilters(object): |
37 | def __init__(self, project_layers): | 38 | def __init__(self, project_layers): |
@@ -65,20 +66,20 @@ class LayersTable(ToasterTable): | |||
65 | 66 | ||
66 | criteria = Q(projectlayer__in=self.project_layers) | 67 | criteria = Q(projectlayer__in=self.project_layers) |
67 | 68 | ||
68 | in_project_filter_action = TableFilterActionToggle( | 69 | in_project_action = TableFilterActionToggle( |
69 | "in_project", | 70 | "in_project", |
70 | "Layers added to this project", | 71 | "Layers added to this project", |
71 | QuerysetFilter(criteria) | 72 | QuerysetFilter(criteria) |
72 | ) | 73 | ) |
73 | 74 | ||
74 | not_in_project_filter_action = TableFilterActionToggle( | 75 | not_in_project_action = TableFilterActionToggle( |
75 | "not_in_project", | 76 | "not_in_project", |
76 | "Layers not added to this project", | 77 | "Layers not added to this project", |
77 | QuerysetFilter(~criteria) | 78 | QuerysetFilter(~criteria) |
78 | ) | 79 | ) |
79 | 80 | ||
80 | in_current_project_filter.add_action(in_project_filter_action) | 81 | in_current_project_filter.add_action(in_project_action) |
81 | in_current_project_filter.add_action(not_in_project_filter_action) | 82 | in_current_project_filter.add_action(not_in_project_action) |
82 | self.add_filter(in_current_project_filter) | 83 | self.add_filter(in_current_project_filter) |
83 | 84 | ||
84 | def setup_queryset(self, *args, **kwargs): | 85 | def setup_queryset(self, *args, **kwargs): |
@@ -221,20 +222,20 @@ class MachinesTable(ToasterTable): | |||
221 | "Filter by project machines" | 222 | "Filter by project machines" |
222 | ) | 223 | ) |
223 | 224 | ||
224 | in_project_filter_action = TableFilterActionToggle( | 225 | in_project_action = TableFilterActionToggle( |
225 | "in_project", | 226 | "in_project", |
226 | "Machines provided by layers added to this project", | 227 | "Machines provided by layers added to this project", |
227 | project_filters.in_project | 228 | project_filters.in_project |
228 | ) | 229 | ) |
229 | 230 | ||
230 | not_in_project_filter_action = TableFilterActionToggle( | 231 | not_in_project_action = TableFilterActionToggle( |
231 | "not_in_project", | 232 | "not_in_project", |
232 | "Machines provided by layers not added to this project", | 233 | "Machines provided by layers not added to this project", |
233 | project_filters.not_in_project | 234 | project_filters.not_in_project |
234 | ) | 235 | ) |
235 | 236 | ||
236 | in_current_project_filter.add_action(in_project_filter_action) | 237 | in_current_project_filter.add_action(in_project_action) |
237 | in_current_project_filter.add_action(not_in_project_filter_action) | 238 | in_current_project_filter.add_action(not_in_project_action) |
238 | self.add_filter(in_current_project_filter) | 239 | self.add_filter(in_current_project_filter) |
239 | 240 | ||
240 | def setup_queryset(self, *args, **kwargs): | 241 | def setup_queryset(self, *args, **kwargs): |
@@ -354,20 +355,20 @@ class RecipesTable(ToasterTable): | |||
354 | 'Filter by project recipes' | 355 | 'Filter by project recipes' |
355 | ) | 356 | ) |
356 | 357 | ||
357 | in_project_filter_action = TableFilterActionToggle( | 358 | in_project_action = TableFilterActionToggle( |
358 | 'in_project', | 359 | 'in_project', |
359 | 'Recipes provided by layers added to this project', | 360 | 'Recipes provided by layers added to this project', |
360 | project_filters.in_project | 361 | project_filters.in_project |
361 | ) | 362 | ) |
362 | 363 | ||
363 | not_in_project_filter_action = TableFilterActionToggle( | 364 | not_in_project_action = TableFilterActionToggle( |
364 | 'not_in_project', | 365 | 'not_in_project', |
365 | 'Recipes provided by layers not added to this project', | 366 | 'Recipes provided by layers not added to this project', |
366 | project_filters.not_in_project | 367 | project_filters.not_in_project |
367 | ) | 368 | ) |
368 | 369 | ||
369 | table_filter.add_action(in_project_filter_action) | 370 | table_filter.add_action(in_project_action) |
370 | table_filter.add_action(not_in_project_filter_action) | 371 | table_filter.add_action(not_in_project_action) |
371 | self.add_filter(table_filter) | 372 | self.add_filter(table_filter) |
372 | 373 | ||
373 | def setup_queryset(self, *args, **kwargs): | 374 | def setup_queryset(self, *args, **kwargs): |
@@ -1137,20 +1138,20 @@ class BuildsTable(ToasterTable): | |||
1137 | 'Filter builds by outcome' | 1138 | 'Filter builds by outcome' |
1138 | ) | 1139 | ) |
1139 | 1140 | ||
1140 | successful_builds_filter_action = TableFilterActionToggle( | 1141 | successful_builds_action = TableFilterActionToggle( |
1141 | 'successful_builds', | 1142 | 'successful_builds', |
1142 | 'Successful builds', | 1143 | 'Successful builds', |
1143 | QuerysetFilter(Q(outcome=Build.SUCCEEDED)) | 1144 | QuerysetFilter(Q(outcome=Build.SUCCEEDED)) |
1144 | ) | 1145 | ) |
1145 | 1146 | ||
1146 | failed_builds_filter_action = TableFilterActionToggle( | 1147 | failed_builds_action = TableFilterActionToggle( |
1147 | 'failed_builds', | 1148 | 'failed_builds', |
1148 | 'Failed builds', | 1149 | 'Failed builds', |
1149 | QuerysetFilter(Q(outcome=Build.FAILED)) | 1150 | QuerysetFilter(Q(outcome=Build.FAILED)) |
1150 | ) | 1151 | ) |
1151 | 1152 | ||
1152 | outcome_filter.add_action(successful_builds_filter_action) | 1153 | outcome_filter.add_action(successful_builds_action) |
1153 | outcome_filter.add_action(failed_builds_filter_action) | 1154 | outcome_filter.add_action(failed_builds_action) |
1154 | self.add_filter(outcome_filter) | 1155 | self.add_filter(outcome_filter) |
1155 | 1156 | ||
1156 | # started on | 1157 | # started on |
@@ -1159,14 +1160,29 @@ class BuildsTable(ToasterTable): | |||
1159 | 'Filter by date when build was started' | 1160 | 'Filter by date when build was started' |
1160 | ) | 1161 | ) |
1161 | 1162 | ||
1162 | by_started_date_range_filter_action = TableFilterActionDateRange( | 1163 | started_today_action = TableFilterActionDay( |
1164 | 'today', | ||
1165 | 'Today\'s builds', | ||
1166 | 'started_on', | ||
1167 | 'today' | ||
1168 | ) | ||
1169 | |||
1170 | started_yesterday_action = TableFilterActionDay( | ||
1171 | 'yesterday', | ||
1172 | 'Yesterday\'s builds', | ||
1173 | 'started_on', | ||
1174 | 'yesterday' | ||
1175 | ) | ||
1176 | |||
1177 | by_started_date_range_action = TableFilterActionDateRange( | ||
1163 | 'date_range', | 1178 | 'date_range', |
1164 | 'Build date range', | 1179 | 'Build date range', |
1165 | 'started_on', | 1180 | 'started_on' |
1166 | QuerysetFilter() | ||
1167 | ) | 1181 | ) |
1168 | 1182 | ||
1169 | started_on_filter.add_action(by_started_date_range_filter_action) | 1183 | started_on_filter.add_action(started_today_action) |
1184 | started_on_filter.add_action(started_yesterday_action) | ||
1185 | started_on_filter.add_action(by_started_date_range_action) | ||
1170 | self.add_filter(started_on_filter) | 1186 | self.add_filter(started_on_filter) |
1171 | 1187 | ||
1172 | # completed on | 1188 | # completed on |
@@ -1175,14 +1191,29 @@ class BuildsTable(ToasterTable): | |||
1175 | 'Filter by date when build was completed' | 1191 | 'Filter by date when build was completed' |
1176 | ) | 1192 | ) |
1177 | 1193 | ||
1178 | by_completed_date_range_filter_action = TableFilterActionDateRange( | 1194 | completed_today_action = TableFilterActionDay( |
1195 | 'today', | ||
1196 | 'Today\'s builds', | ||
1197 | 'completed_on', | ||
1198 | 'today' | ||
1199 | ) | ||
1200 | |||
1201 | completed_yesterday_action = TableFilterActionDay( | ||
1202 | 'yesterday', | ||
1203 | 'Yesterday\'s builds', | ||
1204 | 'completed_on', | ||
1205 | 'yesterday' | ||
1206 | ) | ||
1207 | |||
1208 | by_completed_date_range_action = TableFilterActionDateRange( | ||
1179 | 'date_range', | 1209 | 'date_range', |
1180 | 'Build date range', | 1210 | 'Build date range', |
1181 | 'completed_on', | 1211 | 'completed_on' |
1182 | QuerysetFilter() | ||
1183 | ) | 1212 | ) |
1184 | 1213 | ||
1185 | completed_on_filter.add_action(by_completed_date_range_filter_action) | 1214 | completed_on_filter.add_action(completed_today_action) |
1215 | completed_on_filter.add_action(completed_yesterday_action) | ||
1216 | completed_on_filter.add_action(by_completed_date_range_action) | ||
1186 | self.add_filter(completed_on_filter) | 1217 | self.add_filter(completed_on_filter) |
1187 | 1218 | ||
1188 | # failed tasks | 1219 | # failed tasks |
@@ -1193,18 +1224,18 @@ class BuildsTable(ToasterTable): | |||
1193 | 1224 | ||
1194 | criteria = Q(task_build__outcome=Task.OUTCOME_FAILED) | 1225 | criteria = Q(task_build__outcome=Task.OUTCOME_FAILED) |
1195 | 1226 | ||
1196 | with_failed_tasks_filter_action = TableFilterActionToggle( | 1227 | with_failed_tasks_action = TableFilterActionToggle( |
1197 | 'with_failed_tasks', | 1228 | 'with_failed_tasks', |
1198 | 'Builds with failed tasks', | 1229 | 'Builds with failed tasks', |
1199 | QuerysetFilter(criteria) | 1230 | QuerysetFilter(criteria) |
1200 | ) | 1231 | ) |
1201 | 1232 | ||
1202 | without_failed_tasks_filter_action = TableFilterActionToggle( | 1233 | without_failed_tasks_action = TableFilterActionToggle( |
1203 | 'without_failed_tasks', | 1234 | 'without_failed_tasks', |
1204 | 'Builds without failed tasks', | 1235 | 'Builds without failed tasks', |
1205 | QuerysetFilter(~criteria) | 1236 | QuerysetFilter(~criteria) |
1206 | ) | 1237 | ) |
1207 | 1238 | ||
1208 | failed_tasks_filter.add_action(with_failed_tasks_filter_action) | 1239 | failed_tasks_filter.add_action(with_failed_tasks_action) |
1209 | failed_tasks_filter.add_action(without_failed_tasks_filter_action) | 1240 | failed_tasks_filter.add_action(without_failed_tasks_action) |
1210 | self.add_filter(failed_tasks_filter) | 1241 | self.add_filter(failed_tasks_filter) |