Created attachment 1857 [details] Started on and Completed on filters In the all builds table, the "Started on" and "Completed on" filters are supposed to have a "from ... to" option that allows users to select a date range. For details, see attached design document.
[ Implementation Notes ] * The date format error handling is done in the python class, where as a rule today’s date is substituted for bad dates. This code also automatically swaps date ranges when they are in reverse order. An enhancement (when we have more time) is to move this code to the javascript side. * The new feature is keyed by an option having the value of “from-to”, which we can do since this option is user selected and there is no good single value to pass. A later enhancement would to pass the current range to preset the to-from values. When this is set, a new option[4] field is added which passes a prefix so that the generated code can uniquely connect the instance of filter to the respective jquery methods in “main.js”. * Since we discovered that the “__lte” does not work for dates - it does an “__le” instead - the “to” date is internally incremented by one day to convert an inclusive date to an exclusive one. * The “from” variable is given the name “filter” to allow the normal interface code to work (e.g. the radio button), and the “to” variable is unique. That 'to' input value is caught in the view class, the two dates are normalized and joined into a full filter, and “_redirect_parameters” is called to pass a clean filter URL context back to the “build” class.
Targeting M3
*** Bug 6148 has been marked as a duplicate of this bug. ***
I am porting this patch from Toaster-1.6 to 1.8. Belen had these additional requested changes: 1) minDate and maxDate don't seem to be set. From the spec: "We should restrict the date range in the widget by setting the minDate to the earliest build start date in the table, and the maxDate to the latest build start date in the table." 2) Applied filter tooltip not working 3) The filter should remember the selected date. Steps to reproduce: ** Open the started on filter ** Select the "Builds from" radio button ** Select a date in the from and to fields and click Apply ** Click on the filter button to open the filter again Outcome: the "all builds" option is selected. Expected outcome: the "Builds from" option should still be selected, with my selected dates still showing in the from and to fields 4) If you leave the "to" field blank and click the Apply button you get the following error Traceback: File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 115. response = callback(request, *callback_args, **callback_kwargs) File "/home/yocto/poky/bitbake/lib/toaster/toastergui/views.py" in builds 268. (filter_string, search_term, ordering_string) = _search_tuple(request, Build) File "/home/yocto/poky/bitbake/lib/toaster/toastergui/views.py" in _search_tuple 171. raise BaseException("Invalid filter " + str(invalid)) Exception Type: BaseException at /gui/builds/ Exception Value: Invalid filter We have an invalid number of separators: 26/03/2014 -> [u'26/03/2014'] 5) In the Completed on filter, the "Builds from" radio button is selected but input fields are disabled when I use the back button. Steps to reproduce: ** Open the Completed on filter ** Select the "Builds from" radio button and select dates in the from to fields ** Click apply ** In the results page, click the back button ** Open the "Completed on" filter Outcome: The "Builds from" radio button is still selected, but the from and to fields are disabled. Expected outcome: Whenever the "Builds from" radio button is selected, the from and to fields should be enabled
There is a follow on patch in "adamian/20150324_submission" for empty databases. Implementation Notes: We are using * The jQuery UI download builder was used, selected only for datepicker. This gave a much smaller footprint for the UI code. It also gives us the option to incrementally add other widgets in the future. * Persistence for the date range values is only to the current page, where the values are passed via the context to the page and then back with hidden input boxes. The only usage oddity is that if you do use the filter column's hover pop-up to switch the filter back to “Show All”, the date range pickers lose those previous values since that link skips those values, however the values are easily re-entered. We can fix that when we update our persistence model in YP-1.9.