Skip to content

WIP - Multi pages

Mael Gaspard Lhoutellier requested to merge multi-pages into master

We wanted to be able to load the nationals (groups/projects/badges) iteratively by pages, based on the gitlab api paging system.

x-per-page  // Number of items returned / page
x-page      // Current page index
x-next-page // Next page index (or empty if last)
x-prev-page // Last page index (or empty if first)

To do that, we had to:

  • Add a per element prop to pass to the the api (DEFAULT_PER_PAGE in index.js)
  • Add the mean to pass parameters to the api for the current page index (DEFAULT_PAGE & extract_page())
  • Return the gitlab api paging system infos to the front (handle_headers)
  • Handle the recursive fetching in the front while the last page is not reached.

The headers of the api requests return are now in the following shape:

{
                ...
   "page":        [gitlab x-page],
   "next_page":   [gitlab x-next-page],
   "prev_page":   [gitlab x-prev-page],
   "per_page":    [gitlab x-per-page],
   "total":       [gitlab x-total],
   "total_pages": [gitlab x-total-pages],
}

Merge request reports