Bug 6040 - Implement "from ... to" option in the "Started on" and "Completed on" filters
Summary: Implement "from ... to" option in the "Started on" and "Completed on" filters
Status: RESOLVED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 1.6.1
Hardware: All Multiple
: Medium normal
Target Milestone: 1.8 M4
Assignee: David Reyna
QA Contact:
URL:
Whiteboard:
: 6148 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-03-25 12:35 UTC by Belen Barros Pena
Modified: 2015-03-25 16:27 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Started on and Completed on filters (658.13 KB, application/pdf)
2014-03-25 12:35 UTC, Belen Barros Pena
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Belen Barros Pena 2014-03-25 12:35:20 UTC
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.
Comment 1 David Reyna 2014-04-09 23:56:15 UTC
[ 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.
Comment 2 Alexandru Damian 2014-07-31 14:10:25 UTC
Targeting M3
Comment 3 Alexandru Damian 2014-07-31 14:12:32 UTC
*** Bug 6148 has been marked as a duplicate of this bug. ***
Comment 4 David Reyna 2015-02-25 05:11:24 UTC
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
Comment 5 David Reyna 2015-03-25 16:27:23 UTC
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.