kobotoolbox / kpi

kpi is the (frontend) server for KoboToolbox. It includes an API for users to access data and manage their forms, question library, sharing settings, create reports, and export data.
https://www.kobotoolbox.org
GNU Affero General Public License v3.0
131 stars 177 forks source link

[TASK-788] Fix Library pagination #4963

Closed magicznyleszek closed 4 months ago

magicznyleszek commented 4 months ago

Checklist

  1. [ ] If you've added code that should be tested, add tests
  2. [ ] If you've changed APIs, update (or create!) the documentation
  3. [x] Ensure the tests pass
  4. [x] Make sure that your code lints and that you've followed our coding style
  5. [x] Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. [ ] Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. [ ] Open an issue in the docs if there are UI/UX changes

Description

Fixed pagination not appearing for My Library, Public Collections and Single Collection, thus blocking users from accessing items after page 1.

Notes

There is a small fix in one commit, and UI improvement in other (replaced buttons with new Button component in the AssetsTable footer)

Testing:

  1. A lot of (more than 100) library items:
    • Please use many small.zip
    • Drop whole 40 files onto My Library and let it upload (might take a while, might freeze your local environment)
    • Repeat two more times, or until you have enought to see and use pagination
  2. Huge (more than 100 items) collection:
    • Drop HUGE_COLLECTION.xlsx file onto My Library
    • It would ask you to choose type, just click ok (this is a bug - not recognizing this XLSX file is a collection - that I will fix in other PR)
    • Let it process it; it will take some time, and probably you would need to reload browser tab to see it - the collection has almost 2000 items :)
    • Navigate inside the collection and test the pagination (should be in the footer of the table of assets)
  3. A lot of public collections:
    • This one is harder to test, as there is no easy way to have 100+ public collections
    • Just create 4-5 collections, enter each and use "Make public" button (there is a bug with it - see #4964)
    • In the code in publicCollectionsStore.ts temporarily change PAGE_SIZE = 100 to PAGE_SIZE = 2 to see pagination in action
    • This method actually works for two other points too 🙃

Related issues

notion-workspace[bot] commented 4 months ago

Library pagination fix