Bug 29404 - Add infinite scrolling to pickup location dropdowns
Summary: Add infinite scrolling to pickup location dropdowns
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Nick Clemens
URL:
Keywords:
Depends on: 29355
Blocks: 29407
  Show dependency treegraph
 
Reported: 2021-11-03 13:33 UTC by Tomás Cohen Arazi
Modified: 2021-11-11 12:35 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.11.00


Attachments
Bug 29404: Add infinite scrolling to pickup location dropdowns (11.27 KB, patch)
2021-11-03 13:44 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[DO NOT PUSH] Bug 29404: Helper script to generate pickup locations (902 bytes, patch)
2021-11-03 13:45 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29404: Add infinite scrolling to pickup location dropdowns (11.34 KB, patch)
2021-11-03 13:57 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29404: Add infinite scrolling to pickup location dropdowns (11.39 KB, patch)
2021-11-04 12:21 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2021-11-03 13:33:53 UTC
As mentioned on bug 29355 comment 12, we should've made the pickup locations dropdowns use the infinite scrolling feature from Select2.
Comment 1 Tomás Cohen Arazi 2021-11-03 13:44:16 UTC
Created attachment 127255 [details] [review]
Bug 29404: Add infinite scrolling to pickup location dropdowns

This patch adds infinite scrolling to the pickup locations select2
dropdowns on the staff interface.

It does so by adding a new transport function (in select2.js) to read
the response headers Koha's API sends back, and converting to the right
data structure Select2 expects for the feature to work.

This is manually used in the different pickup locations dropdowns.
There's a separate bug that will introduce a select2 wrapper that will probably embed this function in it.

To test:
1. Run the [DO NOT PUSH] script inside koha-shell to generate random
   pickup locations:
   $ kshell
  k$ perl generate_pickup_locations.pl
2. Try placing holds. Notice the visible pickup locations dropdowns
   display some pickup locations based on the matches you got. They are
   all fetched once
=> SUCCESS: It works
3. Repeat for the current holds page and the patron holds listing
=> SUCCESS: Same behavior
4. Apply this patch
5. Repeat 2 and 3
=> SUCCESS: Things work, but pickup locations are retrieved as needed,
while you scroll.
6. Sign off :-D
Comment 2 Tomás Cohen Arazi 2021-11-03 13:45:51 UTC
Created attachment 127256 [details] [review]
[DO NOT PUSH] Bug 29404: Helper script to generate pickup locations

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Martin Renvoize 2021-11-03 13:57:27 UTC
Created attachment 127262 [details] [review]
Bug 29404: Add infinite scrolling to pickup location dropdowns

This patch adds infinite scrolling to the pickup locations select2
dropdowns on the staff interface.

It does so by adding a new transport function (in select2.js) to read
the response headers Koha's API sends back, and converting to the right
data structure Select2 expects for the feature to work.

This is manually used in the different pickup locations dropdowns.
There's a separate bug that will introduce a select2 wrapper that will probably embed this function in it.

To test:
1. Run the [DO NOT PUSH] script inside koha-shell to generate random
   pickup locations:
   $ kshell
  k$ perl generate_pickup_locations.pl
2. Try placing holds. Notice the visible pickup locations dropdowns
   display some pickup locations based on the matches you got. They are
   all fetched once
=> SUCCESS: It works
3. Repeat for the current holds page and the patron holds listing
=> SUCCESS: Same behavior
4. Apply this patch
5. Repeat 2 and 3
=> SUCCESS: Things work, but pickup locations are retrieved as needed,
while you scroll.
6. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2021-11-03 13:58:08 UTC
Works as expected :)
Comment 5 Nick Clemens 2021-11-04 12:21:38 UTC
Created attachment 127317 [details] [review]
Bug 29404: Add infinite scrolling to pickup location dropdowns

This patch adds infinite scrolling to the pickup locations select2
dropdowns on the staff interface.

It does so by adding a new transport function (in select2.js) to read
the response headers Koha's API sends back, and converting to the right
data structure Select2 expects for the feature to work.

This is manually used in the different pickup locations dropdowns.
There's a separate bug that will introduce a select2 wrapper that will probably embed this function in it.

To test:
1. Run the [DO NOT PUSH] script inside koha-shell to generate random
   pickup locations:
   $ kshell
  k$ perl generate_pickup_locations.pl
2. Try placing holds. Notice the visible pickup locations dropdowns
   display some pickup locations based on the matches you got. They are
   all fetched once
=> SUCCESS: It works
3. Repeat for the current holds page and the patron holds listing
=> SUCCESS: Same behavior
4. Apply this patch
5. Repeat 2 and 3
=> SUCCESS: Things work, but pickup locations are retrieved as needed,
while you scroll.
6. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Jonathan Druart 2021-11-08 10:52:42 UTC
Hard call, really.
It can be considered an enhancement for libraries with hundreds of branches, but for those with very few? You have to wait 1 sec for the result every time you interact with the dropdown, it would be immediate if the filtering is done by JS locally. I can imagine easily it could become unusable if the server is a bit overloaded (and this will help the server to become even more overloaded...)

I am willing to push it for 21.11 in order to get feedback from end users, but we should be ready to revert this behaviour if needed.
Comment 7 Jonathan Druart 2021-11-08 11:19:42 UTC
Pushed to master for 21.11, thanks to everybody involved!