Bug #5620
closed[Workbench] Collection#show page search filter is neither cleared nor applied when back button is used in Chrome.
Description
- Using Safari or Chrome, access https://workbench.4xphq.arvadosapi.com/collections/4xphq-4zz18-gbv4fbtq6sdvzpd . You will see 3 files in this collection.
- Type “md5sum” in the search box. You will see two files. Select them and click on Selection -> create new collection…
- Once you are in the new collection page, hit back button
- You will now see all three files (all the files in this collection); however, the search box still has the text “md5sum” in it and the two md5sum files are selected. That is, the collection page is reloaded, but the browser is caching user inputs.
What needs to be done:
- It would be nice if we can apply the search filter when the user hits the back button
- Alternatively, we should clear the search box text as well as the check box selections (if #1 is not acceptable). To clear user inputs add autocomplete="off" to the search box and checkboxes.
Updated by Radhika Chippada over 9 years ago
- Description updated (diff)
- Category set to Workbench
Updated by Tom Clegg over 9 years ago
- Perhaps the browser sends an event when it puts stuff in the input, like "input" or "change" or "autocomplete" -- in this case we just need to add this to the list of events that we listen for in our input→filters code.
- If not, perhaps
$(document).ready(function(){$('input').trigger('input');});
will do it.
Updated by Radhika Chippada over 9 years ago
Implementation notes:
Added ready handler for input. To test, use Chrome (and probably Safari) to view a collection page and enter text in search box. Select one or two files from the results and combine to transition into the new collection page. Hit back button and you will see the search filter applied (provided your browser retained those search filters). Firefox does not retain user inputs (at least on my machine).
The application_helper file update is unrelated. As I was reading through the code, I learned that I can pass Collection as resource_class, rather than getting it from uuid. Since in this context, dataclass can be either Collection or File, I was not passing it and letting the object_readable method to get from uuid. Now that I learned that I can pass it instead, passing to avoid this unnecessary step.
Updated by Radhika Chippada over 9 years ago
- Status changed from New to In Progress
- Assigned To set to Radhika Chippada
- Target version changed from Bug Triage to 2015-04-29 sprint
Updated by Tom Clegg over 9 years ago
1.5 comments at 4ccec6c:
Glad$('input').trigger('input');
works, but I think it should get a comment. (I know what it's for right now, but in 10 minutes it might look totally superfluous/mysterious, and no tests will fail if someone removes it...) Perhaps:
- This is needed to trigger input validation/synchronization callbacks because some browsers auto-fill form fields (e.g., when navigating "back" to a page where some text had been entered in a search box) without triggering a change or input event.
In case you're looking for bikeshed ideas, for this:
is_readable_input = object_readable attrvalue, Collection unless attrvalue.andand.empty?
How about:
is_readable_input = attrvalue.present? and object_readable attrvalue, Collection
Updated by Radhika Chippada over 9 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:1fe347f8cf77564a791b9f98963fc73ee6802c4f.