Description
Jonathan Druart
2024-10-08 10:01:00 UTC
Created attachment 172569 [details] [review] Bug 38116: Build patron search descriptions using DT's search settings The goal of this patch is to move the construction of the patron search description to datatables.js in order to make it generic and reusable. With bug 33484 and the restoration of the state from localStorage or the URL could lead to confusion when the table is displayed. It could also be problematic when an hidden column has a search pattern. Note that if a column has a dropdown list with an option selected AND is hidden, the description won't display the value but the code (eg. ^CPL$ if library Centerville is selected) Could we get a test plan for this? I'm not sure what has changed or what to look for. Thanks! Currently there is a description of the search displayed. It is adjusted when you use the filters on the left or when you click on the the "start with" letters that is on top of the table. However it's not updated when a filter on the table is used (general search of column filters). It can lead to confusion, especially with bug 33484 where you can use a link to restore specific state of a table. A test plan would be: Use the filter on the left Use a "start with" letter => No change in behaviour Use the global search filter and the column filters => They are appended to the description Hide columns where you have filter => Still in the description. But notice a tiny problem if an option of a dropdown list is selected, code is displayed instead of description. Could be fixed I think, but on a separate bug. Created attachment 173663 [details] [review] Bug 38116: Build patron search descriptions using DT's search settings The goal of this patch is to move the construction of the patron search description to datatables.js in order to make it generic and reusable. With bug 33484 and the restoration of the state from localStorage or the URL could lead to confusion when the table is displayed. It could also be problematic when an hidden column has a search pattern. Note that if a column has a dropdown list with an option selected AND is hidden, the description won't display the value but the code (eg. ^CPL$ if library Centerville is selected) Created attachment 175585 [details] [review] Bug 38116: Build patron search descriptions using DT's search settings The goal of this patch is to move the construction of the patron search description to datatables.js in order to make it generic and reusable. With bug 33484 and the restoration of the state from localStorage or the URL could lead to confusion when the table is displayed. It could also be problematic when an hidden column has a search pattern. Note that if a column has a dropdown list with an option selected AND is hidden, the description won't display the value but the code (eg. ^CPL$ if library Centerville is selected) Signed-off-by: David Nind <david@davidnind.com> I've signed off, as I finally figured out what was meant by "Search description". However, one issue I noted is clearing the search. If you use the "Clear" button in the left-hand sidebar, it doesn't clear the search description. For example: 1. For the 'Search' field enter: a 2. For the 'Search type' field: Starts with 3. Click the 'Search' button 4. In the "Global search filter" field above the table: e 5. In the card column filter: 0000 6. The search description: Patrons found for: Anywhere: e Standard starting with 'a' Card=0000 7. Click "Clear" in the left-hand sidebar 8. The search description is still displayed on the page (as per step 6), with no search results. 9. To make the search description disappear, either start a new search or click the "Patrons" top menu item to reload the patrons page. 10. If you just do a search using the search filters on the left-hand side (steps 1-3), the clear doesn't work for that either. Testing notes (using KTD) ========================= "search description" means and what is searched for, for example if you search for 'a', then above the table of search results the search criteria are shown "Patrons found for: Standard starting with 'a'". The search filters (in the left sidebar) ---------------------------------------- Before the patch: 1. Filters on the left: 1.1 For the 'Search' field enter: a 1.2 For the 'Search type' field: Starts with 1.3 Click 'Search' 1.4 In the search results it says (under the 'Browse by last name'): "Patrons found for: Standard starting with 'a'" After the patch, there should be no change: "Patrons found for: Standard starting with 'a'" Global search filter and column filters --------------------------------------- - Global search filter = above the table column headings (Show XX entries First Previous X Next Last Search_____ x Clear filter) - Column filters = in the search results table, under the table column headings 1. Enter e in the global search filter: 1.1 Before the patch - no change to the search description: "Patrons found for: Standard starting with 'a'" 1.2 After the patch - now shows in the search description: "Patrons found for: Anywhere: e Standard starting with 'a'" 2. In the column filter for the Card, enter 0000 2.1 No change to the search description: Patrons found for: Standard starting with 'a' 2.2 After the patch - now shows in the search description: "Patrons found for: Anywhere: e Standard starting with 'a' Card=0000" 2.3 Note: If the card column is hidden, the results don't change and the "Card=0000" still shows in the search description 2.4 Note: If a column filter has a dropdown list, the description is now displayed in the search description, for example: Patrons found for: Standard starting with 'a' Library=Midway, Category=Staff Created attachment 175600 [details] [review] Bug 38116: Hide the description on 'Clear' (In reply to David Nind from comment #6) > I've signed off, as I finally figured out what was meant by "Search > description". > > However, one issue I noted is clearing the search. > > If you use the "Clear" button in the left-hand sidebar, it doesn't clear the > search description. > > For example: > 1. For the 'Search' field enter: a > 2. For the 'Search type' field: Starts with > 3. Click the 'Search' button > 4. In the "Global search filter" field above the table: e > 5. In the card column filter: 0000 > 6. The search description: > Patrons found for: Anywhere: e > Standard starting with 'a' > Card=0000 > 7. Click "Clear" in the left-hand sidebar > 8. The search description is still displayed on the page (as per step 6), > with no search results. > 9. To make the search description disappear, either start a new search or > click the "Patrons" top menu item to reload the patrons page. > 10. If you just do a search using the search filters on the left-hand side > (steps 1-3), the clear doesn't work for that either. Definitely a regression, fixed with the last patch. Thanks! (In reply to Jonathan Druart from comment #8) > Definitely a regression, fixed with the last patch. Thanks! Thanks Jonathan! I retested - I had to click "Clear" twice to fully clear the search description, even then it didn't clear the column filter. - Search box: a - Click "Search" - Table filter: e - Card column filter: 0000 - Search description: Patrons found for: Anywhere: e Standard starting with 'a' Card=0000 - Click "Clear" - no search description - Do another search, say: p - Card column still has the 0000 filter, even though it is not using it Created attachment 176043 [details] [review] Bug 38116: Empty column filters (In reply to David Nind from comment #9) > (In reply to Jonathan Druart from comment #8) > > > Definitely a regression, fixed with the last patch. Thanks! > > Thanks Jonathan! > > I retested - I had to click "Clear" twice to fully clear the search > description, even then it didn't clear the column filter. > - Search box: a > - Click "Search" > - Table filter: e > - Card column filter: 0000 > - Search description: > Patrons found for: Anywhere: e > Standard starting with 'a' > Card=0000 > - Click "Clear" - no search description > - Do another search, say: p > - Card column still has the 0000 filter, even though it is not using it Good catch, thanks! What you describe is fixed in the last patch. I don't need to click twice on the "Clear" button however. Let me know if you find something else! (In reply to Jonathan Druart from comment #11) > (In reply to David Nind from comment #9) > > (In reply to Jonathan Druart from comment #8) > > > > > Definitely a regression, fixed with the last patch. Thanks! > > > > Thanks Jonathan! > > > > I retested - I had to click "Clear" twice to fully clear the search > > description, even then it didn't clear the column filter. > > - Search box: a > > - Click "Search" > > - Table filter: e > > - Card column filter: 0000 > > - Search description: > > Patrons found for: Anywhere: e > > Standard starting with 'a' > > Card=0000 > > - Click "Clear" - no search description > > - Do another search, say: p > > - Card column still has the 0000 filter, even though it is not using it > > Good catch, thanks! > What you describe is fixed in the last patch. I don't need to click twice on > the "Clear" button however. Let me know if you find something else! Thanks Jonathan! I retested, and that fixes the column filter. However, now, if you click "Clear" the search description clears, but if you wait a moment, the search description is displayed again: Patrons found for: Anywhere: e Card=0000 If you then search again, say 'p', then you get the right results and the search description changes (as expected) to: Patrons found for: Standard starting with 'p' (The results are correct as well.) (In reply to David Nind from comment #12) > However, now, if you click "Clear" the search description clears, but if you > wait a moment, the search description is displayed again: > Patrons found for: Anywhere: e > Card=0000 "Wait a moment"? What do you mean? You click "Clear", the description is hidden, as well as the table, then? You wait like... 10 seconds doing nothing and the description appears, without the table? Like... black magic? :) Can you provide the detailed steps please? Created attachment 176051 [details] Screenshot - Search description "magically" reappearing (In reply to Jonathan Druart from comment #13) > (In reply to David Nind from comment #12) > "Wait a moment"? What do you mean? > > You click "Clear", the description is hidden, as well as the table, then? > You wait like... 10 seconds doing nothing and the description appears, > without the table? Like... black magic? :) > > Can you provide the detailed steps please? By "Wait a moment" I mean: 1. Don't do anything for a few seconds after clicking "Clear". 2. After clicking "Clear" I left the mouse hovering above the clear button. 3. Then the search description "magically" reappears (almost instantly): Patrons found for: Anywhere: e Card=0000 I've attached a screenshot. I used both Chromium and Firefox, with cleared browser caches. No errors or anything is displayed in the web developer tools console. Here are the steps to reproduce: 1. Apply the patches. 2. Go to Patrons in the staff interface. 3. In the "Search for patron" in the left sidebar: - Search box: a - Click "Search" --> Search description is: Patrons found for: Standard starting with 'a' 4. For the table filter (Search:_____ x Clear filter): e --> Search description is: Patrons found for: Anywhere: e Standard starting with 'a' 5. For the column filters - Card column: 0000 --> Search description is: Patrons found for: Anywhere: e Standard starting with 'a' Card=0000 6. Click "Clear" --> There is no text displayed for the search description 7. Leave your mouse hovering above the "Clear" button. 8. Almost immediately, the search description "magically" reappears under the "Browse by last name: A B C...: Patrons found for: Anywhere: e Card=0000 9. Do another search, say: p --> Correct results returned --> Search description (as expected): Patrons found for: Standard starting with 'p' (In reply to David Nind from comment #14) > Created attachment 176051 [details] > Screenshot - Search description "magically" reappearing > > (In reply to Jonathan Druart from comment #13) > > (In reply to David Nind from comment #12) > > > "Wait a moment"? What do you mean? > > > > You click "Clear", the description is hidden, as well as the table, then? > > You wait like... 10 seconds doing nothing and the description appears, > > without the table? Like... black magic? :) > > > > Can you provide the detailed steps please? > > By "Wait a moment" I mean: > 1. Don't do anything for a few seconds after clicking "Clear". > 2. After clicking "Clear" I left the mouse hovering above the clear button. > 3. Then the search description "magically" reappears (almost instantly): > Patrons found for: Anywhere: e > Card=0000 > > I've attached a screenshot. Can you try on a sandbox please? I don't recreate this problem. https://staff-bug38116.sandboxes.biblibre.eu/cgi-bin/koha/members/members-home.pl (In reply to Jonathan Druart from comment #15) > > Can you try on a sandbox please? I don't recreate this problem. > > https://staff-bug38116.sandboxes.biblibre.eu/cgi-bin/koha/members/members- > home.pl Thanks Jonathan. I created a quick video (not the greatest quality) that demonstrates the issue - I attached to a direct message on chat. David Thanks, it was very helpful. It happens because a search a triggered when the column filter lose the focus. I didn't recreate it as I was clicking outside of the filter before hitting the "Clear" button. I think it's a separate problem, I have opened bug 38827. (In reply to Jonathan Druart from comment #17) > Thanks, it was very helpful. > > It happens because a search a triggered when the column filter lose the > focus. > I didn't recreate it as I was clicking outside of the filter before hitting > the "Clear" button. > > I think it's a separate problem, I have opened bug 38827. Thanks Jonathan! I can confirm that after applying the patch for 38827, that this no longer happens. David Created attachment 177211 [details] [review] Bug 38116: Build patron search descriptions using DT's search settings The goal of this patch is to move the construction of the patron search description to datatables.js in order to make it generic and reusable. With bug 33484 and the restoration of the state from localStorage or the URL could lead to confusion when the table is displayed. It could also be problematic when an hidden column has a search pattern. Note that if a column has a dropdown list with an option selected AND is hidden, the description won't display the value but the code (eg. ^CPL$ if library Centerville is selected) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 177212 [details] [review] Bug 38116: Hide the description on 'Clear' Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 177213 [details] [review] Bug 38116: Empty column filters Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 177920 [details] [review] Bug 38116: Build patron search descriptions using DT's search settings The goal of this patch is to move the construction of the patron search description to datatables.js in order to make it generic and reusable. With bug 33484 and the restoration of the state from localStorage or the URL could lead to confusion when the table is displayed. It could also be problematic when an hidden column has a search pattern. Note that if a column has a dropdown list with an option selected AND is hidden, the description won't display the value but the code (eg. ^CPL$ if library Centerville is selected) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 177921 [details] [review] Bug 38116: Hide the description on 'Clear' Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 177922 [details] [review] Bug 38116: Empty column filters Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> I am not going to block this, but I feel the display could be a little nicer for the additional search criteria. Also not sure about capitalization here and itching to change the upper cases... Patrons found for: Card number starting with 't' Library=Riverside, Category=School What do you think? Pushed for 25.05! Well done everyone, thank you! (In reply to Katrin Fischer from comment #25) > I am not going to block this, but I feel the display could be a little nicer > for the additional search criteria. Also not sure about capitalization here > and itching to change the upper cases... > > Patrons found for: Card number starting with 't' > Library=Riverside, Category=School > > What do you think? I have opened bug 39288. |