Page MenuHomeSoftware Heritage

Add link to origin extrinsic metadata API endpoint from the UI
ClosedPublic

Authored by vlorentz on Wed, Jul 13, 10:29 AM.

Details

Summary

For staff users only, like other extrinsic metadata

Depends on D8119.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8120 (id=29339)

Could not rebase; Attempt merge onto 6f9d36afe4...

Updating 6f9d36af..96fefcf4
Fast-forward
 swh/web/api/utils.py                          |  8 ++-
 swh/web/api/views/metadata.py                 | 83 ++++++++++++++++++++++++--
 swh/web/api/views/origin.py                   |  4 ++
 swh/web/templates/includes/show-metadata.html |  6 ++
 swh/web/tests/api/test_utils.py               | 21 ++++++-
 swh/web/tests/api/views/test_metadata.py      | 84 ++++++++++++++++++++++-----
 swh/web/tests/browse/views/test_origin.py     | 64 +++++++++++++++++++-
 7 files changed, 243 insertions(+), 27 deletions(-)
Changes applied before test
commit 96fefcf4742b36beb6a68bceb941de2d6ff0b38a
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jul 13 10:29:24 2022 +0200

    Add link to origin extrinsic metadata API endpoint from the UI
    
    For staff users only, like other extrinsic metadata

commit 82e885e10bcd1ff93e50f3fbe30389192e642ec4
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jul 13 10:27:10 2022 +0200

    Add API endpoint to get the list of metadata authorities on an origin from its URL
    
    which redirects to the 'proper' one based on extended SWHIDs.
    
    It is more convenient for debugging than computing URL hashes;
    and it will also be used in a template (which cannot really compute
    SWHID, and would need non-trivial refactoring to get access to it)

commit b76a3cec0dc71bd46a6c3f89dc26f00734b6a706
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Jul 12 13:49:37 2022 +0200

    Add support for querying raw-extrinsic-metadata for origins
    
    It is purposefully discouraged to query the api-1-raw-extrinsic-metadata-swhid
    endpoint directly, as extended SWHIDs should not be part of the public API.
    
    Instead, clients should query api-1-origin first, and rely on the link
    in its response to fetch metadata.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1932/ for more details.

This revision is now accepted and ready to land.Wed, Jul 13, 10:52 AM