Page MenuHomeSoftware Heritage

Paginate origin search results using the Link header instead of offsets.
ClosedPublic

Authored by vlorentz on Nov 29 2019, 3:40 PM.

Details

Reviewers
anlambert
Group Reviewers
Reviewers
Summary

The 'offset' parameter of the origin search API is deprecated.

Diff Detail

Repository
rDWAPPS Web applications
Branch
paginate-link-header
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 9483
Build 13943: Cypress tests for swh-web diffsJenkins
Build 13942: tox-on-jenkinsJenkins
Build 13941: arc lint + arc unit

Event Timeline

anlambert added a subscriber: anlambert.

Apart a couple of nitpicks to handle, looks good !

swh/web/assets/src/bundles/browse/origin-search.js
11–14

If the variable is not going to get modified, it is better to declare it with const instead of let

131–144

Here I would rather write:

let response;
fetch(searchUrl)
 .then(handleFetchError)
 .then(resp => {
   response = resp;
   return resp.json();
  })
 .then(data => {

Feels more readable to me.

147

s/backword/backward/

swh/web/tests/data.py
188

You should add a visit to each origin (pointing to the empty snapshot for instance).

When executing cypress tests for origins search, the api/1/origin/(origin_url)/visit/latest/ endpoint will be
queried for each origin and currently all requests end up with 404. This is not critical but this generates
a lot of noise in cypress logs.

This revision now requires changes to proceed.Dec 2 2019, 5:13 PM

also add a snapshot to visits.

This revision is now accepted and ready to land.Dec 3 2019, 2:51 PM

Landed as 7e7b80a899975b743928c46a7daf97584dcf0e5b.