Page MenuHomeSoftware Heritage

deposit moderation view: Improve deposit types visualization
ClosedPublic

Authored by ardumont on Feb 25 2022, 6:25 PM.

Details

Summary

This explicits the deposit's type, either 'code' or 'meta'. The uri column is now filled
depending on that type. Mostly, the parsing of the deposit's raw xml content is done to
try and extract that potentially provided information.

If not found, this uses the same heuristics as before (either use the origin_url if
provided or extract the origin out of the swhid_context).

Screenshot:

Related to T3680

Test Plan
  • tox
  • cypress
  • docker-compose happy (see screenshot, out of staging data)

Diff Detail

Repository
rDWAPPS Web applications
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27170
Build 42499: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 42498: arc lint + arc unit

Event Timeline

assets/src/bundles/admin/deposit.js
74

I've dropped that bit of a mess here so it's done server side (since there we can reuse other swh components for this).
Plus, we can try and extract the actual origin out of the raw metadata xml if any.

ardumont edited the summary of this revision. (Show Details)

Build has FAILED

Patch application report for D7262 (id=26296)

Rebasing onto 57a83b9a7f...

Current branch diff-target is up to date.
Changes applied before test
commit dd8a7279801f426aa75b65c428083dc11ea0b70e
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Feb 25 18:21:00 2022 +0100

    deposit moderation view: Improve deposit types visualization
    
    This explicits the deposit's type, either 'code' or 'meta'. The uri column is now filled
    depending on that type. Mostly, the parsing of the deposit's raw xml content is done to
    try and extract that potentially provided information.
    
    If not found, this uses the same heuristics as before (either use the origin_url if
    provided or extract the origin out of the swhid_context).
    
    Related to T3680

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1412/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1412/console

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 25 2022, 6:42 PM
Harbormaster failed remote builds in B27169: Diff 26296!

Add coverage and adapt js test

Build is green

Patch application report for D7262 (id=26297)

Rebasing onto 57a83b9a7f...

Current branch diff-target is up to date.
Changes applied before test
commit 17c430c66885d26d2e6a525baac2bab9f799f8c5
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Feb 25 18:21:00 2022 +0100

    deposit moderation view: Improve deposit types visualization
    
    This explicits the deposit's type, either 'code' or 'meta'. The uri column is now filled
    depending on that type. Mostly, the parsing of the deposit's raw xml content is done to
    try and extract that potentially provided information.
    
    If not found, this uses the same heuristics as before (either use the origin_url if
    provided or extract the origin out of the swhid_context).
    
    Related to T3680

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

swh/web/admin/deposit.py
114

That will be dropped.

126

Yes, this module needs a complete coverage.
This will be done later in a future diff, this one is large enough already.

vlorentz added inline comments.
assets/src/bundles/admin/deposit.js
19

XSS, you need to escape data

74

thx

swh/web/common/utils.py
453–461

you don't need all these

484–487
516–519
swh/web/tests/resources/deposit/raw-metadata-add-to-origin.xml
10

why don't you hardcode it here?

swh/web/tests/resources/deposit/raw-metadata-create-origin.xml
10

ditto

swh/web/tests/resources/deposit/raw-metadata-provenance.xml
11

ditto

This revision now requires changes to proceed.Feb 28 2022, 5:37 PM
assets/src/bundles/admin/deposit.js
19

any idea of the function to do this?
I tried the escape function but that makes the test fail.

swh/web/common/utils.py
453–461

I'll keep only the schema and deposit one.
Shout out if we need more please.

assets/src/bundles/admin/deposit.js
19

encoreURI seems to do the trick ;)

ardumont edited the test plan for this revision. (Show Details)

Adapt according to review

This revision is now accepted and ready to land.Mar 7 2022, 10:42 AM

Build is green

Patch application report for D7262 (id=26432)

Rebasing onto 57a83b9a7f...

Current branch diff-target is up to date.
Changes applied before test
commit 72a8c2ed0f50874c949d2698849ed63d36f188d8
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Feb 25 18:21:00 2022 +0100

    deposit moderation view: Improve deposit types visualization
    
    This explicits the deposit's type, either 'code' or 'meta'. The uri column is now filled
    depending on that type. Mostly, the parsing of the deposit's raw xml content is done to
    try and extract that potentially provided information.
    
    If not found, this uses the same heuristics as before (either use the origin_url if
    provided or extract the origin out of the swhid_context).
    
    Related to T3680

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