Page MenuHomeSoftware Heritage

assets/webapp: Add SWHIDs context related functions
ClosedPublic

Authored by anlambert on Apr 29 2020, 2:35 PM.

Details

Summary

Enable to get SWHIDs context from JavaScript for the currently
browsed object.

Related to T2330

Diff Detail

Repository
rDWAPPS Web applications
Branch
swhids-context-javascript
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12184
Build 18474: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 18473: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D3088 (id=10984)

Rebasing onto 57855a8dc5...

Current branch diff-target is up to date.
Changes applied before test
commit 39c2adf2b6923b3420cf709100b9884739e83ab6
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 14:33:52 2020 +0200

    assets/webapp: Add SWHIDs context related functions
    
    Enable to get SWHIDs context from JavaScript for the currently
    browsed object.
    
    Related to T2330

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

Update: Simplify cypress test

Build is green

Patch application report for D3088 (id=10987)

Rebasing onto 57855a8dc5...

Current branch diff-target is up to date.
Changes applied before test
commit 8a512d60c96b85f11cb5aa7f512a71a6c64b972b
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 14:33:52 2020 +0200

    assets/webapp: Add SWHIDs context related functions
    
    Enable to get SWHIDs context from JavaScript for the currently
    browsed object.
    
    Related to T2330

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

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/web/assets/src/bundles/webapp/webapp-utils.js
292

Please add a comment explaining what it contains

294–299

Variable names are very confusing in this function...

This revision now requires changes to proceed.Apr 29 2020, 4:30 PM

Build is green

Patch application report for D3088 (id=11001)

Rebasing onto 57855a8dc5...

Current branch diff-target is up to date.
Changes applied before test
commit be38eb1abfe640562cb158cec5f8b81ec2ca2729
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 14:33:52 2020 +0200

    assets/webapp: Add SWHIDs context related functions
    
    Enable to get SWHIDs context from JavaScript for the currently
    browsed object.
    
    Related to T2330

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

swh/web/assets/src/bundles/webapp/webapp-utils.js
292–295

what related metadata? Isn't it only the SWHID?

and it should mention there's only one SWHID per type so it's less confusing

swh/web/assets/src/bundles/webapp/webapp-utils.js
292–295

If you want the details, this is currently what we get when browsing a directory in a snapshot context for instance:

{
    "directory": {
        "object_type": "directory",
        "object_id": "b720379ee0bb9aca6695fa04d4f6dc446f70d394",
        "object_icon": "fa fa-folder",
        "swh_id": "swh:1:dir:b720379ee0bb9aca6695fa04d4f6dc446f70d394",
        "swh_id_url": "/swh:1:dir:b720379ee0bb9aca6695fa04d4f6dc446f70d394/",
        "show_options": true
    },
    "revision": {
        "object_type": "revision",
        "object_id": "8bae21962bab2fac7630982abd73676b89930902",
        "object_icon": "octicon-git-commit",
        "swh_id": "swh:1:rev:8bae21962bab2fac7630982abd73676b89930902",
        "swh_id_url": "/swh:1:rev:8bae21962bab2fac7630982abd73676b89930902/",
        "show_options": true
    },
    "snapshot": {
        "object_type": "snapshot",
        "object_id": "cd510e99a42139ed36f15a5774301c113c3e494b",
        "object_icon": "fa fa-camera",
        "swh_id": "swh:1:snp:cd510e99a42139ed36f15a5774301c113c3e494b",
        "swh_id_url": "/swh:1:snp:cd510e99a42139ed36f15a5774301c113c3e494b/",
        "show_options": true
    }
}

The metadata will likely evolve as I progress on T2330 so I did not describe the content.

swh/web/assets/src/bundles/webapp/webapp-utils.js
292–295

Then swhid/swhids are badly named in setSwhIdsContext.

It would be nice to have a comment listing the keys of each item.

swh/web/assets/src/bundles/webapp/webapp-utils.js
292–295

Sigh ... Ok let me finish to handle revision metadata first as a nice rebase party is coming.

Update: Rename some variables and improve comments

This revision is now accepted and ready to land.Apr 29 2020, 7:29 PM

Build is green

Patch application report for D3088 (id=11008)

Rebasing onto c8bca2af35...

First, rewinding head to replay your work on top of it...
Applying: assets/webapp: Add SWHIDs context related functions
Changes applied before test
commit 75ddc500c52d35d9c97684f2ec23cafc6da64ede
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 14:33:52 2020 +0200

    assets/webapp: Add SWHIDs context related functions
    
    Enable to get SWHIDs context from JavaScript for the currently
    browsed object.
    
    Related to T2330

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

Build is green

Patch application report for D3088 (id=11015)

Rebasing onto c8bca2af35...

Current branch diff-target is up to date.
Changes applied before test
commit 51f2af1e78cddedea597bb8770d51da73a4352d7
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Apr 29 14:33:52 2020 +0200

    assets/webapp: Add SWHIDs context related functions
    
    Enable to get SWHIDs context from JavaScript for the currently
    browsed object.
    
    Related to T2330

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